DEVELOPERS
Developers / Integration guides / Redirect Integration
INTEGRATION GUIDE / V3.0

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.

EnvironmentPayment request URL
LIVEhttps://webxpay.com/index.php?route=checkout/billing
STAGINGhttps://stagingxpay.info/index.php?route=checkout/billing

2.1 Payment workflow

1Customer selects checkout
2Merchant redirects to WEBXPAY
3WEBXPAY processes payment with bank or wallet
4Bank returns payment response
5WEBXPAY redirects to merchant callback
6Merchant displays payment result

2.2 Request parameters

ParameterDescriptionRequiredLimits
first_nameCustomer first nameYes30
last_nameCustomer last nameYes30
emailCustomer emailYesValid email
contact_numberCustomer telephoneYes9–20; digits and +
address_line_oneAddress line 1Yes—
address_line_twoAddress line 2No—
cityCityNo—
stateStateNo—
postal_codePostal codeNo—
countryCountryNo—
secret_keyMerchant integration keyYes—
paymentEncrypted order and amountYes—
cmsPlatform, e.g. PHPYes—
process_currencyLKR, USD, GBP, AUDYes—
custom_fieldsEncoded custom valuesNo—
payment_gateway_idSelected gatewayNo—
multiple_payment_gateway_idsPipe-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

ParameterDescription
paymentEncoded payment response
signatureAuthenticity check for payment response
custom_fieldsMerchant-defined values

2.4.1 Response status codes

CodeStatus
0Approved
00Approved
15Declined

2.4.2 Error codes

CodeDescription
401Invalid access
402Product not identified
403Invalid secret key
405First name required
406Last name required
407Email required
408Contact number required
409Amount below 1 USD / LKR
410LKR limit exceeded
411USD limit exceeded
412Unsupported currency
413Gateways not found
414Selected gateway not found
415Invalid gateway ID
416Bank response missing
417Currency undefined
418Return URL missing
419IP address blocked
420Email blocked
421Merchant blocked
423Payment processing error
424Invalid 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">
IDGateway
2eZ Cash LKR
3mCash LKR
4NTB AMEX LKR
8NTB AMEX USD
5Sampath Viswa LKR
47HNB USD
46HNB LKR
16DFCC Wallet LKR
35FriMi LKR
36Seylan LKR
37Seylan USD
38Commercial Token LKR
39Commercial Token USD
40Commercial MPGS LKR
41Commercial MPGS USD
42Genie Visa Master LKR
43Cargills Visa Master LKR
44Cargills Token LKR
45UPay LKR
52Promotional Gateway
96Lanka QR

2.5.2 EMI gateway IDs

IDBankTenor
23NTB AMEX3 months (LKR)
24NTB AMEX6 months (LKR)
25NTB AMEX12 months (LKR)
26NTB AMEX20 months (LKR)
27NTB AMEX24 months (LKR)
28NTB AMEX36 months (LKR)
48HNB3 months (LKR)
49HNB6 months (LKR)
50HNB12 months (LKR)
51HNB24 months (LKR)
53DFCC3 months (LKR)
54DFCC6 months (LKR)
66DFCC7 months (LKR)
67DFCC9 months (LKR)
55DFCC12 months (LKR)
68DFCC15 months (LKR)
69DFCC18 months (LKR)
56DFCC24 months (LKR)
70DFCC27 months (LKR)
71DFCC36 months (LKR)
72DFCC41 months (LKR)
61Commercial Bank3 months (LKR)
57Commercial Bank6 months (LKR)
62Commercial Bank9 months (LKR)
58Commercial Bank12 months (LKR)
59Commercial Bank18 months (LKR)
60Commercial Bank24 months (LKR)
63Commercial Bank36 months (LKR)
64Commercial Bank48 months (LKR)
65Commercial Bank60 months (LKR)
75NDB6 months (LKR)
76NDB9 months (LKR)
77NDB12 months (LKR)
78NDB18 months (LKR)
79NDB24 months (LKR)
80NDB36 months (LKR)
81NDB60 months (LKR)
90Seylan6 months (LKR)
91Seylan12 months (LKR)
92Seylan24 months (LKR)
97Union Bank3 months (LKR)
98Union Bank6 months (LKR)
99Union Bank12 months (LKR)
100Union Bank18 months (LKR)
101Union Bank24 months (LKR)
102Union Bank36 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);
Response field order: the guide and downloadable response example disagree. The guide shows order ID, reference, date/time, status, comment, gateway; the sample comment places gateway before status and comment. Confirm the actual order with WEBXPAY before mapping fields.

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

Original integration guide ↗

Examples shown here are illustrative and have not been tested against the payment gateway. Use your own merchant keys.