PayFast Integration to React signature error - reactjs

Hello I am trying to integrate PayFast to my ReactJS project but I am getting this error
signature : Generated signature does not match submitted signature
I do not understand because based on the docs https://developers.payfast.co.za/docs#step_2_signature we are to generate an Md5 hash then submit it through with the entire form
can I please get some assistance in resolving this I am using the default sandbox merchant_id and merchant_key
Code to PayFast Custom Form integration
<form action="https://sandbox.payfast.co.za​/eng/process">
<input
type="hidden"
name="merchant_id"
value={process.env.REACT_APP_MERCHANT_ID}
/>
<input
type="hidden"
name="merchant_key"
value={process.env.REACT_APP_MERCHANT_KEY}
/>
<input
type="hidden"
name="return_url"
value="http://127.0.0.1:3000/success"
/>
<input
type="hidden"
name="cancel_url"
value="http://127.0.0.1:3000/cart/cancel"
/>
<input type="hidden" name="name_first" value="Junior" />
<input type="hidden" name="name_last" value="Hlongwane" />
<input
type="hidden"
name="email_address"
value="jh0417783#gmail.com"
/>
<input type="hidden" name="cell_number" value=<entered my number> />
<input type="hidden" name="amount" value="800.00" />
<input type="hidden" name="item_name" value="Test Item" />
<input type="hidden" name="email_confirmation" value="1" />
<input
type="hidden"
name="signature"
value="f103e22c0418655fb03991538c51bfd5"
/>
<button className="Cart__checkOutButton">
PROCEED TO CHECKOUT
</button>
</form>

Related

Is there a way of disabling the autofill of input in React?

I have a react app that has a couple of inputs. The problem is, whenever I navigate to the page, it auto-fills all the fields with previously entered data on Microsoft Edge (The new one). I use Materialize for my styling. I implement my form like so:
<form onSubmit={this.handleSubmit} autoComplete='off' className="login-form">
<div className="input-field">
<input
placeholder='Type email here'
id="email"
type="email"
required
className="validate contact-input"
onChange={this.handleChange}/>
<label
className="active"
htmlFor="email">Email</label>
</div>
<div className="input-field">
<input
placeholder='Type password here'
id="password"
type="password"
required
className="validate contact-input"
onChange={this.handleChange}/>
<label
className="active"
htmlFor="password">Password</label>
</div>
<div className="input-field col s6">
<button className="btn z-depth-2 login-btn">
Sign In
</button>
</div>
</form>
Some solutions I have tried that do not work include:
<form autoComplete="off">
...
</form>
<form autoComplete="new-password">
...
</form>
<input autoComplete="off" />
<input autoComplete="new-password" />
<input autoComplete="none" />
Anyone know how to fix this?
Try this :
<input type="text" autocomplete="off" list="autocompleteOff"
id="fieldId" name="fieldname" placeholder="Placeholder here" />
Answer from here : Disable input text suggestions in Edge?

Reactjs post form data to external payment page URL

Hi anybody know how to post reactjs form data to external URL like this.
<form id="fc_checkout" action="https://checkout.freecharge.in/api/v1/co/oauth/wallet/add" method="POST">
<input type="hidden" name="callbackUrl" value='somevalue' />
<input type="hidden" name="merchantId" value='somevalue' />
<input type="hidden" name="checksum" value='somevalue' />
<input type="hidden" name="amount" value='somevalue' />
<input type="hidden" name="loginToken" value='somevalue' />
<input type="hidden" name="channel" value='somevalue' />
<input type="hidden" name="metadata" value='somevalue' />
</form>
Thanks in advance.

AngularJS redirect user to payment gateway after submitting form

I'm working on a angularjs project.
I'm in the process of integrating payment gateways. I'm stuck with the gateway submission.
Basically without angularjs, when a user clicks "Pay Now", the form submits the data to the gateway along with some hidden fields and takes the user directly to the payment gateway.
Whereas in angularjs, when the user clicks "Pay now", nothing happens.
I have the form in angularjs html file as follows.
<form action="payumbtn.action" method="post" name="payuForm" id="payuForm" style="display: block">
<input type="hidden" name="key" ng-model="payumbtn.merchant_key" />
<input type="hidden" name="hash" ng-model="payumbtn.hash"/>
<input type="hidden" name="txnid" ng-model="payumbtn.txnid" />
<input name="amount" type="hidden" ng-model="payumbtn.totalCost" />
<input type="hidden" name="firstname" id="firstname" ng-model="payumbtn.firstName" />
<input type="hidden" name="email" id="email" ng-model="payumbtn.email" />
<input type="hidden" name="phone" ng-model="payumbtn.mobile" />
<textarea name="productinfo" ng-hide="true">{{payumbtn.productinfo}}</textarea>
<input type="hidden" name="surl" ng-model="payumbtn.success_url" />
<input type="hidden" name="furl" ng-model="payumbtn.failure_url"/>
<input type="hidden" name="service_provider" value="payu_paisa"/>
<input type="hidden" name="lastname" id="lastname" ng-model="payumbtn.lastName" />
<input type="hidden" name="udf1" id="udf1" ng-model="payumbtn.udf1" />
<input type="hidden" name="udf2" id="udf2" ng-model="payumbtn.udf2" />
<input type="submit" value="Pay now"/>
</form>
Now the {{payumbtn.xxxx}} data is fetched from a previous post so don't bother it.
What I need
I need the form to submit the payment data to the gateway and redirect the user to the gateway.

Insert form data into database in cakephp

I want to insert my form data into database using cakephp. I created form.ctp file in layouts folder. Now how can I insert form values to database in form.ctp file?
Here is my code:
<html>
<form action="../users/register" method="post">
<p>Please fill out the form below to register an account.</p>
<label>Username:</label><input name="username" size="40" />
<label>Password:</label><input type="password" name="password" size="40"
/>
<label>Email Address:</label><input name="email" size="40"
maxlength="255" />
<label>First Name:</label><input name="first_name" size="40" />
<label>Last Name:</label><input name="last_name" size="40" />
<input type="submit" value="register" />
</form>
</html>
<html>
<form action="../users/register" method="post">
<p>Please fill out the form below to register an account.</p>
<label>Username:</label><input name="users[username]" size="40" />
<label>Password:</label><input type="users[password]" name="password" size="40" />
<label>Email Address:</label><input name="users[email]" size="40"
maxlength="255" />
<label>First Name:</label><input name="users[first_name]" size="40" />
<label>Last Name:</label><input name="users[last_name]" size="40" />
<input type="submit" value="register" />
</form>
</html>
and save by
if ($this->request->is('post')) {
$this->User->save($this->request->data);
}
OR
save your data without change form by
if ($this->request->is('post')) {
$this->request->data['User'] = $this->request->data;
$this->User->save($this->request->data);
}

Salesforce Web to Lead Form text area field not submitting

I have a salesforce web to lead form. Everything seems to be going through to salesforce except the comments textarea box. Any idea why just this field wouldn't work?
The code for the texarea field (there is an actual number in id and name)
  <form class="sf-form" id="contact-1"
action="https://www.salesforce.com/servlet/servlet.WebToLead?
encoding=UTF-8" method="POST">
<div class="sf-left">
<label class="sf-label">First Name</label><input class="sf-text"
id="first_name" type="text" maxlength="40" name="first_name"
size="20" />
<label class="sf-label" for="last_name">Last Name</label><input
class="sf-text" id="last_name" type="text" maxlength="80"
name="last_name" size="20" />
<label class="sf-label" for="email">Email</label><input class="sf-
text" id="email" type="text" maxlength="80" name="email" size="20"
/>
<label class="sf-label" for="phone">Phone</label><input
class="sf-text" id="phone" type="text" maxlength="40" name="phone"
size="20" />
<label class="sf-label" for="company">Company</label>
<input class="sf-text" id="company" type="text" maxlength="40"
name="company" size="20" />
</div>
<div class="sf-right">
Comments:<textarea name="000number here" id="same 000number here"
class="sf-textarea" rows="10" type="text" wrap="soft" ></textarea>
<br>
<input type="submit" name="submit" class="sf-submit">
</div>
<div class="clearfix"></div>
</form></div>
In debug mode I am getting the following for the textarea field
xxxxxxxx(some long number here): This is another test to get the debug code(long number here): Whatever I put in comments
I'm not sure if those long numbers have to do with their account, I'm not familiar with salesforce... are they debug codes?
Thanks!
Ahh. Well the client was showing the form to Salesforce (they wouldn't give me access) and I guess it is working now. That must've been the issue, because I haven't changed anything on my end. Thanks for your time! – Beth 2 mins ago

Resources