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

ParameterRequiredDescription
publicKeytrueYour merchant public key, see how to get your API Keys
transactionIdtrueUnique transaction reference provided by you.
amounttrueAmount to debit.
currencyfalsecurrency to charge in. Defaults to NGN
countryfalseroute country. Defaults to NG
emailtrueEmail of the customer.
phoneNumberfalsephone number of the customer.
firstNamefalsefirstname of the customer.
lastNamefalselasttname of the customer.
callbackUrltrueURL to redirect to when transaction is completed.
logoURLfalseLink to the Logo image. Default to Xpresspay logo
hashtrueThis 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"}]
falseAny 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" >