Card Payments

Initiate Card Payment

Postman Collection

For more header and response codes descriptions expand the link below.

Initiate Card Payment.

POST https://api.chpter.co/v1/initiate/card-payment

Send a request and get a checkout url to complete the card payment.

Headers

Name
Type
Description

Api-Key*

String

Your chpter Public Key

Content-Type

String

application/json

Request Body

Name
Type
Description

customer_details*

Object

Customer Details

full_name*

String

Customer Name

products*

List / Array

Product Details

location*

String

Customer Location

email*

String

Customer Email

phone_number*

String

Customer PhoneNumber

unit_price*

Float

Product Price

quantity*

Integer

Product Quantity

product_name*

String

Product Name

digital_link

String

Product Digital Link

amount*

Object

Object with Amount Details

discount_fee*

Float

Discount Fee

delivery_fee*

Float

Delivery Fee

currency*

String

Currency code (KES)

total*

Float

Total Amount to be paid

callback_details*

Object

Callback Object

transaction_reference*

String

Unique reference

callback_url*

String

Your callback URL

success_url*

String

Url to redirect on successful payment

failed_url*

String

Url to redirect on failed payment

{
    "message": "Successful",
    "success": true,
    "status": 200,
    "transaction_reference": "1234",
    "chpter_transaction_ref": "p-2RbNdXIKxfXC6SydcHe7Q8Lq7CF",
    "checkout_url": "https://checkout.paystack.com/cjdjfd****"
}

Good to know: This API uses webhooks to notify you of the payment status through the callback url. The user will be redirected to the passed success url on successful payment and to the failed url on failed payment.

Quick view

Sample body and the respective response code.

{
  "customer_details": {
   "full_name": "Albert Chela",
    "location": "Nairobi",
    "phone_number": "254700123123",
    "email": "alber@chpter.co"
  },
  "products": [
    {
      "product_name": "HoodEez",
      "quantity": 1,
      "unit_price": 1,
      "digital_link": "https://example.com/link"
    }
  ],
  "amount": {
    "currency": "KES",
    "delivery_fee": 0.00,
    "discount_fee": 0.00,
    "total": 100.00
  },
  "callback_details": {
    "transaction_reference": "1234",
    "success_url": "https://chpter.shop",
    "failed_url": "https://chpter.shop",
    "callback_url": "https://eozdpom307nca3.m.pipedream.net"
  }
}

Webhook / Callback Responses

Good to know: Use the Success key value on the response to check if the payment is successful or not.

Here are sample webhook/callback responses.

{
    "Message":"Successful",
    "Success": true,
    "Status": 200,
    "Amount": 100,
    "transaction_code": "fXC6SydcHe7Q8Lq7CF",
    "transaction_reference": "12345678901345644",
    
}

Last updated