Your users will want to integrate third party websites and other applications to your developed PayMents gateway. This is very possible and you can do it for:
a). Helping yourself integrate any of your websites and applications to your own developed Payment gateway so that you do not rely on paying huge fees to use other Payment gateways. You now have a gateway for your own use.
b). If you are helping people to process payments in your region, state or country, then they will want to integrate with your payment gateway to help them get paid on their websites using your Gateway and you get paid the fees for facilitating that.
In this article, I will demonstrate how the use of forms integrates with PayMents processor script.
I am going to dwell on how to integrate a PHP website with PayMents processor Gateway. However, you can do this in any other language.
Step 1: Let us create the HTML FORM.
<form action ="" method ="POST"> <input type ="text" name ="itemname" placeholder ="Enter the Item to buy"><br> <input type= "text" name ="amount" value ="40" readonly> <br> <input type ="submit" name ="_xclick" value ="Buy now"> </form>
The above form is a simple one that illustrates the Name of the Item that we want our buyers of website xyz.com to buy and the cost of the item in USD.
Now, we want to send this date to the PayMents processor.
How? Of course following the API. Therefore, let us go to the PayMent processor and look at the API page.
Well, simple? Login and access more info of the APi page.
What we learn is that the following stuff are needed by the API:
1. The method is POST. So let me edit the form. I already did it.
<form action ="" method ="POST">
So, let us edit our form:
<form action ="https://www.paymentprocessor-script.com/demos/downloads/Payments-New/api/webscr" method ="POST">
And we are essentially almost through. Why?
Because any data that we will submit via the Buy Now button will be send to the action url which actually in the PayMent processor server. Then the server will read our POST data and respond.
3. The POST DATA.
One question, which is the format of the data that the PayMents processor API is waiting from us?
Again, let us go back to the API and read.
|Name||What it is as per PayMents Gateway|
|itemName||Name of the Item being purchased.|
|_xclick||The type of button clicked is a Buy Now Button|
|businessEmail||The recipients Email|
|amt||Amount to be paid|
|notify_url||Url where PayMents will send notifications in the form of IPN|
|cancel_url||Url Where users will be send to if they decide to cancel the purchase along the way.|
|success_url||Url where users will be redirected to after a successful payment.|
I just got the data as above.
The PayMents processor API is waiting for the above data via the POST method. Note, not through any other method. But POST only.
In our form, which data do we have?
a). We have itemName
B). We also have the Amount.
c). And we have the submit button.
But we do not have quite more others.
First, let us frame the data we have to look like what PayMents wants it to be.
<input type ="text" name ="itemName" placeholder ="Enter the Item to buy"><br> <input type= "text" name ="amt" value ="40" readonly> <br> <input type ="submit" name ="_xclick" value ="Buy now">
Good. Right? Easy. True?
Let us now add the data that we do not have but is needed by PayMents processor to process the payment.
Now that we did not think about showing it to the client making the order/payment, we should just hide all that data. Think of type ="hidden" in an HTML form.
Be keen now.
You will need to change the above fields to reflect your own Business email (Where you need paid), notify, success and cancel urls as per your own Website or Application.
Recall, these are not the urls of the PayMent processor server location. NOP. They are the urls to the application or website which you are integrating with the PayMents processor. If you are the owner of the PayMent gateway,Think of yourself as the third-party in this case and you are linking to an existing PayMent gateway.
Now you are actually done. The POST will be sent to the PayMents server and buyers will be directed to the gateway for PayMents.
But wait, at this point, you or they will encounter and Authentication error.
Read about how to solve this in the next article.
Sample form to test PayMents Integration