7️Calling the API Test Callback

This API is designed to test the callback connection from the VietQR system to the partner's system. This is part of the testing and simulation process.

Note: This API can only be applied in the Sandbox (TEST) environment.

Transaction Assumption: In this testing environment, the API assumes that a transaction has been completed and paid.

POST

https://<vietqr-host>/<basepath>/bank/api/test/transaction-callback

Headers

NameValue

Content-Type

application/json

Authorization

Bearer <token>

Body

NameTypeRequiredDescription

bankAccount

String

Yes

Create a payment code with VietQR.

content

String

Yes

Maximum of 19 characters, without Vietnamese accents, and no special characters.

amount

Long

Yes

Payment amount.

transType

String

Yes

Transaction classification: Debit/Credit (values: D/C). Default is "C".

Response

{
    "status": "SUCCESS",
    "message": "Transaction_ID"
}

Code mẫu

curl --location 'https://dev.vietqr.org/vqr/bank/api/test/transaction-callback' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer eyJhbGciOiJIUzUxMiJ9.eyJhdXRob3JpdGllcyI6WyJST0xFX1VTRVIiXSwidXNlciI6IlkzVnpkRzl0WlhJdGJtZDFlV1Z1TFhWelpYSXlORGt5IiwiaWF0IjoxNzIxNDUwMzEzLCJleHAiOjE3MjE0NTA2MTN9.u0hK2fZVFvtaZQ3jyVJmMvhyqW8aRFGJIgpL8C71jtXbAPfPhqyJIdGc0Lv-XOY7e1NcjZQWH3FUhc4SXxgqlQ' \
--header 'Cookie: JSESSIONID=5DAD675C6D1BFEB2305B2340FE3BEDEC' \
--data '{
    "bankAccount": "bank_account_sync",
    "content": "test_callback_content_when_scanning_payment_qr_code",
    "amount": "amount",
    "bankCode": "bank_account_code",
    "transType": "C:credit_transaction, D:debit_transaction"
}'

FAQs

What is the Test Callback API used for?

The Test Callback API is used to test the ability to receive and process callbacks from the VietQR system to your system. It helps verify that your system can receive and handle notifications from VietQR when events occur.

Why is it necessary to perform a Test Callback?

Performing a Test Callback ensures that your system can accurately receive callbacks from VietQR. This is crucial for synchronizing transaction statuses and providing timely feedback to customers.

When should the Test Callback be performed?

You should perform the Test Callback after configuring the necessary endpoints on your system and before deploying the service to a production environment. This helps identify and resolve potential issues early on.

How can I check if my system has received the correct callback?

You can monitor your system logs or check the responses from the Test Callback API to confirm that your system has received the correct callback and processed it as expected.

What will the response from the Test Callback API look like?

The Test Callback API will send an HTTP POST request to the Transaction Sync API endpoint you have configured, with data simulating a transaction that has actually been completed. Your system needs to return an HTTP 200 OK response to confirm that the callback has been received and processed successfully.

What should I do if the callback is not processed successfully?

If the callback is not processed successfully, you need to recheck your endpoint configuration, the callback processing logic in your system, and try the Test Callback again. Check the logs and error messages to determine the cause and fix it.

How many times can I perform the Test Callback?

You can perform the Test Callback multiple times until you are sure that your system can accurately and reliably process callbacks.

How can I confirm that the callback has been processed correctly?

After receiving the callback, your system needs to perform the required processing steps and send an HTTP 200 OK response. Check the system logs to ensure that all steps have been executed correctly.

Last updated