Verify Payments
Verify transactions after payments using Paystack's verify API
How to verify payments
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:
1#!/bin/sh2curl https://api.paystack.co/transaction/verify/:reference3-H "Authorization: Bearer YOUR_SECRET_KEY"4-X GET
1{2 "status": true,3 "message": "Verification successful",4 "data": {5 "id": 690075529,6 "domain": "test",7 "status": "success",8 "reference": "nms6uvr1pl",9 "amount": 20000,10 "message": null,11 "gateway_response": "Successful",12 "paid_at": "2020-05-19T12:30:56.000Z",13 "created_at": "2020-05-19T12:26:44.000Z",14 "channel": "card",15 "currency": "NGN",16 "ip_address": "154.118.28.239",17 "metadata": "",18 "log": {19 "start_time": 1589891451,20 "time_spent": 6,21 "attempts": 1,22 "errors": 0,23 "success": true,24 "mobile": false,25 "input": [],26 "history": [27 {28 "type": "action",29 "message": "Attempted to pay with card",30 "time": 531 },32 {33 "type": "success",34 "message": "Successfully paid with card",35 "time": 636 }37 ]38 },39 "fees": 300,40 "fees_split": {41 "paystack": 300,42 "integration": 40,43 "subaccount": 19660,44 "params": {45 "bearer": "account",46 "transaction_charge": "",47 "percentage_charge": "0.2"48 }49 },50 "authorization": {51 "authorization_code": "AUTH_xxxxxxxxxx",52 "bin": "408408",53 "last4": "4081",54 "exp_month": "12",55 "exp_year": "2020",56 "channel": "card",57 "card_type": "visa DEBIT",58 "bank": "Test Bank",59 "country_code": "NG",60 "brand": "visa",61 "reusable": true,62 "signature": "SIG_xxxxxxxxxxxxxxx",63 "account_name": null64 },65 "customer": {66 "id": 24259516,67 "first_name": null,68 "last_name": null,69 "email": "customer@email.com",70 "customer_code": "CUS_xxxxxxxxxxx",71 "phone": null,72 "metadata": null,73 "risk_action": "default"74 },75 "plan": null,76 "order_id": null,77 "paidAt": "2020-05-19T12:30:56.000Z",78 "createdAt": "2020-05-19T12:26:44.000Z",79 "requested_amount": 20000,80 "transaction_date": "2020-05-19T12:26:44.000Z",81 "plan_object": {},82 "subaccount": {83 "id": 37614,84 "subaccount_code": "ACCT_xxxxxxxxxx",85 "business_name": "Cheese Sticks",86 "description": "Cheese Sticks",87 "primary_contact_name": null,88 "primary_contact_email": null,89 "primary_contact_phone": null,90 "metadata": null,91 "percentage_charge": 0.2,92 "settlement_bank": "Guaranty Trust Bank",93 "account_number": "0123456789"94 }95 }96}
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.