Form Post Method
This pages shows how to implement Xpresspay's Form Post
Xpresspay form post allows you load xpresspay on a different page, this can be useful for people that to load xpresspay on a different page. This method returns a response inside the callback, and you can pick your transactionId
and send to your server to perform a verification before giving value for the transaction.
Sample
<form action="https://xpresspayonlinesandbox.xpresspayments.com:8000/payments/form" type="hidden" method="post" >
<input type="hidden" name="amount" value="65.00">
<input type="hidden" name="callbackUrl" value="https://www.sample.xpresspayments.com/resp">
<input type="hidden" name="currency" value="NGN">
<input type="hidden" name="email" value="[email protected]">
<input type="hidden" name="hash" value="9aa65fcff8c5e3098d5a48359265c0bb670baa096bf2748b5e66ceeabe6bdfdd">
<input type="hidden" name="publicKey" value="XPPUBK-e634oasuuuad5b63a0a06d2f-X">
<input type="hidden" name="logoURL" value="https://api.elasticemail.com/userfile/5d028e25-bd86-4559-b7c2-31e5870bbbf9/accessnew.jpg">
<input type="hidden" name="country" value="NG">
<input type="hidden" name="phoneNumber" value="08075156982">
<input type="hidden" name="firstName" value="Aminu">
<input type="hidden" name="lastName" value="Kabunu">
<input type="hidden" name="meta" value="[{'metaName': 'DSTV NUMBER','metaValue':'075632148963'}]">
<input type="submit" id="payment_form" value="pay">
</form>
When the form is submitted xpresspay is loaded on another page, users then enters their card details, xpresspay would do the following:
- validate the card
- Debit it
- And redirect back to the callback url.
The paymentResponseCode
has two important common response codes 000
and 08
the former means the transaction came back with a successful response, the latter means the transaction is pending validation. If after performing verification on your server and you get a paymentResponseCode
that isn't 000
that means the transaction was not successful.
Parameter
Parameter | Required | Description |
---|---|---|
publicKey | true | Your merchant public key, see how to get your API Keys |
transactionId | true | Unique transaction reference provided by you. |
amount | true | Amount to debit. |
currency | false | currency to charge in. Defaults to NGN |
country | false | route country. Defaults to NG |
true | Email of the customer. | |
phoneNumber | false | phone number of the customer. |
firstName | false | firstname of the customer. |
lastName | false | lasttname of the customer. |
callbackUrl | true | URL to redirect to when transaction is completed. |
logoURL | false | Link to the Logo image. Default to Xpresspay logo |
hash | true | This is a sha256 hash of your xpressPayonlineSetup values, it is used for passing secured values to the payment gateway. Check Securing your Payments |
meta: [{"metaName": "DSTV NUMBER", "metaValue":"075632148963"}] | false | Any other custom data you wish to pass. |
Completing a successful Xpresspay test
Xpresspay uses two environments one for test and one for live. On test environment the keys and script url are different from the keys and script url on live. To get your test keys sign up check API Keys and retrieve your Test API key. When you use keys from the live environment with script url's from the test environment you get an Invalid public key
error.
Replace the action in the form tag when pointing live to https://xpresspayonline.com:8000/payments/form
Replace when pointing to live from
<form action="https://xpresspayonlinesandbox.xpresspayments.com:8000/payments/form" method="post" >
to
<form action="https://xpresspayonline.com:8000/payments/form" method="post" >
Updated over 4 years ago
Congrats! You now have our inline on your site to accept payment securely from your customers, to see how to check the status of your payment click on the button below.