X-API-KEY
carries your public key, and we use this public key to verify that the message is signed by your private key.X-RESP-SIGNATURE
in the request header. You can use it. The system publicKey verification message is sent by us.HTTP_METHOD + | + HTTP_REQUEST_PATH + | + TIMESTAMP + | + PARAMS
Method | URL | Nonce |
---|---|---|
POST | https://payment.tarspay.com/api/v1/test | 1537498830736 |
Parameter | value |
---|---|
amount | 100 |
price | 100 |
Tip: content does not require URLEncode
The Tarspay signature verification public key can be obtained from the "Web Management Interface - Account Management - apikey" page
Return results
Name | Type | Description |
---|---|---|
code | integer | Response code 0 indicates success, otherwise failure |
data | object | response data |
msg | string | Response message |
Return to example
{
"code": 0,
"data": {},
"msg": "SUCCESS"
}
Encoding | Description |
---|---|
internetbank | Online banking |
ewallet | Electronic wallet |
qr | Scan code |
scratch card | recharge card |
Bank code | Bank name |
---|---|
VCB | VIETCOMBANK |
ACB | ACB |
MBB | MBBANK |
VTB | VIETINBANK |
TPB | TPBANK |
SEA | SEABANK |
BIDV | BIDV |
MSB | MSB |
KLB | KIENLONGBANK |
TCB | TECHCOMBANK (not yet open) |
VIB | VIB (not yet open) |
SHB | SHB (not open yet) |
DAB | DONGABANK (not available yet) |
EXB | EXIMBANK (not available yet) |
SAC | SACOMBANK (not yet open) |
SCB | SAIGONBANK (not yet open) |
E-wallet code | E-wallet name |
---|---|
MOMO | MOMO |
VIETTELPAY | VIETTELPAY |
Scan code | Scan code name |
---|---|
QR | QR |
Recharge card code | Recharge card name |
---|---|
VIETTEL | Viettel |
MOBIFONE | Mobifone |
VINAPHONE | Vinaphone |
VIETNAMOBILE | Vietnamobile |
ZING | Zing |
GATE | Gate |
VCOIN | Vcoin |
GARENA | Garena |
Body request parameters
{
"amount": "100000",
"currency": "VND",
"customerName": "xxxx",
"mchNo": "80002",
"mchOrderNo": "M202207131958",
"notifyUrl": "https://www.yourcompany.com/notify",
"wayCode": "MOMO"
}
Name | Location | Type | Required | Description |
---|---|---|---|---|
X-API-KEY | header | string | Y | public key |
X-API-NONCE | header | string | Y | request time (timestamp, accurate to milliseconds) |
X-API-SIGNATURE | header | string | Y | signature (refer to signature algorithm) |
mchNo | body | string | Y | merchant number |
mchOrderNo | body | string | Y | merchant order number (customized by merchant, cannot be repeated) |
wayCode | body | string | Y | payment method code - Cashier: CASHIER (use the cashier of this system) - Non-cashier: refer to [Payment method code] (#Payment method code) (The merchant maintains the checkout counter himself) |
amount | body | string | Y | the amount (no decimals. It cannot be zero and must meet the amount standard.) If the payment method is a recharge card, the amount is fixed. The supported face values are: 10000, 20000, 30000, 50000, 100000,200000,300000,500000,1000000 |
currency | body | string | Y | currency(VND) |
notifyUrl | body | string | Y | notification address |
customerName | body | string | Y | username |
serial | body | string | N | recharge card number, required if the payment method is recharge card |
pin | body | string | N | recharge card password, required if the payment method is recharge card |
Return to example
{
"code": 0,
"data": {
"accountName": "PHAM QUOC THUAN",
"amount": "100000",
"countryCode": "vn",
"currency": "VND",
"customerContact": "0877060492",
"expiredTime": 1684291353,
"mchOrderNo": "D1684290850029",
"orderState": 1,
"payData": "https://example.com/payment/momo-qrcode?data=2|99|0934194751|PHAM QUOC THUAN|0|0|0|100000",
"payDataType": "payurl",
"payOrderId": "P1658662170384941058",
"payUrl": "https://payment.tarspay.com/#/order/vn/P1658662170384941058",
"payWays": {
"ewallet": [{
"countryCode": "vn",
"createdAt": 0,
"id": 66,
"payCode": "https://example.com/payment/momo-qrcode?data=2|99|0934194751|PHAM QUOC THUAN|0|0|0|100000",
"payWay": "MOMO",
"payWayLogo": "https://example.oss-ap-southeast-1.aliyuncs.com/tarspay_v_1.0/banklogo/momo.png",
"payWayType": "ewallet",
"skipMode": 1,
"state": 1,
"updatedAt": 0
}]
},
"phone": "0934194751"
},
"msg": "SUCCESS",
"sign": "304502206389dfcaa0037ee85d3687c7bd485fc0cb623095194c8f8570b7b71ba4dc52be0221009816d65b3b019f32334f1ca97247a68c123031856931 58ae1e34ef7eee4ea994"
}
"
Name | Type | Description |
---|---|---|
amount | string | bill amount |
countryCode | string | country code |
currency | string | currency number |
customerContact | string | user contact information |
mchOrderNo | string | merchant order number |
orderState | integer | order status 0: order generated, 1: payment in progress, 2: payment successful, 3: payment failed, 6: timeout cancellation, 9: partial payment |
payOrderId | string | payment order number |
accountName | string | user name, non-cashier mode, only returned when the payment method is online banking, e-wallet and scan code |
typeBank | string | bank name, non-cashier mode, only returned when the payment method is online banking and scanning QR code |
accountNumber | string | user name, non-cashier mode, only returned when the payment method is online banking, scan code and electronic wallet |
payUrl | string | -when in cashier mode, return the cashier address; -when in non-cashier mode, return the transfer required content |
payData | string | QR code (returned only when not at the cashier, only returned when the payment method is scan code and electronic wallet) |
payWays | array | payment methods |
Name | Type | Description |
---|---|---|
countryCode | string | country code |
payWay | string | payment method code (refer to [Payment method code](#Payment method code)) |
payWayLogo | string | payment method logo |
payWayType | string | payment method type (refer to [Collection Type](#Collection Type)) |
payCode | string | QR code/QR code image (returned only when not at the cashier). When the payment type is qr, the QR code image link is returned. When the payment type is ewallet, the QR code data is returned. ) |
Bank & e-wallet code | Bank & e-wallet name |
---|---|
MOMO | MOMO |
VCB | VIETCOMBANK |
VTB | VIETINBANK |
TCB | TECHCOMBANK |
BIDV | BIDV |
SHB | SHB |
DAB | DONGABANK |
ACB | ACB |
TPB | TPBANK |
EXB | EXIMBANK |
SAC | SACOMBANK |
SCB | SCB |
MBB | MBBANK |
VIB | VIB |
AGB | AGRIBANK |
HDB | HDB |
VPB | VPBANK |
OEB | OCEANBANK |
MSB | MSB |
LPB | LPB |
ABB | ABBANK |
NCB | NCB |
SEAB | SEABANK |
PCV | PVCOMBANK |
KLB | KIENLONGBANK |
VCTB | VIETCAPITAL BANK |
OCB | OCB |
VEB | VIETBANK |
VRB | VRB |
NMB | NAMABANK |
SHV | SHBVN |
Body request parameters
{
"amount": "50000",
"customerAccountNumber": "922010002523675",
"customerContact": "15221113201",
"customerName": "xxxx",
"mchNo": "80001",
"mchOrderNo": "2022071201011",
"notifyUrl": "http://www.yourcompany.com/notify",
"wayCode": "MOMO"
}
Name | Location | Type | Required | Description |
---|---|---|---|---|
X-API-KEY | header | string | Y | public key |
X-API-NONCE | header | string | Y | request time (timestamp, accurate to milliseconds) |
X-API-SIGNATURE | header | string | Y | signature (refer to signature algorithm) |
mchNo | body | string | Y | merchant number |
mchOrderNo | body | string | Y | merchant order number (customized by merchant, cannot be repeated) |
wayCode | body | string | Y | payment code (refer to [payment code](#payment code)) |
amount | body | string | Y | amount (no decimals. It cannot be zero and must meet the amount standard.) |
currency | body | string | Y | currency(VND) |
notifyUrl | body | string | Y | notification address |
customerName | body | string | Y | username |
customerContact | body | string | N | mobile phone number, when filling in MOMO as wayCode, it cannot be empty |
customerAccountNumber | body | string | N | user bank card, when wayCode is not MOMO, it cannot be empty |
{
"code": 0,
"data": {
"mchOrderNo": "M1655535407",
"payOrderId": "P1551409540398772225"
},
"msg": "SUCCESS",
"sign": "3045022100c3998421fd646521777d0c736753704931f801331dec55f109258dd8a93083c402207c11e37d70477b30ad9e0c42072a3fb5af1a78809ca7f 8023672451e62e8f69f"
}
Name | Type | Description |
---|---|---|
mchOrderNo | string | merchant order number (returned after successful request) |
payOrderId | string | platform order number (returned after successful request) |
Body request parameters
{
"accountNumber": "08491312411",
"mchNo": "M1683871735",
"userName": "CHU KHANH",
"wayCode": "MBB"
}
Name | Location | Type | Required | Description |
---|---|---|---|---|
X-API-KEY | header | string | Y | Public key |
X-API-NONCE | header | string | Y | Request time (timestamp, accurate to milliseconds) |
X-API-SIGNATURE | header | string | Y | Signature (refer to signature algorithm) |
mchNo | body | string | Y | merchant number |
accountNumber | body | string | Y | user bank card number/momo account number |
wayCode | body | string | Y | payment code (refer to [payment code](#payment code)) |
userName | body | string | Y | username |
{
"code": 0,
"data": {
"actualUserName": "CHU KHANH DUY",
"result": false
},
"msg": "SUCCESS"
}
Name | Type | Description |
---|---|---|
result | boolean | Return result: true, verification is correct, false: verification failed |
actualUserName | string | The user's actual name (returned after result returns false) |
Body request parameters
{
"mchNo": "M1655535407",
"mchOrderNo": "lin1231241241414"
}
Name | Location | Type | Required | Description |
---|---|---|---|---|
X-API-KEY | header | string | Y | public key |
X-API-NONCE | header | string | Y | request time (timestamp, accurate to milliseconds) |
X-API-SIGNATURE | header | string | Y | signature (refer to signature algorithm) |
mchNo | body | string | Y | merchant number |
payOrderId | body | string | N | platform order number (choose one of platform order number and merchant order number) |
mchOrderNo | body | string | N | merchant order number (choose one of platform order number and merchant order number) |
Return to example
{
"code": 0,
"data": {
"currency": "VND",
"fee": "0",
"mchNo": "M1655535407",
"mchOrderNo": "",
"orderAmount": "10000",
"payAmount": "10000",
"payOrderId": "P1547429458697129178",
"state": 2
},
"msg": "SUCCESS"
}
Name | Type | Description |
---|---|---|
payOrderId | string | payment order number |
mchNo | string | merchant number |
mchOrderNo | string | merchant order number |
orderAmount | string | original transaction amount of bill |
payAmount | string | payment amount |
currency | string | three-digit currency code |
state | string | payment status: 0-Order generated, 1-Payment in progress, 2-Payment successful, 3-Payment failed, 4-Cancelled, 5-Refunded, 6-Order closed, 7-Queue, 8 -We reject, 9-Partial payment |
fee | string | merchant fee |
Body request parameters
{
"mchNo": "M1655535407",
"mchOrderNo": "lin1231241241414"
}
Name | Location | Type | Required | Description |
---|---|---|---|---|
X-API-KEY | header | string | Y | public key |
X-API-NONCE | header | string | Y | request time (timestamp, accurate to milliseconds) |
X-API-SIGNATURE | header | string | Y | signature (refer to signature algorithm) |
mchNo | body | string | Y | merchant number |
payOrderId | body | string | N | platform order number (choose one of platform order number and merchant order number) |
mchOrderNo | body | string | N | merchant order number (choose one of platform order number and merchant order number) |
Return to example
{
"code": 0,
"data": {
"currency": "VND",
"fee": "0",
"mchNo": "M1655535407",
"mchOrderNo": "",
"orderAmount": "10000",
"payAmount": "10000",
"payOrderId": "P1547429458697138178",
"state": 2
},
"msg": "SUCCESS"
}
Name | Type | Description |
---|---|---|
payOrderId | string | payment order number |
mchNo | string | merchant number |
mchOrderNo | string | merchant order number |
orderAmount | string | original transaction amount of bill |
payAmount | string | payment amount |
currency | string | three-digit currency code |
state | string | payment status: 0-order generated, 1-payment in progress, 2-payment successful, 3-payment failed, 8-rejected |
fee | string | merchant fee |
Body request parameters
{
"mchNo": "M1658240182",
"bizType": 1,
"startTime": 1656604800,
"endTime": 1667145600,
"pageNumber": 1,
"pageSize": 20
}
Name | Location | Type | Required | Description |
---|---|---|---|---|
X-API-KEY | header | string | Y | public key |
X-API-NONCE | header | string | Y | request time (timestamp, accurate to milliseconds) |
X-API-SIGNATURE | header | string | Y | signature (refer to signature algorithm) |
mchNo | body | string | Y | merchant number |
bizType | body | number | N | business type: 1-Collection on behalf of others 2-Payment on behalf of others 3-USDT withdrawal 4-Withdrawal |
startTime | body | number | N | start time (server 0 time zone timestamp, accurate to seconds) |
endTime | body | number | N | end time (server 0 time zone timestamp, accurate to seconds) |
pageNumber | body | number | Y | page number |
pageSize | body | number | Y | page size (max 50) |
Return to example
{
"code": 0,
"data": {
"current": 1,
"hitCount": false,
"optimizeCountSql": true,
"orders": [],
"pages": 22,
"records": [{
"amount": "190000",
"bankCard": "123456789",
"bankName": "",
"bizType": 1,
"createdAt": 1683945480,
"currency": "VND",
"mchFeeAmount": "10000",
"mchName": "DW-Vietnam Test",
"mchNo": "M1683793693",
"mchOrderNo": "VN95220230300258",
"mobilePhone": "17760797979",
"orderAmount": "200000",
"payOrderId": "P1657213573143552002",
"payWay": "QR",
"payWayType": "qr",
"payerName": "DW",
"state": 2,
"successTime": 1683945670
}, {
"amount": "190000",
"bankCard": "123456789",
"bankName": "",
"bizType": 1,
"createdAt": 1683948198,
"currency": "VND",
"mchFeeAmount": "10000",
"mchName": "DW-Vietnam Test",
"mchNo": "M1683793693",
"mchOrderNo": "VN48220230300454",
"mobilePhone": "17760797979",
"orderAmount": "200000",
"payOrderId": "P1657224974603972609",
"payWay": "MOMO",
"payWayType": "ewallet",
"payerName": "DW",
"state": 2,
"successTime": 1683949857
}, {
"amount": "190000",
"bankCard": "123456789",
"bankName": "",
"bizType": 1,
"createdAt": 1683948843,
"currency": "VND",
"mchFeeAmount": "10000",
"mchName": "DW-Vietnam Test",
"mchNo": "M1683793693",
"mchOrderNo": "VN69220230300866",
"mobilePhone": "17760797979",
"orderAmount": "200000",
"payOrderId": "P1657227681490333698",
"payWay": "QR",
"payWayType": "qr",
"payerName": "DW",
"state": 2,
"successTime": 1683950422
}],
"searchCount": true,
"size": 3,
"total": 66
},
"msg": "SUCCESS",
"sign": "3046022100d4670c5466807b6b62635030e5c10acd2855e3428b4e9ff45e5c9648d4d28288022100a3cca3d4bbc6d994e66ada5e1d0fb095fabc4a92d622 a2074a1b10fc4c530830"
}
Name | Type | Description |
---|---|---|
amount | string | settlement quantity (when collection is made, it is the upper-point quantity (handling fee is deducted), when payment/withdrawal is made, it is the bill quantity (handling fee is not deducted)) |
bankCard | string | bank card number |
bankName | string | bank name |
bizType | number | business type: 1-Collection on behalf of others 2-Payment on behalf of others 3-USDT withdrawal 4-Withdrawal |
createdAt | number | order creation time (0 time zone timestamp, accurate to seconds) |
currency | string | currency |
mchFeeAmount | string | handling fee |
mchName | string | merchant name |
mchNo | string | merchant number |
mchOrderNo | string | merchant order number |
mobilePhone | string | mobile phone number |
orderAmount | string | order amount |
payOrderId | string | payment serial number |
payWay | string | payment method name |
payWayType | string | payment method |
payerName | string | user name |
state | number | order status: 2-successful 3-failed 8-(payment) rejected 9-partial payment (payment amount is less than the order amount) |
successTime | number | success time (0 time zone timestamp, accurate to seconds) |
Body request parameters
{
"mchNo": "M1655535407"
}
Name | Location | Type | Required | Description |
---|---|---|---|---|
X-API-KEY | header | string | Y | public key |
X-API-NONCE | header | string | Y | request time (timestamp, accurate to milliseconds) |
X-API-SIGNATURE | header | string | Y | signature (refer to signature algorithm) |
mchNo | body | string | Y | merchant number |
Return to example
{
"code": 0,
"data": {
"availableAmount": "294876",
"frozenAmount": "1986",
"mchNo": "M1658240182"
},
"msg": "SUCCESS",
"sign": "3045022100e659480ea76d87c26e0054bda5a788737d41f26d4dec365fba936028248785140220540c9bb2b9fe6fc928dc2ae4c531ee00a82615bc37b77b02 ca41cffeeaddc627"
}
Name | Type | Description |
---|---|---|
availableAmount | string | available balance |
frozenAmount | string | frozen balance |
mchNo | string | merchant number |
OK
Name | Type | Required | Description |
---|---|---|---|
bizType | number | Y | business type: 1-Collection 2-Payment |
payOrderId | string | Y | payment order number |
mchNo | string | Y | merchant number |
mchOrderNo | string | Y | merchant order number (customized by merchant, cannot be repeated) |
orderAmount | string | Y | original transaction amount of bill |
payAmount | string | Y | payment amount |
currency | string | Y | three-digit currency code |
state | number | Y | payment status: 2-payment successful, 3-payment failed, 9-partial payment (collection) |
fee | string | Y | merchant fee |
failReason | string | N | failure reason |
Signature rules: After JSONizing the request parameters, put the obtained signature in the header, and obtain the signature directly from the response header. To verify the signature, use verifyEcdsaSignature() in the ECSDAKit tool class below.
<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcprov-jdk15on</artifactId>
<version>1.64</version>
<scope>compile</scope>
</dependency>
Error code | Error description |
---|---|
-1 | System error |
5003001 | Missing parameter |
5003002 | Merchant or APIKey does not exist |
5003003 | Merchant disabled |
5003004 | Merchant not certified |
5003005 | Merchant api key does not exist |
5003005 | Merchant or api key does not exist |
5003006 | api key expired |
5003007 | ip error |
5003008 | Signature error |
5003009 | Payment method not supported |
5003010 | Order status error |
5003011 | Merchant order number already exists |
5003012 | URL format error |
5003013 | Channel error |
5003014 | Merchant rate configuration is not initialized |
5003015 | Channel does not exist |
5003017 | Failed to create collection order |
5003018 | Failed to check collection order |
5003010 | Failed to create payment order |
5003020 | Failed to query payment |
5004006 | Insufficient merchant balance |
500321 | Amount format is incorrect |
500322 | URL not supported |
500323 | Remote client error |
500324 | Order expired |
500326 | Error in querying channel balance |
500327 | Wrong payment method |