This shows you how to verify transactions using the charge ID

To verify a payment, use the Charge Verification endpoint, passing in the charge ID in the URL. You can get the charge ID from the chargeId field that's present in the response you get after creating a transaction, or in the webhook payload for any transaction.

Below is a sample code of how to implement server-side validation

curl -X GET "{{chargeId}}/verify"
-H "Accept: application/json"
-H "Authorization: Bearer {secret_key}"
curl -X GET "{{chargeId}}/verify?transaction_status={{status}}"
-H "Accept: application/json"
-H "Authorization: Bearer {secret_key}"

{{status}} This may only be necessary in Sandbox Mode, that is, when a test API key is used to make an API call to this endpoint.

Verification response

Here's a sample verification response

  "status": "successful",
  "message": "Payment authorized and completed successfully.",
  "data": {
    "amount": 65,
    "charge_id": "TRAU28987693",
    "ref_id": "40725788795",
    "trans_id": "83822270-958d-4fb7-a370-ec132e8c5b06",
    "first_name": "Kim",
    "last_name": "Darry",
    "email": "[email protected]",
    "status": "successful",
    "mobile": "+265992xxxx20",
    "attempts": 1,
    "currency": "MWK",
    "mode": "live",
    "created_at": "2024-06-14T15:43:25.000000Z",
    "completed_at": "2024-06-14T15:43:58.000000Z",
    "mobile_money": {
      "name": "Airtel Money",
      "ref_id": "20be6c20-adeb-4b5b-a7ba-0769820df4fb",
      "country": "Malawi"