Transactions
Verify Transaction

Verify Transaction

Verify the status and authenticity of a transaction using its unique reference. This is a critical security endpoint that confirms payment completion before delivering goods or services to customers.

⚠️

Always verify transactions on your server before fulfilling orders. Never rely solely on client-side callbacks or redirects, as these can be manipulated.


Endpoint

GET https://api.budpay.com/api/v2/transaction/verify/:reference

Replace :reference with the transaction reference you want to verify.


Sample Request

curl https://api.budpay.com/api/v2/transaction/verify/BUD_1673600359168063493 \
-H "Authorization: Bearer YOUR_SECRET_KEY" \
-X GET

Sample Response (Success)

{
    "status": true,
    "message": "Transaction verified successfully",
    "data": {
        "id": 1404612,
        "currency": "NGN",
        "amount": "550",
        "reference": "BUD_1673600359168063493",
        "ip_address": "102.89.23.45",
        "channel": "transfer",
        "type": "transaction",
        "domain": "live",
        "fees": "50",
        "plan": null,
        "requested_amount": "500",
        "status": "success",
        "card_attempt": 0,
        "split_code": null,
        "message": "Payment successful",
        "gateway": "Wema",
        "transfer_details": null,
        "webhook_status": "sent",
        "webhook_url": "https://yourwebsite.com/webhook",
        "webhook_response": "200 OK",
        "metadata": "",
        "created_at": "2023-01-13T08:59:26.000000Z",
        "paid_at": "2023-01-13 10:06:29",
        "customer": {
            "id": 627321,
            "first_name": "Francis",
            "last_name": "Obadiah",
            "email": "francis@budpay.com",
            "phone": "+2348012345678",
            "domain": "live",
            "customer_code": "CUS_0q2htds3kf3zzrb",
            "metadata": "{}",
            "status": "active"
        }
    }
}

Try it out

Request Parameters

Header Parameters

Field NameDescriptionRequired
AuthorizationBearer token with your secret keyYes

URL Parameters

ParameterTypeRequiredDescription
referenceStringYesUnique transaction reference to verify

Response Fields

Root Level
FieldTypeDescription
statusBooleanIndicates if verification was successful
messageStringResponse message
dataObjectTransaction data object
Transaction Data
FieldTypeDescription
idIntegerInternal transaction ID
currencyStringCurrency code: NGN, USD, GHS, KES
amountStringTotal amount including fees
referenceStringUnique transaction reference
ip_addressStringCustomer's IP address
channelStringPayment channel: card, transfer, mobile_money
typeStringTransaction type
domainStringEnvironment: test or live
feesStringTransaction processing fees
planStringSubscription plan ID (if applicable)
requested_amountStringOriginal amount before fees
statusStringTransaction status: success, pending, failed
card_attemptIntegerNumber of card authorization attempts
split_codeStringSplit payment code (if applicable)
messageStringTransaction message or error description
gatewayStringPayment gateway used
transfer_detailsObjectBank transfer specific details
webhook_statusStringWebhook delivery status: sent, pending, failed
webhook_urlStringURL where webhook was sent
webhook_responseStringResponse from webhook endpoint
metadataStringCustom metadata attached to transaction
created_atStringTimestamp when transaction was created
paid_atStringTimestamp when payment was completed
Customer Data
FieldTypeDescription
idIntegerCustomer ID in BudPay system
first_nameStringCustomer's first name
last_nameStringCustomer's last name
emailStringCustomer's email address
phoneStringCustomer's phone number
domainStringCustomer domain: test or live
customer_codeStringUnique customer code
metadataStringAdditional customer metadata
statusStringCustomer account status

Transaction Status Values

StatusDescriptionAction Required
successPayment completed successfullyFulfill order immediately
pendingPayment initiated but not completedWait or notify customer
failedTransaction failed or was declinedRequest new payment
abandonedCustomer left without payingContact customer if needed

Verification Workflow

Here's the recommended workflow for verifying transactions:

1. Customer Completes Payment

2. Receive Callback/Webhook

3. Extract Transaction Reference

4. Call Verify API (Server-Side)

5. Check status === "success"

6. Verify Amount Matches Expected

7. Check Transaction Not Already Processed

8. Fulfill Order/Deliver Service

9. Mark Transaction as Processed

Error Handling

404 Not Found

{
    "status": false,
    "message": "Transaction not found"
}

Solution: The transaction reference doesn't exist. Verify the reference is correct.

401 Unauthorized

{
    "status": false,
    "message": "Authentication failed"
}

Solution: Check that your API key is valid and properly included in the Authorization header.

400 Bad Request

{
    "status": false,
    "message": "Invalid transaction reference format"
}

Solution: Ensure the reference format is correct.


Best Practices

Tip: Implement idempotency in your order fulfillment logic to safely handle duplicate verification calls for the same transaction.

  1. Immediate Verification: Verify transactions immediately after receiving callbacks.

  2. Idempotent Processing: Design your fulfillment logic to handle multiple verification calls safely.

  3. Proper Logging: Log all verification attempts with timestamps and results.

  4. Error Recovery: Implement retry logic with exponential backoff for failed verifications.

  5. Database Transactions: Use database transactions when updating order status.

  6. Customer Communication: Notify customers promptly after successful verification.

  7. Reconciliation: Regularly reconcile verified payments with your records.

  8. Monitoring: Set up monitoring and alerts for verification failures.


Try it out