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/jsonjson
{
"partner_id": "{{partner_id}}",
"partner_key": "{{partner_key}}",
"token": "{{token}}"
}Parameters:
| Param | Type | Required | Default | Description |
|---|---|---|---|---|
partner_id | string | Yes | — | The partner id. |
partner_key | string | Yes | — | The partner key. |
token | string | Yes | — | 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\"}"
}
}| Field | Type | Description |
|---|---|---|
success | bool | Request status. |
code | int | The status code — 1 on success. |
message | string | The status or error message. |
challenge_key | string | The challenge key used to generate an advance OTP. |
transaction.app_id | string | The app name the transaction was created under. |
transaction.transaction_id | string | The unique transaction id on the partner side. |
transaction.transaction_desc | string | The transaction description. |
transaction.transaction_amount | string | The transaction amount. |
transaction.transaction_date | string | The date the transaction was created. |
transaction.receiver_account | string | The receiver account id. |
transaction.sender_account | string | The sender account id. |
transaction.currency | string | The currency used to perform the transaction. |
transaction.type | string | The type of transaction, defined on the partner side. |
transaction.created_at | string | The time the transaction was stored in the database. |
transaction.transaction_metadata | string | Additional 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
| Code | Description |
|---|---|
3 | Parameter invalid |
103 | Thông tin Partner không chính xác — Partner details are incorrect. |
129 | Token không hợp lệ — Invalid token. |
190108 | Tài khoản chưa hoạt động — Account not activated. |
190203 | Không tìm thấy transaction — Transaction not found. |
Next Steps
- Get Transaction — fetch a specific transaction by id
- Validate OTP — verify the advance OTP