Nhảy tới nội dung
Phiên bản: Lastest

API Mua mã thẻ

API Mua mã thẻ

Chat với AI▼

Endpoint: /api/v1/service/shopcard/buy

Method: POST

Header: Cách tạo JWT_TOKEN

Language: en | vi

{
"X-APPOTAPAY-AUTH": Bearer JWT_TOKEN,
"Content-Type": "application/json",
"Language": LANGUAGE
}

Tham số​

Tham sốYêu cầuKiểu dữ liệuMô tả
partnerRefId√StringMã giao dịch phía đối tác, duy nhất cho mỗi giao dịch
productCode√StringMã sản phẩm (xem thêm phần Phụ Lục bảng mã sản phẩm)
typeStringHình thức mua thẻ. Mặc định là "normal".
normal: Thẻ mua sẽ được trả trực tiếp.
quantity√IntegerSố lượng thẻ mua
Tối đa 100 thẻ /1 lần mua với hình thức mua thẻ normal
signature√StringChữ ký các tham số truyền lên API, các tham số được đưa vào chữ ký theo thứ tự bao gồm: partnerRefId + productCode + quantity (xem thêm phần cách tạo signature)

Dữ liệu trả về​

Tham sốKiểu dữ liệuMô tả
errorCodeIntegerMã lỗi trả về
messageStringMô tả chi tiết mã lỗi
cardsArray of ObjectThông tin thẻ
cards[].codeStringMã thẻ (ở dạng đã mã hoá)
cards[].serialStringSerial thẻ
cards[].vendorStringVendor thẻ
cards[].valueIntegerGiá trị thẻ
cards[].expiryStringHạn sử dụng thẻ (dang: y-m-d, vd: 29-09-2023)
transactionObjectThông tin giao dịch
transaction.appotapayTransIdStringMã giao dịch phía AppotaPay
amountIntegerSố tiền giao dịch
timeStringThời gian giao dịch (dạng: d-m-Y H:i:s)
accountObjectThông tin tài khoản
account.balanceIntegerSố dư tài khoản sau giao dịch

Ví dụ​

Request​

{
"partnerRefId": "AB123",
"productCode": "AC100",
"quantity": 10,
"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"
}
}

Ví dụ Code​

curl --location 'https://gateway.dev.appotapay.com/api/v1/service/shopcard/buy' \
--header 'X-APPOTAPAY-AUTH: JWT_TOKEN' \
--header 'Content-Type: application/json' \
-d '{
"partnerRefId": "AB123",
"productCode": "AC100",
"type": "normal",
"customerPhone": "0912345678",
"quantity": 10,
"signature": "b10294bae53e89919b3efd62a763bf3..."
}'

Request​

REQUEST

Development server
Example (from schema)