Skip to content

Get Latest Transaction ​

Returns the most recent transaction for a device and its challenge key, without needing the transaction_id.

Endpoint ​

http
POST /api/v1/saas-sotp/get-latest-transaction
Content-Type: application/json
json
{
  "partner_id": "{{partner_id}}",
  "partner_key": "{{partner_key}}",
  "token": "{{token}}"
}

Parameters:

ParamTypeRequiredDefaultDescription
partner_idstringYes—The partner id.
partner_keystringYes—The partner key.
tokenstringYes—The registration token generated by Register.

Returns: GetLatestTransactionResponse

Sample Request ​

bash
curl --location --request POST '<BASE_URL>/saas-sotp/get-latest-transaction' \
  --header 'Content-Type: application/json' \
  --header 'Accept: application/json' \
  --data-raw '{
    "partner_id": "{{partner_id}}",
    "partner_key": "{{partner_key}}",
    "token": "{{token}}"
  }'

Response ​

json
{
  "success": true,
  "code": 1,
  "message": "Success",
  "challenge_key": "fake_challenge_key",
  "transaction": {
    "app_id": "app_00000001",
    "transaction_id": "txn_00000001",
    "transaction_desc": "Bank transfer",
    "transaction_amount": "1000000",
    "receiver_account": "190xxxxxxx",
    "sender_account": "190xxxxxxx",
    "currency": "VND",
    "type": "transfer",
    "transaction_date": "2022-10-04 12:00:00",
    "created_at": "2023-03-03T10:49:50+07:00",
    "transaction_metadata": "{\"test\":\"abc\"}"
  }
}
FieldTypeDescription
successboolRequest status.
codeintThe status code — 1 on success.
messagestringThe status or error message.
challenge_keystringThe challenge key used to generate an advance OTP.
transaction.app_idstringThe app name the transaction was created under.
transaction.transaction_idstringThe unique transaction id on the partner side.
transaction.transaction_descstringThe transaction description.
transaction.transaction_amountstringThe transaction amount.
transaction.transaction_datestringThe date the transaction was created.
transaction.receiver_accountstringThe receiver account id.
transaction.sender_accountstringThe sender account id.
transaction.currencystringThe currency used to perform the transaction.
transaction.typestringThe type of transaction, defined on the partner side.
transaction.created_atstringThe time the transaction was stored in the database.
transaction.transaction_metadatastringAdditional transaction information.

WARNING

This endpoint returns whichever transaction is newest, which is not necessarily the one the user is looking at. If two transactions are created close together, an OTP generated from the "latest" challenge key may authorize the wrong one. Prefer Get Transaction with an explicit transaction_id whenever you have it.

Errors ​

CodeDescription
3Parameter invalid
103Thông tin Partner không chính xác — Partner details are incorrect.
129Token không hợp lệ — Invalid token.
190108Tài khoản chưa hoạt động — Account not activated.
190203Không tìm thấy transaction — Transaction not found.

Next Steps ​

Developers