Skip to content

Latest commit

 

History

History
65 lines (54 loc) · 1.7 KB

File metadata and controls

65 lines (54 loc) · 1.7 KB

API Documentation for this project

API Endpoints

  • POST /api/v1/initialize: initialize a new transaction
  • GET /api/v1/verifyPayment: Verify a transaction
  • POST /api/v1/getPayment: Get transaction reciept

Initialize Payments

When initializing a new payment, a post request is made to the initialize endpoint. The body of the request should contain JSON with the following fields:

firstName,
lastName,
email,
amount

if successful, response will come in json:

{
  "status": true,
  "message": "Authorization URL created",
  "data": {
    "authorization_url": "https://checkout.paystack.com/0peioxfhpn",
    "access_code": "0peioxfhpn",
    "reference": "[7PVGX8MEk85tgeEpVDtD]"
  }
}

copy the authorization url to proceed with poayment

Verify Payments

a get request is made to the endpoint with the payment refrence as a url parameter, example /api/v1/verifyPayment/0peioxfhpn

response will come in json

{
  "status": true,
  "message": "Verification successful",
  "data": {
    "id": 2009945086,
    "domain": "test",
    "status": "success",
    "reference": "rd0bz6z2wu",
    "amount": 20000,
    "message": null,
    "gateway_response": "Successful",
    "paid_at": "2022-08-09T14:21:32.000Z",
    "created_at": "2022-08-09T14:20:57.000Z",
    "channel": "card",
    "currency": "NGN",
    "ip_address": "100.64.11.35",
    "metadata": ""
    }
    //
}

Transaction Receipts

This endpoint returns a transaction information object that could serve as a receipt

Refer to the official paystack documentation to understand different transaction options you could modify clone and modify the project to suit your needs.