Skip to content
Wire Ghdocs

Verify Payments

Confirm on your server that a payment really succeeded, for the right amount, before you deliver anything.

Never trust the browser alone

A success message in a popup, a redirect to your callback URL, or a reference typed into your app can all be faked. Only a verify call from your server, with your secret key, tells you the truth.

When to verify

Verify a transaction:

  • when your customer returns to your callback URL after the redirect checkout;
  • when your page receives a reference from the popup;
  • when you receive a charge.success webhook (an extra check is good practice);
  • before you retry or cancel an order whose status you are unsure of.

Verify a transaction

Call Verify Transaction with the reference:

GET/transaction/verify/:reference
curl https://api.wiregh.com/transaction/verify/WG2611096D4HQE52FMY9KW \
-H "Authorization: Bearer YOUR_SECRET_KEY" \
-X GET
Response
{
  "status": true,
  "message": "Verification successful",
  "data": {
    "id": 173,
    "domain": "test",
    "status": "success",
    "reference": "WG2611096D4HQE52FMY9KW",
    "amount": 5000,
    "requested_amount": 5000,
    "message": null,
    "gateway_response": "Approved",
    "paid_at": "2026-11-09T01:03:40.000Z",
    "created_at": "2026-11-09T01:03:40.000Z",
    "channel": "mobile_money",
    "currency": "GHS",
    "ip_address": "154.160.2.17",
    "metadata": {
      "order_id": "1042"
    },
    "fees": 98,
    "fee_bearer": "merchant",
    "refunded_amount": 0,
    "customer": {
      "id": 169,
      "first_name": null,
      "last_name": null,
      "email": "customer@email.com",
      "customer_code": "CUS_c0473agwwkdxmih",
      "phone": null,
      "metadata": null,
      "risk_action": "default",
      "createdAt": "2026-11-09T01:03:40.000Z",
      "updatedAt": "2026-11-09T01:03:40.000Z"
    },
    "authorization": {
      "channel": "mobile_money",
      "bank": "MTN",
      "last4": "4987",
      "country_code": "GH",
      "reusable": false,
      "mobile_money_number": "23355****87"
    }
  }
}

What to check

Give value only when all of these are true:

  1. The top level status is true. That only means the request worked.
  2. data.status is success. Any other value means you have not been paid.
  3. data.amount equals the amount you expected, in pesewas.
  4. data.currency is GHS.
  5. You have not already delivered for this reference. Record each reference you fulfil and ignore repeats.
Example
async function confirmPayment(reference, expectedAmount) {
  const res = await fetch(
    'https://api.wiregh.com/transaction/verify/' + encodeURIComponent(reference),
    { headers: { Authorization: 'Bearer ' + process.env.WIREGH_SECRET_KEY } }
  );
  const result = await res.json();

  if (!result.status) return false;              // request failed or reference unknown
  const tx = result.data;
  return tx.status === 'success'
      && tx.amount === expectedAmount              // in pesewas
      && tx.currency === 'GHS';
}

// Look up the order by reference in YOUR database, then:
// if (await confirmPayment(order.reference, order.amountPesewas)) markOrderPaid(order);

Transaction statuses

StatusMeaning
pendingCreated, the customer has not paid yet.
ongoingThe customer is approving the payment on their phone.
successPaid. You can give value.
failedThe payment did not go through. gateway_response says why.
abandonedThe customer never paid and the checkout expired.
reversedThe payment was fully refunded.

When you verify a pending or ongoing transaction, we check with the network first, so you always get the most current status.