Skip to content
Wire Ghapi

Charge

The Charge API lets you collect a Mobile Money payment from inside your own website or app, without sending your customer to the Wire Gh checkout. Your server sends the number, the customer approves the prompt on their phone, and you confirm the result. Read the Charge API guide for the full flow.

Create Charge

Create a transaction and charge the Mobile Money number in one call. Look at data.status to know what to do next:

StatusWhat to do
successPayment is complete. Verify it, then give value.
pay_offlineA prompt was sent to the customer's phone. Show display_text and wait for the charge.success webhook, or check again with Check Pending Charge.
send_otpAsk the customer for the code sent to their phone and send it with Submit OTP.
failedThe charge did not go through. gateway_response says why. Start a new charge to try again.

Headers

authorizationStringrequired
Set value to Bearer YOUR_SECRET_KEY.
content-typeStringrequired
Set value to application/json.
idempotency-keyStringoptional
A unique value you choose so a retried request is processed only once. See idempotent requests.

Body parameters

emailStringrequired
Customer's email address.
amountIntegerrequired
Amount in pesewas. The minimum is 100.
mobile_moneyObjectrequired
The number to charge: {"phone": "0551234987", "provider": "mtn"}. provider is mtn, telecel or airteltigo and must match the number's network; leave it out and we pick it from the number. See networks.
referenceStringoptional
Your own unique reference. We create one if you leave it out.
metadataObjectoptional
Extra information to keep with the transaction.
currencyStringoptional
Only GHS is supported.
POST/charge
curl https://api.wiregh.com/charge \
-H "Authorization: Bearer YOUR_SECRET_KEY" \
-H "Content-Type: application/json" \
-d '{
  "email": "customer@email.com",
  "amount": 5000,
  "mobile_money": {
    "phone": "0551234987",
    "provider": "mtn"
  }
}' \
-X POST
Sample response
{
  "status": true,
  "message": "Charge successful",
  "data": {
    "reference": "WG2611096D4HQE52FMY9KW",
    "status": "success",
    "display_text": null,
    "gateway_response": "Approved",
    "retry_allowed": false
  }
}

Submit OTP

Send the one time code your customer received, when a charge returned send_otp.

Headers

authorizationStringrequired
Set value to Bearer YOUR_SECRET_KEY.
content-typeStringrequired
Set value to application/json.
idempotency-keyStringoptional
A unique value you choose so a retried request is processed only once. See idempotent requests.

Body parameters

otpStringrequired
The code the customer entered.
referenceStringrequired
Reference of the charge that asked for the code.
POST/charge/submit_otp
curl https://api.wiregh.com/charge/submit_otp \
-H "Authorization: Bearer YOUR_SECRET_KEY" \
-H "Content-Type: application/json" \
-d '{
  "otp": "123456",
  "reference": "WG2611096D4HQE52FMY9KW"
}' \
-X POST
Sample response
{
  "status": true,
  "message": "Charge successful",
  "data": {
    "reference": "WG2611096D4HQE52FMY9KW",
    "status": "success",
    "display_text": null,
    "gateway_response": "Approved",
    "retry_allowed": false
  }
}

Check Pending Charge

Check the latest status of a charge, for example while your customer is approving a pay_offline prompt. Wait at least 10 seconds between checks; the webhook will usually reach you first.

Headers

authorizationStringrequired
Set value to Bearer YOUR_SECRET_KEY.

Path parameters

referenceStringrequired
Reference of the charge.
GET/charge/:reference
curl https://api.wiregh.com/charge/WG2611096D4HQE52FMY9KW \
-H "Authorization: Bearer YOUR_SECRET_KEY" \
-X GET
Sample response
{
  "status": true,
  "message": "Charge successful",
  "data": {
    "reference": "WG2611096D4HQE52FMY9KW",
    "status": "success",
    "display_text": null,
    "gateway_response": "Approved",
    "retry_allowed": false
  }
}