API Reference

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 "https://api.paychangu.com/mobile-money/payments/{{chargeId}}/verify"
-H "Accept: application/json"
-H "Authorization: Bearer {secret_key}"
curl -X GET "https://api.paychangu.com/mobile-money/payments/{{chargeId}}/verify?transaction_status={{status}}"
-H "Accept: application/json"
-H "Authorization: Bearer {secret_key}"

Sandbox mode replace {{status}} with success, pending or failed. This may only be necessary for Sandbox Mode, that is when a test API key is used to make an API call to this endpoint.

Moving to Live Mode remove ?transaction_status={{status}} at the end of the endpoint.

Verification response

Here's a sample verification response

{
  "status": "successful",
  "message": "Payment authorized and completed successfully.",
  "data": {
    "amount": 100,
    "charge_id": "ksni",
    "ref_id": "29263119322",
    "trans_id": null,
    "first_name": "Kim",
    "last_name": "Banda",
    "email": "[email protected]",
    "type": "Direct API Payment",
    "status": "success",
    "mobile": "+265993xxxx40",
    "attempts": 1,
    "currency": "MK",
    "mode": "sandbox",
    "created_at": "2024-08-18T14:45:11.000000Z",
    "completed_at": "2024-08-18T14:52:44.000000Z",
    "event_type": "api.charge.payment",
    "mobile_money": {
      "name": "Airtel Money",
      "ref_id": "20be6c20-adeb-4b5b-a7ba-0769820df4fb",
      "country": "Malawi"
    },
    "transaction_charges": {
      "currency": "MK",
      "amount": "4"
    },
    "authorization": {
      "channel": "Mobile Money",
      "card_number": null,
      "expiry": null,
      "brand": null,
      "provider": "Airtel Money",
      "mobile_number": null,
      "completed_at": "2024-08-18T14:52:44.000000Z"
    },
    "logs": []
  }
}