Brazil🇧🇷
Interface Description
Access flow chart

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.common problem
1.
2.
3.
Signature algorithm

Tarspay's API requests, except for public APIs, need to carry API key and signature.
HTTP_METHOD + | + HTTP_REQUEST_PATH + | + TIMESTAMP + | + PARAMS
HTTP_HOST
HTTP_METHOD
HTTP_REQUEST_PATH
NONCE
PARAMS
Complete example
Method | URL | Nonce |
---|---|---|
POST | https://payment.tarspay.pro/api/v1/test | 1537498830736 |
Parameter | value |
---|---|
amount | 100 |
price | 100 |
1.
Tip: content does not require URLEncode
2.
3.
The LarkPay signature verification public key can be obtained from the "Web Management Interface - Account Management - apikey" page
Return description
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"
}
Collection
POST collection and unified order placement
Body request parameters
{
"amount": "100",
"body": "your productinfo",
"currency": "BRA",
"mchNo": "80002",
"mchOrderNo": "M202207131958",
"notifyUrl": "https://www.yourcompany.com/notify",
"returnUrl": "https://www.yourcompany.com/return",
"subject": "your subject",
"wayCode": "CASHIER"
}
Request parameters
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 | - Cashier: CASHIER (use the cashier of this system) - Non-cashier: PIX |
amount | body | string | Y | the amount |
currency | body | string | Y | currency(BRA) |
subject | body | string | Y | product title |
body | body | string | Y | product Description Information |
notifyUrl | body | string | Y | notification address |
returnUrl | body | string | Y | return address |
customerName | body | string | N | username |
customerEmail | body | string | N | user Email |
customerContact | body | string | N | user phone |
Return to example
{
"code": 0,
"data": {
"amount": "5000",
"body": "your productinfo",
"countryCode": "br",
"currency": "BRA",
"customerContact": "15221113201",
"mchOrderNo": "202207161603q01",
"orderState": 0,
"payOrderId": "P1551396771600912385",
"payUrl": "https://example.com/larkpayToC/#/order/id/P1551396771600912385",
"reference": "00020101021226860014br.gov.bcb.pix2564qrcode.fitbank.com.br/QR/cob/74E84A5EA90F79A16AEAAC1D9B73E89BB215204000053039865802BR5925ONEPAY MEIOS DE PAGAMENTO6009Fortaleza610960731-30562070503***6304A7AE",
"payWays": {
"PIX": [
{
"countryCode": "br",
"payWay": "PIX",
"payWayLogo": "https://example.com/larkpay_v_1.0/PERMATA.png",
"payWayType": "PIX"
}
]
},
"subject": "your subject"
},
"msg": "SUCCESS",
"sign": "3045022100f32d38d4457295f0ce70376845458ec55a9fad34cce39ae11cd0cdbadd90639e02207d23e33f9b95944fb32923707c30b913063b082995b7e5fb9d8d2369f1ab4e53"
}
Return results
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 |
payUrl | string | pay Url |
reference | string | Merchants can generate their own QR code based on this value and return it through non cash register methods |
payWays | array | payWays |
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 |
Payment code
Payment bank code
Bank & e-wallet code | Bank & e-wallet name |
---|---|
PIX_CPF | PIX_CPF |
PIX_CNPJ | PIX_CNPJ |
PIX_PHONE | PIX_PHONE |
PIX_EMAIL | PIX_EMAIL |
PIX_EVP | PIX_EVP |
POST payment for unified order placement
Body request parameters
{
"amount": "40",
"customerAccountNumber": "10002523675",
"currency": " BRA",
"mchNo": "80001",
"mchOrderNo": "2022071201011",
"notifyUrl": "http://www.yourcompany.com/notify",
"wayCode": "PIX",
"accountTax": "459920019932",
"bankName": "PIX_CPF"
}
Request parameters
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 | PIX |
amount | body | string | Y | the amount |
currency | body | string | Y | currency(BRA) |
notifyUrl | body | string | Y | notification address |
customerName | body | string | Y | username |
customerContact | body | string | Y | Mobile phone number |
customerAccountNumber | body | string | Y | user accountNumber +55{10-11digit number} |
customerEmail | body | string | Y | user email |
accountTax | body | string | Y | duty paragraph,The individual entity is CPF, and the company entity is CNPJ |
bankName | body | string | Y | payment code (refer to [payment code](#payment code)) |
{
"code": 0,
"data": {
"mchOrderNo": "M1655535407",
"payOrderId": "P1551409540398772225"
},
"msg": "SUCCESS",
"sign": "3045022100c3998421fd646521777d0c736753704931f801331dec55f109258dd8a93083c402207c11e37d70477b30ad9e0c42072a3fb5af1a78809ca7f 8023672451e62e8f69f"
}
Return results
Name | Type | Description |
---|---|---|
mchOrderNo | string | Merchant order number (returned after successful request) |
payOrderId | string | Platform order number (returned after successful request) |
Collection order inquiry
POST to obtain collection order information
Body request parameters
{
"mchNo": "M1655535407",
"mchOrderNo": "lin1231241241414"
}
Request parameters
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": "BRA",
"fee": "0",
"mchNo": "M1655535407",
"mchOrderNo": "",
"orderAmount": "10000",
"payAmount": "10000",
"payOrderId": "P1547429458697129178",
"state": 2
},
"msg": "SUCCESS"
}
Return results
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 |
Payment order inquiry
POST Get payment order information
Body request parameters
{
"mchNo": "M1655535407",
"mchOrderNo": "lin1231241241414"
}
Request parameters
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": "BRA",
"fee": "0",
"mchNo": "M1655535407",
"mchOrderNo": "",
"orderAmount": "10000",
"payAmount": "10000",
"payOrderId": "P1547429458697138178",
"state": 2
},
"msg": "SUCCESS"
}
Return results
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 |
Transaction history
POST Get transaction history (final data-success/failure)
Body request parameters
{
"mchNo": "M1658240182",
"bizType": 1,
"startTime": 1656604800,
"endTime": 1667145600,
"pageNumber": 1,
"pageSize": 20
}
Request parameters
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": 1,
"records": [{
"address": "",
"amount": "30880",
"bankCard": "123456789",
"bankCode": "",
"bankName": "",
"bizType": 1,
"body": "Test",
"createdAt": 1658714327,
"currency": "BRA",
"email": "g762646676@126.com",
"mchFeeAmount": "1120",
"mchName": "DW",
"mchNo": "M1658240182",
"mchOrderNo": "YN20220725000003",
"mobilePhone": "13116709877",
"orderAmount": "32000",
"payOrderId": "P1551386450310656001",
"payWay": "PIX",
"payerName": "DW",
"state": 2,
"subject": "buycar",
"successTime": 1658715821
},
{
"address": "",
"amount": "27830",
"bankCard": "",
"bankCode": "",
"bankName": "",
"bizType": 1,
"body": "buy",
"createdAt": 1658714433,
"currency": "BRA",
"email": "g762646676@126.com",
"mchFeeAmount": "6170",
"mchName": "DW",
"mchNo": "M1658240182",
"mchOrderNo": "M1551386893266952193",
"mobilePhone": "816153100",
"orderAmount": "34000",
"payOrderId": "P1551386893275340801",
"payWay": "PIX",
"payerName": "xxxx",
"state": 2,
"subject": "buy",
"successTime": 1658717145
},{
"address": "",
"amount": "27830",
"bankCard": "",
"bankCode": "",
"bankName": "",
"bizType": 1,
"body": "buy",
"createdAt": 1658714433,
"currency": "BRA",
"email": "g762646676@126.com",
"mchFeeAmount": "6170",
"mchName": "DW",
"mchNo": "M1658240182",
"mchOrderNo": "M1551386893266952193",
"mobilePhone": "816153100",
"orderAmount": "34000",
"payOrderId": "P1551386893275340801",
"payWay": "PIX",
"payerName": "xxxx",
"state": 2,
"subject": "buy",
"successTime": 1658717145
}],
"searchCount": true,
"size": 20,
"total": 2
},
"msg": "SUCCESS",
"sign": "3045022100e659480ea76d87c26e0054bda5a788737d41f26d4dec365fba936028248785140220540c9bb2b9fe6fc928dc2ae4c531ee00a82615bc37b77b02ca41cffeeaddc627"
}
Return results
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 | is |
MERCHANT BALANCE INFOMATION QUERY
POST to obtain merchant balance information
Body request parameters
{
"mchNo": "M1655535407"
}
Request parameters
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"
}
Return results
Name | Type | Description |
---|---|---|
availableAmount | string | Available balance |
frozenAmount | string | frozen balance |
mchNo | string | Merchant number |
Callback notification
Submission method: POST
OK
Content-Type
Verify signature
Request parameters
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.
Signature tool class
Maven dependencies
<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcprov-jdk15on</artifactId>
<version>1.64</version>
<scope>compile</scope>
</dependency>
ECSDAKit
Utils
java demo
Error coding table
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 |