API Buy card code
Endpoint: /api/v1/service/shopcard/buy
Method: POST
Header: How to generate JWT_TOKEN
{
"X-APPOTAPAY-AUTH": Bearer JWT_TOKEN,
"Content-Type": "application/json"
}
Params
Params | Required | Type | Description |
---|---|---|---|
partnerRefId | √ | String | Counterparty transaction code, unique for each transaction |
productCode | √ | String | Product code (see also Appendix of product code table) |
type | String | The method of purchasing cards.. Default is "normal". normal: Purchased cards will be delivered directly. sms: Purchased cards will be sent directly via SMS to the user's phone number. | |
customerPhone | String | The phone number (in the format: 09x, 08x...) to receive scratch card information with the card purchase method being sms. | |
quantity | √ | Integer | Number of cards to buy Maximum 100 cards / 1 purchase with type: 'normal' Maximum 1 card / 1 purchase with type: 'sms' |
signature | √ | String | Signature of the parameters passed to the API, the parameters are included in the signature in the order of: partnerRefId + productCode + quantity (see also how to create a signature) |
Data result
Params | Type | Description |
---|---|---|
errorCode | Integer | Error code return |
message | String | Detailed description of the error code |
cards | Array of Object | Card Information |
cards[].code | String | Card code (in encrypted form) |
cards[].serial | String | Card Serial |
cards[].vendor | String | Card Vendor |
cards[].value | Integer | Card value |
cards[].expiry | String | Card expiry date (format: y-m-d, vd: 29-09-2023) |
transaction | Object | Transaction information |
transaction.appotapayTransId | String | AppotaPay side transaction code |
amount | Integer | Transaction amount |
time | String | Transaction time (format: d-m-Y H:i:s) |
account | Object | Account information |
account.balance | Integer | Account balance after transaction |
Example
Request
{
"partnerRefId": "AB123",
"productCode": "AC100",
"quantity": 10,
"signature": "b10294bae53e89919b3efd62a763bf3..."
}
Case type: "sms"
{
"partnerRefId": "AB123",
"productCode": "VT10",
"type": "sms",
"quantity": 1,
"customerPhone": "0912345678",
"signature": "b10294bae53e89919b3efd62a763bf3..."
}
Response
{
"errorCode": 0,
"message": "Thành công",
"cards": [
{
"code": "b10294bae53e89919b3efd62a763bf3",
"serial": "OTA123456789",
"vendor": "appota",
"value": 100000,
"expiry": "29-09-2023"
},
...
],
"transaction": {
"amount": 100000,
"appotapayTransId": "AP12adf21121",
"time": "10-04-2020 10:10:10",
},
"account": {
"balance": "121000000"
}
}
Case type: "sms"
{
"errorCode": 0,
"message": "Thành công",
"cards": [],
"transaction": {
"amount": 100000,
"appotapayTransId": "AP12adf21121",
"time": "10-04-2020 10:10:10",
},
"account": {
"balance": "121000000"
}
}