Skip to main content
Version: Lastest

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

ParamsRequiredTypeDescription
partnerRefIdStringCounterparty transaction code, unique for each transaction
productCodeStringProduct code (see also Appendix of product code table)
typeStringThe 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.
customer_phoneStringThe phone number (in the format: 09x, 08x...) to receive scratch card information with the card purchase method being SMS.
quantityIntegerNumber of cards to buy
Maximum 100 cards / 1 purchase with type: 'normal'
Maximum 1 card / 1 purchase with type: 'sms'
signatureStringSignature 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

ParamsTypeDescription
errorCodeIntegerError code return
messageStringDetailed description of the error code
cardsArray of ObjectCard Information
cards[].codeStringCard code (in encrypted form)
cards[].serialStringCard Serial
cards[].vendorStringCard Vendor
cards[].valueIntegerCard value
cards[].expiryStringCard expiry date (format: y-m-d, vd: 29-09-2023)
transactionObjectTransaction information
transaction.appotapayTransIdStringAppotaPay side transaction code
amountIntegerTransaction amount
timeStringTransaction time (format: d-m-Y H:i:s)
accountObjectAccount information
account.balanceIntegerAccount balance after transaction

Example

Request

{
"partnerRefId": "AB123",
"productCode": "AC100",
"quantity": 10,
"signature": "b10294bae53e89919b3efd62a763bf3..."
}

Case type: "sms"

{
"partnerRefId": "AB123",
"productCode": "VT10",
"type": "sms",
"quantity": 1,
"customer_phone": "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"
}
}