Transaction verification
After a successful transaction, you must verify that the transaction was successful before providing value to a customer. Every transaction is assigned an ID, which must be supplied when attempting to confirm a transaction. To use the transaction verification API to confirm a transaction, the merchant must provide their Klump Secret Key, which can be found in their Klump dashboard
Things to look out for when verifying a transaction:
- Verify the transaction
data.reference
returned matches what you're expecting. - Verify the transaction
state
issuccess
- Verify the
data.status
issuccessful
- Verify the
data.currency
matches what you're expecting.
Also, depending on your need, data.is_live
will return a boolean. If the boolean is true
this signifies that the transaction happened in production and you can proceed to issue real value, else, you don't have to.
Sample code used in transaction verification
curl --location --request GET 'https://api.useklump.com/v1/transactions/:reference/verify' \
--header 'Content-Type: application/json' \
--header 'klump-secret-key: {{KLUMP_SEC_KEY}}'
:reference
is the expected transaction ID.
Sample transaction verification response
{
"state": "success",
"data": {
"id": "2dab6b4e-7db5-4dcc-bc03-470e3a417e97",
"reference": "KLP-1644-083962-4231",
"amount": "1183.85",
"status": "successful",
"currency": "NGN",
"meta_data": null,
"is_live": false,
"items": [
{
"id": "13b6be02-4a41-4227-b081-b58ebc6bccf9",
"transaction_id": "2dab6b4e-7db5-4dcc-bc03-470e3a417e97",
"name": "Timbeland",
"image_url": null,
"item_url": "http://omin.com/andndnd",
"unit_price": "300.00",
"quantity": 1,
"created_at": "2022-02-05T17:59:22.537Z",
"updated_at": null
},
{
"id": "dd6f96fa-9f06-4930-a1fb-47d690a40478",
"transaction_id": "2dab6b4e-7db5-4dcc-bc03-470e3a417e97",
"name": "Orange Fruit",
"image_url": null,
"item_url": "http://omin.com/andndnd",
"unit_price": "300.00",
"quantity": 1,
"created_at": "2022-02-05T17:59:22.537Z",
"updated_at": null
},
{
"id": "0234f2a1-2fb7-4b83-90ee-650327dbbda4",
"transaction_id": "2dab6b4e-7db5-4dcc-bc03-470e3a417e97",
"name": "Kiwi Fruit",
"image_url": null,
"item_url": "http://omin.com/andndnd",
"unit_price": "400.00",
"quantity": 1,
"created_at": "2022-02-05T17:59:22.537Z",
"updated_at": null
}
]
}
}
Updated almost 3 years ago