NAV
shell java php

Introduction

Welcome to the HPay API! You can use our API to access HPay API endpoints. This API documentation page was created with HPay. Feel free to integrate with our payment gateway in your business base for API's documentation.

Version: 1.0.0

Authentication

To through an authorization, please consider to correct use secure_code and secureChain in your requests for each HPay service:

secure_code = MD5(<HPayKey>)

secureChain = sign(<HPayKey>) in SHA256withRSA 2048

Make sure to replace <HPayKey> with your API secure chain.

HPay uses the secure chain to allow access to the API. You can register a new HPay API key secret at Merchant Portal.

Checkout Payment

The document describe the API for the checkout payment service along with domestic ATM, IB, VA and Credit/Debit Cards services to merchants

The endpoint is combining all input parameters to perfom a GET request into the HPay system.

HTTP Request

Parameter Method Description
Sandbox GET https://checkout-sandbox.hpay.com.vn/v1/checkout.php
Production GET https://checkout.hpay.com.vn/v1/checkout.php

Request Parameters

Parameter Type Description
merchant_site_code* String HPay provide to merchant.
return_url* String The payment will redirect to return_url after payment success.
receiver* String Merchant email.
transaction_info String Transaction infomation.
order_code* String Order code of merchant.
price* Integer Price of order.
currency* String Currency of an order. such as vnd or usd.
order_description String Description of an order.
sub_order String If not empty, the the merchant order showing instead of order_code in checkout pages.
buyer_info String Buyer info, input string "name".
lang String Set default language is vi or en.
secure_code* String The secure chain. HPay provide secure_pass to merchant.
cancel_url String Link to redirect when cancel the payment.
notify_url String Link to callback IPN to merchant server.
time_limit String Time to pay (included of VA service). The format is dd/mm/yyyy,hh:ii.
installment* Integer If use installment set 1 else 0.
inpage Integer If use iframe set 1 else 0.
token String The tokenization value, required if token_type is 2
token_type String Pay to create ATM token set 1, Pay with existing ATM token set 2 else none.
payment_method_id Integer Required if inpage is 1. Look payment_method_id in table 1.
method_group String To specific grouped payment. Look method_group in table 2

Return_url and Notify_url (IPN)

The outcome payment will have two (2) ways of notification: return_url and notify_url via GET method.

Note: + Data of the return_url and the notify_url are same

Parameter Type Description
transaction_info* String HPay provide to merchant.
price* Integer Total amount.
payment_id* Integer Payment Id.
payment_type* Integer Payment type. 1 - Paynow and 2 - Paylater.
error_text* String Error contents.
secure_code* String Secure chain for verification.
token_omipay* String Token payment of HPay.
order_code* String The order code of the merchant product.
bank_code* String The bank code such as BIDV, VPB and VCB.
card_number* String The card account number.
tokenization* String The token value after tokenization payment completed.

Order Inquiry

curl --header "Content-Type: application/x-www-form-urlencoded" \
     --request POST \
     --data '{"merchant_id":"12345","order_code":"xyz", "checksum":"1424"}' \
     https://checkout-sandbox.hpay.com.vn/api/transaction

The above command returns JSON structured like this:

{
    "error_code": "00",
    "data": {
        "token": "12353",
        "transaction_status": "00",
        "receiver_email": "abc@gmail.com",
        "order_code": "xyz",
        "total_amount": "1000",
        "bank_code": "123",
        "order_description": "Thanhtoan",
        "tax_amount": 0,
        "discount_amount": 0,
        "fee_shipping": 0,
        "return_url": "https://abc.com/",
        "cancel_url": "https://abc.com/",
        "buyer_fullname": "Nguyen Van A",
        "buyer_email": "abc@gmail.com",
        "buyer_mobile": "0123456789",
        "buyer_address": "HN",
        "affiliate_code": "0",
        "transaction_id": "1234"
    },
    "checksum": "123"
}

This endpoint retrieves a order_code in the payment transaction.

HTTP Request

Parameter Method Description
Sandbox POST https://checkout-sandbox.hpay.com.vn/api/transaction/GetTransactionDetail
Production POST https://checkout.hpay.com.vn/api/transaction/GetTransactionDetail

Request Parameters

Parameter Type Description
merchant_id* String HPay provide to merchant.
order_code String Order code of the product.
transaction_id int Id of transaction.
checksum* String Secure chain to verification.

::: Please note - Pass in either fields order_code or transaction_id, or both order_code and transaction_id :::

Response Parameters

Parameter Type Description
token String Token of payment in HPay system.
transaction_status String Transaction status.
receiver_email String Merchant email.
order_code String Order code of the merchant product.
total_amount String Total amount.
bank_code String Code of a bank.
order_description String Order description.
tax_amount Integer Amount of tax in an order.
discount_amount Integer Discounted amount in an order.
fee_shipping Integer Shipping fee in an order.
return_url String Redirect url after completed transaction successful.
cancel_url String Redirect url after failed/ cancel transaction.
buyer_fullname String Name of buyer.
buyer_email String Email of buyer.
buyer_mobile String Mobile of buyer.
buyer_address String Address of buyer.
affiliate_code String Affiliate code for an order.
transaction_id String Id of transaction.

Checkout Sample Codes

Language Git link
PHP https://github.com/htpgroup/omipay_php_lib
Python https://github.com/htpgroup/omipay_python_lib

Table 1

Id Method BankName Description
3380 ATM IndovinaBank supported
3382 ATM BaoVietbank supported
3383 ATM UOBBank supported
3385 ATM WoorilBank supported
2181 ATM Lien doanh Viet - Nga supported
1282 ATM BIDV supported
2860 ATM Public Bank Viet Nam supported
2861 ATM Kiên Long Bank supported
644924 ATM VCCB supported
683774 ATM PVCB supported
1003 ATM Vietcombank supported
1006 ATM Techcombank supported
1009 ATM MB supported
1012 ATM VIB supported
1015 ATM Vietinbank supported
1018 ATM Eximbank supported
1021 ATM ACB supported
1024 ATM HDBank supported
1027 ATM MaritimeBank supported
1030 ATM Navibank supported
1033 ATM Viet A supported
1036 ATM VPBank supported
1039 ATM Sacombank supported
1042 ATM GPBank supported
1045 ATM Agribank supported
1048 ATM Oceanbank supported
1051 ATM PGBank supported
1054 ATM SHB supported
1057 ATM Seabank supported
1060 ATM Tiên Phong supported
1063 ATM Bac A supported
1067 ATM Phương Đông supported
1069 ATM Dai A supported
1072 ATM An Binh supported
1075 ATM SaiGonBank supported
1078 ATM Nam A supported
2620 ATM LienVietPostBank supported
2260 ATM SCB supported
633269 ATM CFC supported
637154 ATM VietBank supported
2401 InternetBanking ACB unsupported
2402 InternetBanking Eximbank unsupported
2403 InternetBanking Vietinbank unsupported
1281 InternetBanking VIB supported
2549 InternetBanking Agribank unsupported
2550 InternetBanking MaritimeBank unsupported
2551 InternetBanking Sacombank unsupported
2600 InternetBanking TPB unsupported
2601 InternetBanking VPB unsupported
3203 InternetBanking ABB unsupported
629384 InternetBanking CFC unsupported
641039 InternetBanking VietBank unsupported
668234 InternetBanking PGBank unsupported
672119 InternetBanking OCB unsupported
679889 InternetBanking PVCB supported
734279 InternetBanking VietABank unsupported
652694 InternetBanking SHNB supported
660464 InternetBanking IVB unsupported
691544 InternetBanking PBVN unsupported
710969 InternetBanking LienVietPostBank unsupported
718739 InternetBanking SHB unsupported
738164 InternetBanking NaviBank unsupported
742049 InternetBanking HDBANK unsupported
656579 InternetBanking WoorilBank unsupported
707084 InternetBanking SCB unsupported
648809 InternetBanking VCCB supported
714854 InternetBanking BaoVietBank unsupported
726509 InternetBanking OCEANBANK unsupported
730394 InternetBanking GPBANK unsupported
676004 InternetBanking SaiGonBank unsupported
687659 InternetBanking NamABank unsupported
699314 InternetBanking SEA unsupported
703199 InternetBanking KienLongBank unsupported
722624 InternetBanking BacABank unsupported
1081 InternetBanking Vietcombank unsupported
1084 InternetBanking Dong A unsupported
1087 InternetBanking Techcombank unsupported
1090 InternetBanking BIDV supported
664349 InternetBanking UOB unsupported
695429 InternetBanking VRB unsupported
745934 InternetBanking MBBANK supported
396284 Virtual Account unsupported
1095 Visa supported
1098 MasterCard supported
1101 JCB supported

Table 2

No. Method Description Vietnamese content
1 WALLET unsupported Thanh toán bằng Ví
2 BANK_ONLINE supported Thanh toán cổng nội địa
3 VA supported Thanh toán bằng Virtual Account
4 CREDIT_CARD supported Thanh toán cổng quốc tế

Advanced Checkout Payment

The document describe the API for the installment payment service via Credit Cards to merchants

The endpoint is combining all input parameters of Checkout Payment to perfom a GET request into the HPay system.

HTTP Request

Parameter Method Description
Sandbox GET https://checkout-sandbox.hpay.com.vn/checkout.php
Production GET https://checkout.hpay.com.vn/checkout.php

Extra Request Parameters

Parameter Type Description
installment* Integer If use installment set 1 else 0.

::: Please note - installment: Use to integrate with trả góp function of the payment :::

The document describe the API for the iframe payment service along with domestic ATM, IB, VA and Credit/Debit Cards services to merchants.

The endpoint is combining all input parameters of Checkout Payment to perfom a GET request into the HPay system.

HTTP Request

Parameter Method Description
Sandbox GET https://checkout-sandbox.hpay.com.vn/checkout.php
Production GET https://checkout.hpay.com.vn/checkout.php

Extra Request Parameters

Parameter Type Description
inpage Integer If use iframe set 1 else 0.

::: Please note - inpage: Use to render iframe in the browser for the payment :::

The document describe the API for the tokenization payment service along with domestic ATM service to merchants.

The endpoint is combining all input parameters of Checkout Payment to perfom a GET request into the HPay system.

HTTP Request

Parameter Method Description
Sandbox GET https://checkout-sandbox.hpay.com.vn/checkout.php
Production GET https://checkout.hpay.com.vn/checkout.php

Extra Request Parameters

Parameter Type Description
token String The tokenization value, required if token_type is 2
token_type String Pay to create ATM token set 1, Pay with existing ATM token set 2 else none.

Revoke ATM tokenization

The document describe the API for the tokenization revoke service along with domestic ATM service to merchants.

HTTP Request

https://checkout.hpay.com.vn/revoke_token.php?merchant_site_code=123&receive_email="example@gmail.com"&bank_code="ABB"&bank_token="9704005990670018"&return_url="yourwebsite.com/callback"&secure_code="3ab87d52bee1bcde4150c5aa353644f9"&notify_url="yourwebsite.com/callback"
Parameter Method Description
Sandbox GET https://checkout-sandbox.hpay.com.vn/revoke_token.php
Production GET https://checkout.hpay.com.vn/revoke_token.php

Request Parameters

Parameter Type Description
merchant_id* String HPay provide to merchant.
receive_email* String Merchant email.
bank_code* String The bank code in return_url/ callback IPN of checkout payment with ATM
bank_token* String The bank token in return_url/ callback IPN of checkout payment with ATM
return_url* String The return link after complete request
secure_code* String Secure code to protect request
notify_url String Callback IPN after revoke complete

Revoke Callback IPN Request

https://yourwebsite.com/callback_revoke_token?merchant_id=123&receive ="example@gmail.com"&bank_code="ABB"&bank_token="9704005990670018’"&secure_code="3ab87d52bee1bcde4150c5aa353644f9"&error_text=$errText&status=00&revoke_token_status=true
Parameter Type Description
merchant_id String HPay provided to merchant.
receiver String Merchant email.
bank_token String The bank token in return_url/ callback IPN of checkout payment with ATM
secure_code String Secure code to protect request
error_text String The error msg. use urldecode() to decode msg
status String If 00 is success and remain is failed
revoke_token_status String true is removed and false is failed

Error_Code

The HPay API uses the following error codes:

Checkout Service Code

Error Code Meaning
00 Success.
01 Invalid HTTP method
99 Undefine error. The internal error.
02 Your IP belong to blacklist.
03 Wrong parameters.
04 Invalid API function/ not existing.
05 Wrong API version.
06 Invalid or not existing the merchant ID.
07 Wrong password.
08 Not existing merchant account.
09 Account has blocked.
10 Invalid invoice.
11 Invalid amount.
12 Invalid currency.
29 Token not existed.
80 Not generate an order.
81 Unpaid order status.
82 Order status is paying.
83 Order status is failed.
110 wrong receiver email.
111 Locked receiver account.
113 Not configured fee for receiver account.
114 The payment is processing.
115 The payment canceled.
118 Invalid tax_amount.
119 Invalid discount_amount.
120 Invalid fee_shipping.
121 Invalid return_url.
122 Invalid cancel_url.
123 Invalid items.
124 Invalid transaction_info.
125 Invalid quantity.
126 Invalid order_description.
127 Invalid affiliate_code.
128 Invalid time_limit.
129 Invalid buyer_fullname.
130 Invalid buyer_email.
131 Invalid buyer_mobile.
132 Invalid buyer_address.
133 Invalid total_item.
134 Invalid payment_method, bank_code.
135 Failed connection to banks.
140 Order unsupport installment service.
30010 Merchant ID is empty.
30011 Order code or Transaction ID is required.
30012 Secure code is empty.
30013 Merchant does not exist or has not been activated.
30014 Secure code is invalid.
30015 The order does not exist or the order exceeds 7 days.

Virtual Account Service Code

Error Code Status Meaning
00 Success HTTP request is success.
01 Failed Invalid method. Method request is wrong.
03 Failed Miss parameters. Wrong input or incorrect secure_code.
06 Failed Not exited. The merchant not existing or invalid.
07 Failed Invalid or not existing the va_account.
08 Failed The va_account has expired or inactive.
99 Failed Undefine. The internal error.
040 Error Wrong parameter flag(0/1)
041 Error VA account status does not allow on/off (1 --> allow off, 3 --> allow on)
043 Error Not allowing unlocking in case of VA account 1 time and previously paid
044 Error The account is inactive or locked
045 Error Invalid accountVaName
046 Error The remark content does not include special characters.
047 Error The remark content includes a maximum of 50 letters.
048 Error Invalid remark content.
049 Error Invalid time_limit (maximum time limit 7 days).

FirmBanking Service Code

Error Code Meaning
000 Success.
01 Invalid HTTP method.
4 Amount less than minimum allowed.
20010 Merchant ID is empty.
20011 Bank code is empty.
20012 Account bank number code is empty.
20013 Secure code is empty.
20014 Merchant does not exist or has not been activated.
20015 Secure code is invali.
20016 The account is inactive or locked.
20017 Invalid note content.
217301 Transaction failed. Cashout request does not exist.
008 There is an issues of IPs, missing parameters or merchant's balance in HPay system.
99 Undefine bank error. Please contact with HPay to perform a reconciliation.
999 Undefine internal error. Please contact with HPay to perform a reconciliation.
050 The transaction is processing. Please contact with HPay to perform a reconciliation.
064 The transaction is waiting. Please contact with HPay to perform a reconciliation.
100 The transaction is waiting. Please contact with HPay to perform a reconciliation.
001 Verify signature of secureChain be failed
010 Not match secureChain
014 Not allow to payment
035 Not enough to payment
036 Not active payment account
043 Null data.
058 The refund transaction cannot perform due to not existing root tran_id.
062 Cannot inquiry the account
063 The transaction cannot perform. Please try again later.
066 Unavailable account.
096 The transaction cannot perform. Please try again later.
104 The transaction cannot perform. Please try again later.
115 The receive card/ account invalid. please re-put again.
116 Cannot look up the bank name
117 Incorrect Bank Account Name. Please try again with correct with the bank account name.
118 The receive card/ account doesn't have account name
119 The receive card/ account invalid. Due to transer account is Saving/ Foreign exchange
120 The receive card/ account invalid.
122 The bank don't allow to transfer to account number.
123 The bank don't allow to transfer to card number.
124 The account/ card have invalid characters.
125 The receive card/ account invalid. Please try again later.
126 Customer don't have transaction inquiries
127 Incorrect receiver customer.
128 The card/ account invalid.
129 The transaction has peformed before.
... Updating from HPay's partner

API Supported Versions

The HPay API have new change in the API of version 1.0.0:

New Changes in version 1.0.0

Service Name Service Type Changes and/ or update
Virtual Account Callback IPN Update transactionId field.