Reactjs post form data to external payment page URL - reactjs

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.

Related

PayFast Integration to React signature error

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>

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 with "notes"

I'm trying to use Web to Lead functionality of salesforce. I can create a lead, but the Notes field does not get the data I supplied in the form. Here's the form I'm sending:
<form action="https://www.salesforce.com/servlet/servlet.WebToLead?encoding=UTF-8" method="POST">
<input type=hidden name="oid" value="xxxxxxx">
<input type=hidden name="retURL" value="http://www.mycompany.com">
<label for="first_name">First Name</label><input id="first_name" maxlength="40" name="first_name" size="20" type="text" /><br>
<label for="last_name">Last Name</label><input id="last_name" maxlength="80" name="last_name" size="20" type="text" /><br>
<label for="email">Email</label><input id="email" maxlength="80" name="email" size="20" type="text" /><br>
<label for="company">Company</label><input id="company" maxlength="40" name="company" size="20" type="text" /><br>
Notes:<textarea id="00N6100000C5D5Z" name="00N6100000C5D5Z" type="text" wrap="soft"></textarea><br>
<label for="street">Street</label><textarea name="street"></textarea><br>
<input type="submit" name="submit">
</form>
Every field gets populated in the new lead entry, except Notes. Has anyone ran into this issue? How did you resolve it?
Thanks in advance!
I haven't got why you have specified type="text" with your textarea. Textarea itself is a type.
Can you replace
Notes:<textarea id="00N6100000C5D5Z" name="00N6100000C5D5Z" type="text" wrap="soft"></textarea><br>
With:
Notes:<textarea id="00N6100000C5D5Z" name="00N6100000C5D5Z" wrap="soft"></textarea><br>
Give it a try.

How to use put method to update a database from a form

I'm trying to update a database from a form without using any php, I'm using angularjs with MySql
If I use the following with the put method I can insert a user into the data base, I've
http://localhost:8080/CyberSolution/rest/user/register?u=tester&pw=fred&fname=Fred&lname=Smith&email=fred#localhost.com
I've made a basic html form
<form method="POST" action="">
Username: <input type="text" name="username" size="15" /><br />
Password: <input type="password" name="password" size="15" /><br />
email: <input type="text" name="email" size="15" /><br />
First name: <input type="text" name="first_name" size="15" /><br />
Last name: <input type="text" name="lirst_name" size="15" /><br />
<p><input type='submit' name='Submit' value='Submit' /></p>
</form>
I'm working with AJS for the first time and also REST for the first time, I'm unsure on how to link the form to the database to update. I'm unsure what needs to go in the controllers.js as well
Thanks
You could simply use the $http service.
First use ng-model to store fields value in an object :
<form ng-submit="send_form()" action="">
Username: <input type="text" name="username" size="15" ng-model="form.username" /><br />
Password: <input type="password" name="password" size="15" ng-model="form.password"/><br />
email: <input type="text" name="email" size="15" ng-model="form.email"/><br />
First name: <input type="text" name="first_name" size="15" ng-model="form.first_name"/><br />
Last name: <input type="text" name="lirst_name" size="15" ng-model="form.last_name"/><br />
<p><input type='submit' name='Submit' value='Submit' /></p>
</form>
And then use in your controller (or even better, through a service) :
function myController($scope, $http) {
$scope.send_form = function () {
$http.put('http://localhost:8080/CyberSolution/rest/user/register', $scope.form).success(successCallback);
}
}

Resources