Errors
Paystack's API is RESTful and as such, uses conventional HTTP response codes to indicate the success or failure of requests.
200 | Request was successful and intended action was carried out. Note that we will always send a 200 if a charge or verify request was made. Do check the data object to know how the charge went (i.e. successful or failed). |
201 | A resource has successfully been created. |
400 | A validation or client side error occurred and the request was not fulfilled. |
401 | The request was not authorized. This can be triggered by passing an invalid secret key in the authorization header or the lack of one. |
404 | Request could not be fulfilled as the request resource does not exist. |
5xx | Request could not be fulfilled due to an error on Paystack's end. This shouldn't happen so please report as soon as you encounter any instance of this. |
We discuss some common errors and their causes below:
Sample Response
200 Ok
1{2 "status": true,3 "message": "Charge attempted",4 "data": {5 "amount": 200,6 "currency": "NGN",7 "transaction_date": "2017-05-24T05:56:12.000Z",8 "status": "success",9 "reference": "zuvbpizfcf2fs7y",10 "domain": "test",11 "metadata": {12 "custom_fields": [13 {14 "display_name": "Merchant name",15 "variable_name": "merchant_name",16 "value": "Van Damme"17 },18 {19 "display_name": "Paid Via",20 "variable_name": "paid_via",21 "value": "API call"22 }23 ]24 },25 "gateway_response": "Successful",26 "message": null,27 "channel": "card",28 "ip_address": "54.154.89.28, 162.158.38.82, 172.31.38.35",29 "log": null,30 "fees": 3,31 "authorization": {32 "authorization_code": "AUTH_6tmt288t0o",33 "bin": "408408",34 "last4": "4081",35 "exp_month": "12",36 "exp_year": "2020",37 "channel": "card",38 "card_type": "visa visa",39 "bank": "TEST BANK",40 "country_code": "NG",41 "brand": "visa",42 "reusable": true,43 "signature": "SIG_uSYN4fv1adlAuoij8QXh",44 "account_name": "BoJack Horseman"45 },46 "customer": {47 "id": 14571,48 "first_name": null,49 "last_name": null,50 "email": "test@email.co",51 "customer_code": "CUS_hns72vhhtos0f0k",52 "phone": null,53 "metadata": null,54 "risk_action": "default"55 },56 "plan": null57 }58}
Loading errors
- Sample generic error
1{2 "status": "false",3 "message": "[string]"4}