A. Processing flow

B. API Configuration
Header will build according to Integration rules for the APIs below.
1. Create first payment request
| POST | /v2/payments/recurring/request |
Required parameters
| Attribute | Type | Required | Description |
| request_id |
string (max 35 characters) does not contain special characters |
Yes |
Unique Merchant Request Code. Contains only letters, numbers and underscores. |
| request_type |
string (max 35 characters) does not contain special characters |
Yes | CIT |
| currency | string | Yes | Currency : VND |
| amount | number | Yes |
Amount to be paid Min: 10.000 Max: 200.000.000 |
| method | string | Yes | CREDIT_CARD |
| description | string | Yes | Order information description |
| return_url | sting | Yes |
A partner URL. This URL is used to redirect from 9Pay to the partner's purchase page after the customer makes a payment. |
| lang | string | No | Language displayed on customer transaction screens (vi and en). Default is vi |
Example request:
|
{ |
Return results
| Attribute | Type | Required | Description |
| request_id | string | Yes | Same as original request code |
| order_code | number | Yes |
9Pay transaction code |
| payment_url | string | Yes |
URL to redirect customers to 9Pay's payment page |
| status | number | Yes | |
| error_code | number | Yes | |
| failure_reason | string | Yes | Error message corresponding to status = -1 |
| amount | number | Yes |
Same as original amount |
| currency | string | Yes | VND |
| submitted_at | datetime | Yes |
Same as original amount |
Sample returned results:
|
{ |
2. Processing transaction results
After the customer is redirected to the page 3ds_url to complete the authentication, the partner will receive the transaction results in the following 2 ways:
Return
Once the checkout flow is complete, the customer is redirected to return_url that the partner provided when generating the payment URL.
The partner uses this result to display a successful/failed transaction result message to the customer (Located in the query string when returning to the partner's link).
IPN- Instant Payment Notification
After the payment transaction is successful, 9Pay will send a POST request (x-www-form-data) to the address IPN_url of registered partners.
Return data
| Attribute | Type | Required | Description |
| result | string | Yes |
Transaction result information |
| checksum | string | Yes |
Checksum code generated using result and partner checksum key |
| version | string | Yes |
IPN version |
Value in result after decoding:
| Attribute | Type | Required | Description |
| order_code | number | Yes |
9Pay transaction code |
| request_id | string | Yes |
9Pay transaction code |
| amount | number | Yes |
Same as initial payment |
| description | string | Yes |
Order information description |
| request_type | string | Yes | CIT |
| method | string | Yes | CREDIT_CARD |
| currency | string | Yes | VND |
| created_at | datetime | Yes |
Example: 1335939007 (UTC+0, length=10) |
| status | number | Yes | |
| error_code | number | Yes | |
| failure_reason | string | Yes |
Reason for failed transaction |
| card_info | string | Yes |
Payment information data |
| card_info.card_name | string | Yes |
Cardholder name printed on card |
| card_info.card_brand | string | Yes |
Card brand name |
| card_info.card_number | string | Yes | Card number in the form 123456xxxxxx6789 |
| card_info.token | string | Yes |
Payment Token |
3. Create payment request with token
| POST | /v2/payments/recurring/request |
Required parameters
| Attribute | Type | Required | Description |
| request_id |
string (max 35 characters) does not contain special characters |
Yes |
Unique Merchant Request Code. Contains only letters, numbers and underscores. |
| request_type |
string (max 35 characters) does not contain special characters |
Yes | MIT |
| currency | string | Yes | Currency : VND |
| amount | number | Yes |
Amount to be paid Min: 10.000 Max: 200.000.000 |
| method | string | Yes | CREDIT_CARD |
| original_order_code | number | Yes |
Order_code of the CIT transaction |
| card_token | sting | Yes |
Payment Token |
Example request:
|
{ |
Return results
| Attribute | Type | Required | Description |
| request_id | string | Yes |
Same as original request code |
| order_code | number | Yes |
9Pay transaction code |
| original_order_code | number | Yes |
Same as original request |
| status | number | Yes | |
| error_code | number | Yes | |
| failure_reason | string | Yes |
Error message corresponding to status =-1 |
| amount | number | Yes |
Same as original amount |
| currency | string | Yes | VND |
| submitted_at | datetime | Yes |
Payment request creation time (UTC +0) |
| auth_code | string | Yes |
Authorization code |
Sample returned results:
|
{ |
4. See more