Get Payment Status API
GET Method
Kaleyra platform's Get Payment Status API allows you to get the payment status and refund details related to WhatsApp Payments done by your end-users through the WhatsApp Pay feature.
Prerequisites
- An active Kaleyra platform account, if you do not have, you can contact a Kaleyra representative to sign up for free to the platform. Before you get started, Create a Kaleyra Account and Create an API Key.
To view the API Key and the SID, see View API Key and SID.. - An active WhatsApp for Business API plan that includes:
- A WhatsApp business number.
- An associated profile with the business number.
- A WhatsApp verified and approved profile.
API Domain and Value
api_domain | Value |
---|---|
IN pod | api.in.kaleyra.io |
SG Pod | api.kaleyra.io |
EU Pod | api.eu.kaleyra.io |
NA pod | api.na.kaleyra.ai |
API request to get WhatsApp payment status
To get the WhatsApp payment status, use https://<api_domain>/v1/<sid>/wrapper/<phonenumberId>/payments/<paymentconfigId>/<referenceId>
endpoint with the following request method.
The following is the sample request format to get the WhatsApp payment status:
curl --location GET 'https://<api_domain>/v1/<SID>/wrapper/<phonenumberID>/payments/<paymentconfigId>/<referenceId>' \
-H 'api-key: <api-key>' \
-H 'Content-Type: <Content-Type>'
The following is the sample request format to get WhatsApp payment status:
curl --location GET 'https://api.in.kaleyra.io/v1/HXAP16XXXXXX97IN/wrapper/14094128XXXXXXXX/payments/XXXXXo_2abcdxyabxyaab/2abcdXXXXXyaab' \
-H 'api-key: xxxxxe49b8d313ce3f53613dad5xxxxxx' \
-H 'Content-Type: application/x-www-form-urlencoded'
URL Parameters and Headers
Following is the list of parameters and headers to get WhatsApp payment status:
Parameter / Headers | Data Type | Description | Example | Mandatory? |
---|---|---|---|---|
sid | String | Account SID (Security Identifier). | HXAP16XXXXXX97IN | Yes |
phonenumberID | String | The phone number identity of the business. | 14094128XXXXXXXX | Yes |
paymentconfigId | String | Payment configuration for the order sent in order_details message. For more information, see Payment Refund API. | XXXXXo_2abcdxyabxyaab | Yes |
referenceId | String | Unique reference ID for the order sent in order_details message. For more information, see Payment Refund API . | 2abcdXXXXXyaab | Yes |
api-key | String | API key generated from Kaleyra account. | Axxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx3 | Yes |
Content-Type | String | Indicates the format of the content the API will be processing. | The only allowed value is application/json. | Yes |
Sample Success Response
The following success message appears with the status 200 Accepted:
{
"payments": [{
"reference_id": "reference-id-value",
"status": "status-of-payment",
"currency": "INR",
"total_amount": {
"value": 21000,
"offset": 100
},
"transactions": [
{
"id": "[PG-TXN-ID]",
"type": "billdesk/razorpay/payu/zaakpay",
"status": "success/failed",
"created_timestamp": "CREATED_TIMESTAMP",
"updated_timestamp": "UPDATED_TIMESATMP",
"method": {
"type": "upi/card/netbanking/wallet"
},
"error": {
"code": "pg-generated-error-code",
"reason": "pg-generated-descriptive-reason"
},
"refunds": [
{
"id": "[REFUND-ID]",
"amount": {
"value": 100,
"offset": 100
},
"speed_processed": "instant/normal",
"status": "success",
"created_timestamp": "CREATED_TIMESTAMP",
"updated_timestamp": "UPDATED_TIMESATMP",
}
],
}
],
"receipt": "receipt-value",
"notes": {
"key1": "value1",
"key2": "value2"
},
"udf1": "udf1-value",
"udf2": "udf2-value",
"udf3": "udf3-value",
"udf4": "udf4-value"
"additional_info1": "additional_info1-value",
"additional_info2": "additional_info2-value",
"additional_info3": "additional_info3-value",
"additional_info4": "additional_info4-value",
"additional_info5": "additional_info5-value",
"additional_info6": "additional_info6-value",
"additional_info7": "additional_info7-value",
}]
}
Sample Failure Responses
The following is the failure responses to get WhatsApp payment status.
Meta Error
{
"error": {
"message": "(#134009) Payment configuration id is invalid",
"type": "OAuthException",
"code": 134009,
"error_data": {
"messaging_product": "whatsapp",
"details": "payment_configuration_id is invalid"
},
"fbtrace_id": "ALrtxxxxxxxxQ9Nd_r7bTyR"
}
Incorrect SID
401 Unauthorised
{
"code": "RBC001",
"message": "Incorrect SID or API key.",
"data": [],
"error": {
"body": "Incorrect SID or API key."
}
}
Solution ID not present
{
"code": "WA002",
"message": "Solution ID mapping not present",
"data": null,
"error": {
"error": "Solution ID mapping not present"
}
}
Error Codes
For information related to the WhatsApp error code, see WhatsApp Error Codes.
Updated 1 day ago