Skip to main content
POST
/
api
/
canary
/
payment-links
Create Payment Link
curl --request POST \
  --url http://localhost:3000/api/canary/payment-links \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "currency": "<string>",
  "mode": "<string>",
  "successUrl": "<string>",
  "cancelUrl": "<string>",
  "metadata": {
    "customField": "value",
    "orderId": "12345"
  },
  "merchantId": "<string>",
  "productId": "<string>",
  "customerId": "<string>",
  "amount": 123
}
'
{
  "id": "plink_001",
  "merchantId": "merchant_456",
  "url": "https://pay.cashful.africa/link/plink_001",
  "productId": "product_001",
  "amount": 15000,
  "currency": "ZAR",
  "mode": "payment",
  "active": true,
  "successUrl": "https://example.com/success",
  "cancelUrl": "https://example.com/cancel",
  "metadata": {
    "campaign": "summer_sale"
  },
  "createdAt": "2025-01-15T10:30:00.000Z",
  "updatedAt": "2025-01-15T10:30:00.000Z"
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

application/json

Payment link details

currency
string
required

The three-letter ISO 4217 currency code

mode
string
required

The payment mode (e.g., 'payment' or 'subscription')

successUrl
string
required

The URL to redirect to on successful payment

cancelUrl
string
required

The URL to redirect to if customer cancels

metadata
object
required

Optional custom metadata

Example:
{
"customField": "value",
"orderId": "12345"
}
merchantId
string

The ID of the merchant whose balance is being requested. If omitted, defaults to the authenticated merchant.

productId
string

The unique identifier of the product

customerId
string

The unique identifier of the customer

amount
number

The amount in the smallest currency unit

Response

Payment link created successfully

id
string
required
merchantId
string
required
url
string
required
currency
string
required
mode
string
required
active
boolean
required
successUrl
string
required
cancelUrl
string
required
metadata
object
required
Example:
{ "customField": "value" }
createdAt
string<date-time>
required
updatedAt
string<date-time>
required
productId
string
customerId
string
amount
number