Redirect Integration
Connect your website or application to WEBXPAY hosted checkout.
Start integration →1. Introduction
WEBXPAY provides a hosted payment gateway supporting international cards and local payment methods, including eZ Cash, mCash, FriMi, UPay, Genie and DFCC Wallet.
1.1 Purpose
Integrate hosted checkout into a merchant website using the request and response formats below.
1.2 Scope
Payment workflow, technical parameters, encryption, gateway selection, callback validation and PHP examples.
2. Integration
Submit customer and order details using HTTP POST.
| Environment | Payment request URL |
|---|---|
| LIVE | https://webxpay.com/index.php?route=checkout/billing |
| STAGING | https://stagingxpay.info/index.php?route=checkout/billing |
2.1 Payment workflow
2.2 Request parameters
| Parameter | Description | Required | Limits |
|---|---|---|---|
| first_name | Customer first name | Yes | 30 |
| last_name | Customer last name | Yes | 30 |
| Customer email | Yes | Valid email | |
| contact_number | Customer telephone | Yes | 9–20; digits and + |
| address_line_one | Address line 1 | Yes | — |
| address_line_two | Address line 2 | No | — |
| city | City | No | — |
| state | State | No | — |
| postal_code | Postal code | No | — |
| country | Country | No | — |
| secret_key | Merchant integration key | Yes | — |
| payment | Encrypted order and amount | Yes | — |
| cms | Platform, e.g. PHP | Yes | — |
| process_currency | LKR, USD, GBP, AUD | Yes | — |
| custom_fields | Encoded custom values | No | — |
| payment_gateway_id | Selected gateway | No | — |
| multiple_payment_gateway_ids | Pipe-separated gateway IDs (see sample) | No | — |
The source parameter table spells custom_fields as custom_feilds; the official PHP sample uses custom_fields.
2.3 Response parameters
| Parameter | Description |
|---|---|
| payment | Encoded payment response |
| signature | Authenticity check for payment response |
| custom_fields | Merchant-defined values |
2.4.1 Response status codes
| Code | Status |
|---|---|
| 0 | Approved |
| 00 | Approved |
| 15 | Declined |
2.4.2 Error codes
| Code | Description |
|---|---|
| 401 | Invalid access |
| 402 | Product not identified |
| 403 | Invalid secret key |
| 405 | First name required |
| 406 | Last name required |
| 407 | Email required |
| 408 | Contact number required |
| 409 | Amount below 1 USD / LKR |
| 410 | LKR limit exceeded |
| 411 | USD limit exceeded |
| 412 | Unsupported currency |
| 413 | Gateways not found |
| 414 | Selected gateway not found |
| 415 | Invalid gateway ID |
| 416 | Bank response missing |
| 417 | Currency undefined |
| 418 | Return URL missing |
| 419 | IP address blocked |
| 420 | Email blocked |
| 421 | Merchant blocked |
| 423 | Payment processing error |
| 424 | Invalid request URL |
2.5 Transaction request
Build the payment value as unique_order_id|total_amount. Retrieve the public and secret keys from the merchant dashboard integration settings. Encrypt with the public key, then Base64 encode.
$plaintext = '12001|2567.50';
// $publicKey is your WEBXPAY public key.
if (!openssl_public_encrypt($plaintext, $encrypted, $publicKey)) {
throw new RuntimeException('Encryption failed');
}
$payment = base64_encode($encrypted);
$custom_fields = base64_encode('parameter1|parameter2|parameter3|parameter4');Send the required fields in a POST form to the selected endpoint. See the official request example below for the complete form and mechanism field.
2.5.1 Gateway IDs
Set payment_gateway_id to preselect a payment option. Use multiple_payment_gateway_ids to pass a pipe-separated list.
<input name="payment_gateway_id" value="40">
<input name="multiple_payment_gateway_ids" value="40|44|96">| ID | Gateway |
|---|---|
| 2 | eZ Cash LKR |
| 3 | mCash LKR |
| 4 | NTB AMEX LKR |
| 8 | NTB AMEX USD |
| 5 | Sampath Viswa LKR |
| 47 | HNB USD |
| 46 | HNB LKR |
| 16 | DFCC Wallet LKR |
| 35 | FriMi LKR |
| 36 | Seylan LKR |
| 37 | Seylan USD |
| 38 | Commercial Token LKR |
| 39 | Commercial Token USD |
| 40 | Commercial MPGS LKR |
| 41 | Commercial MPGS USD |
| 42 | Genie Visa Master LKR |
| 43 | Cargills Visa Master LKR |
| 44 | Cargills Token LKR |
| 45 | UPay LKR |
| 52 | Promotional Gateway |
| 96 | Lanka QR |
2.5.2 EMI gateway IDs
| ID | Bank | Tenor |
|---|---|---|
| 23 | NTB AMEX | 3 months (LKR) |
| 24 | NTB AMEX | 6 months (LKR) |
| 25 | NTB AMEX | 12 months (LKR) |
| 26 | NTB AMEX | 20 months (LKR) |
| 27 | NTB AMEX | 24 months (LKR) |
| 28 | NTB AMEX | 36 months (LKR) |
| 48 | HNB | 3 months (LKR) |
| 49 | HNB | 6 months (LKR) |
| 50 | HNB | 12 months (LKR) |
| 51 | HNB | 24 months (LKR) |
| 53 | DFCC | 3 months (LKR) |
| 54 | DFCC | 6 months (LKR) |
| 66 | DFCC | 7 months (LKR) |
| 67 | DFCC | 9 months (LKR) |
| 55 | DFCC | 12 months (LKR) |
| 68 | DFCC | 15 months (LKR) |
| 69 | DFCC | 18 months (LKR) |
| 56 | DFCC | 24 months (LKR) |
| 70 | DFCC | 27 months (LKR) |
| 71 | DFCC | 36 months (LKR) |
| 72 | DFCC | 41 months (LKR) |
| 61 | Commercial Bank | 3 months (LKR) |
| 57 | Commercial Bank | 6 months (LKR) |
| 62 | Commercial Bank | 9 months (LKR) |
| 58 | Commercial Bank | 12 months (LKR) |
| 59 | Commercial Bank | 18 months (LKR) |
| 60 | Commercial Bank | 24 months (LKR) |
| 63 | Commercial Bank | 36 months (LKR) |
| 64 | Commercial Bank | 48 months (LKR) |
| 65 | Commercial Bank | 60 months (LKR) |
| 75 | NDB | 6 months (LKR) |
| 76 | NDB | 9 months (LKR) |
| 77 | NDB | 12 months (LKR) |
| 78 | NDB | 18 months (LKR) |
| 79 | NDB | 24 months (LKR) |
| 80 | NDB | 36 months (LKR) |
| 81 | NDB | 60 months (LKR) |
| 90 | Seylan | 6 months (LKR) |
| 91 | Seylan | 12 months (LKR) |
| 92 | Seylan | 24 months (LKR) |
| 97 | Union Bank | 3 months (LKR) |
| 98 | Union Bank | 6 months (LKR) |
| 99 | Union Bank | 12 months (LKR) |
| 100 | Union Bank | 18 months (LKR) |
| 101 | Union Bank | 24 months (LKR) |
| 102 | Union Bank | 36 months (LKR) |
2.6 Transaction response
Configure the return URL under Dashboard → Settings → Website Integration. The callback posts payment, signature and custom_fields. Decode the payment and signature, decrypt the signature with the public key and compare before trusting the response.
$payment = base64_decode($_POST['payment'] ?? '', true);
$signature = base64_decode($_POST['signature'] ?? '', true);
if ($payment === false || $signature === false ||
!openssl_public_decrypt($signature, $verified, $publicKey) ||
!hash_equals($payment, $verified)) {
http_response_code(400);
exit('Invalid signature');
}
$responseVariables = explode('|', $payment);2.7 Custom fields
Decode the optional custom values and split using the pipe separator.
$custom = base64_decode($_POST['custom_fields'] ?? '', true);
$fields = $custom === false ? [] : explode('|', $custom);3. PHP sample code
Examples shown here are illustrative and have not been tested against the payment gateway. Use your own merchant keys.