Sign in

Payments

Verify a payment

View as Markdown

In a nutshell

Check the final status of a Paystack transaction using the Verify Transaction endpoint.

After a customer completes (or abandons) a payment, use the Verify Transaction endpoint to confirm the final outcome before delivering value. This is distinct from the API-level status field, which tells you whether the API call succeeded, not whether the payment succeeded.

Prefer webhooks for automated fulfilment. Webhooks push updates to your server as soon as a payment settles. The verify endpoint is best for callback handling, manual reconciliation, and cases where you need to confirm state on demand.

Copy linkTransaction statuses

Only fulfil the order when data.status is success. For what every other status means and how to handle it, see Transaction statuses.

Copy linkCall the Verify endpoint

Make a GET request from your server using the transaction reference. Use your secret key; never call this from the browser.

GETapi.paystack.co/transaction/verify/:reference

curl https://api.paystack.co/transaction/verify/:reference \
  -H "Authorization: Bearer YOUR_SECRET_KEY" \
  -X GET
const https = require('https')

const options = {
  hostname: 'api.paystack.co',
  port: 443,
  path: `/transaction/verify/${reference}`,
  method: 'GET',
  headers: {
    Authorization: 'Bearer YOUR_SECRET_KEY'
  }
}

https.request(options, (res) => {
  let data = ''
  res.on('data', chunk => { data += chunk })
  res.on('end', () => {
    const result = JSON.parse(data)
    if (result.data.status === 'success' && result.data.amount === expectedAmount) {
      // deliver value
    }
  })
}).end()

Warning

response.status is the API call status (true/false). The transaction outcome is in response.data.status. Do not confuse the two.

Copy linkCheck the amount

Always verify the amount returned in data.amount matches the expected charge. The amount is in the smallest denomination of the currency (cents).

const { status, amount } = result.data

if (status === 'success' && amount === expectedAmount) {
  // safe to deliver
}

Copy linkHow to get the reference

Integration methodHow to get the reference
Popup / mobile SDKsSend it from the frontend to your server after checkout
Redirect CheckoutRead from the reference query parameter on your callback URL
Charge APIUse the reference returned when you created the charge

Copy linkStore the authorization for recurring charges

A successful verify response includes data.authorization when the payment used a card. You can store the authorization_code and the customer email to charge the card again without going through checkout.

{
  "data": {
    "status": "success",
    "amount": 50000,
    "authorization": {
      "authorization_code": "AUTH_8dfhjjdt",
      "channel": "card",
      "reusable": true
    }
  }
}

Only store authorizations where reusable is true. See recurring charges for how to use them.

Was this page helpful?