Get existing Transaction Intent
Optionally, the Merchant may need to know whether a customer has an existing active transaction intent (= QR Code). For that purpose the following Merchant Backend -> Zastrpay Backend API call must be implemented:
- http
- curl
GET https://host.com/transaction-service/v1/transaction-intents?queryType=ActiveByCustomerAndMerchant&customerId={customerId}&merchantId={merchantId}
Content-Type: application/json
x-api-key: $apiKey
curl -0 -v -k -X GET https://host.com/transaction-service/v1/transaction-intents/?queryType=ActiveByCustomerAndMerchant&customerId={customerId}&merchantId={merchantId} \
-H 'Content-Type: application/json; charset=utf-8' \
-H "x-api-key: $apiKey"
Zastrpay Backend will answer with the following response:
200 OK
{
"items": [
{
"id": "bbc9c15b-9b29-7824-1774-844936598a1f",
"type": "PassthroughDeposit",
"amount": 200,
"currency": "EUR",
"customerId": "80788f10-121f-47bf-802b-718e9e5c5c52",
"merchantId": "4b8901eb-7407-4ad7-b576-d2181c12015a",
"createdOn": "2023-01-26T12:05:46.914Z",
"createdBy": {
"type": "CustomerWebApp",
"customerId": "80788f10-121f-47bf-802b-718e9e5c5c52"
},
"state": "Pending",
"lastModifiedOn": "2023-01-26T12:05:58.048Z",
"lastModifiedBy": {
"type": "CustomerWebApp",
"customerId": "80788f10-121f-47bf-802b-718e9e5c5c52"
},
"lastCorrelationId": "685e34a6-1cef-47e8-824a-0baf31604c5b"
}
]
}
If the items list is empty, then there is no active transaction intent (= QR Code) for this customer. Otherwise the items array will contains only a single item, which is the currently active transaction intent (= QR Code).
A customer can have only 1 transaction intent / QR Code active at a time (regardless if for Deposit or Withdrawal). To create a new one the customer would need to cancel the existing one first.
See Get a filtered list of Transaction Intents API Reference for more information.