Verify Payments

In A Nutshell
In a nutshell

The Verify Transaction API allows you confirm the status of a customer's transaction.

Transaction statuses

Webhooks are the preferred option for confirming a transaction status, but we currently send webhook events for just successful transactions. However, a transaction can have the following statuses:

StatusMeaning
abandonedThe customer has not completed the transaction.
failedThe transaction failed. For more information on why, refer to the message/gateway response.
ongoingThe customer is currently trying to carry out an action to complete the transaction. This can get returned when we're waiting on the customer to enter an otp or to make a transfer (for a pay with transfer transaction).
pendingThe transaction is currently in progress.
processingSame as pending, but for direct debit transactions.
queuedThe transaction has been queued to be processed later. Only possible on bulk charge transactions.
reversedThe transaction was reversed. This could mean the transaction was refunded, or a chargeback was successfully logged for this transaction.
successThe transaction was successfully processed.

Verify a transaction

You do this by making a GET request to the Verify TransactionAPI endpoint from your server using your transaction reference. This is dependent on the method you used to initialize the transaction.

From Popup or Mobile SDKs

You'll have to send the reference to your server, then from your server you call the verify endpoint.

From the Redirect API

You initiate this request from your callback URL. The transaction reference is returned as a query parameter to your callback URL.

Helpful Tip

If you offer digital value like airtime, wallet top-up, digital credit, etc, always confirm that you have not already delivered value for that transaction to avoid double fulfillments, especially, if you also use webhooks.

Here's a code sample for verifying transactions:

Show Response
1#!/bin/sh
2curl https://api.paystack.co/transaction/verify/:reference
3-H "Authorization: Bearer YOUR_SECRET_KEY"
4-X GET
1{
2 "status": true,
3 "message": "Verification successful",
4 "data": {
5 "id": 4099260516,
6 "domain": "test",
7 "status": "success",
8 "reference": "re4lyvq3s3",
9 "receipt_number": null,
10 "amount": 40333,
11 "message": null,
12 "gateway_response": "Successful",
13 "paid_at": "2024-08-22T09:15:02.000Z",
14 "created_at": "2024-08-22T09:14:24.000Z",
15 "channel": "card",
16 "currency": "NGN",
17 "ip_address": "197.210.54.33",
18 "metadata": "",
19 "log": {
20 "start_time": 1724318098,
21 "time_spent": 4,
22 "attempts": 1,
23 "errors": 0,
24 "success": true,
25 "mobile": false,
26 "input": [],
27 "history": [
28 {
29 "type": "action",
30 "message": "Attempted to pay with card",
31 "time": 3
32 },
33 {
34 "type": "success",
35 "message": "Successfully paid with card",
36 "time": 4
37 }
38 ]
39 },
40 "fees": 10283,
41 "fees_split": null,
42 "authorization": {
43 "authorization_code": "AUTH_uh8bcl3zbn",
44 "bin": "408408",
45 "last4": "4081",
46 "exp_month": "12",
47 "exp_year": "2030",
48 "channel": "card",
49 "card_type": "visa ",
50 "bank": "TEST BANK",
51 "country_code": "NG",
52 "brand": "visa",
53 "reusable": true,
54 "signature": "SIG_yEXu7dLBeqG0kU7g95Ke",
55 "account_name": null
56 },
57 "customer": {
58 "id": 181873746,
59 "first_name": null,
60 "last_name": null,
61 "email": "demo@test.com",
62 "customer_code": "CUS_1rkzaqsv4rrhqo6",
63 "phone": null,
64 "metadata": null,
65 "risk_action": "default",
66 "international_format_phone": null
67 },
68 "plan": null,
69 "split": {},
70 "order_id": null,
71 "paidAt": "2024-08-22T09:15:02.000Z",
72 "createdAt": "2024-08-22T09:14:24.000Z",
73 "requested_amount": 30050,
74 "pos_transaction_data": null,
75 "source": null,
76 "fees_breakdown": null,
77 "connect": null,
78 "transaction_date": "2024-08-22T09:14:24.000Z",
79 "plan_object": {},
80 "subaccount": {}
81 }
82}
Warning

The API response has a status key response.status indicating the status of the API call. This is not the status of the transaction. The status of the transaction is in the data object in the verify API response, i.e response.data.status. Learn more about Paystack API format.

Charge returning Users

The verify response also returns information about the payment instrument that the user paid with in the data.authorization object. If the channel is card, then you can store the authorization_code for that card against that user, and use that charge the user for subsequent transaction. Learn more about recurring charges.