Skip to main content

Create Payment Link

Generates a shareable link for collecting payments.

Authentication required (User JWT).

POST /api/merchants/:merchantId/payment-links

Path Parameters

ParameterTypeDescription
merchantIdStringThe ID of the parent merchant.

Request Body

{
"title": "Monthly Subscription Fee",
"description": "Payment for premium access - October",
"amount": 250000, // Optional: Integer (kobo/cents). Omit for variable amount.
"customSlug": "october-sub", // Optional: Alphanumeric, max 50 chars.
"isReusable": true, // Optional: boolean, defaults to false.
"redirectUrl": "https://yourdomain.com/payment-success" // Optional
}
FieldTypeRequiredDescription
titleStringYesName of the payment link, displayed to the customer.
descriptionStringNoAdditional details about the payment.
amountIntegerNoAmount in kobo/cents. If omitted, the customer can enter an amount.
customSlugStringNoUnique alphanumeric string for the link URL (/pay/{slug}). If omitted, a random one is generated.
isReusableBooleanNoIf true, the link can be paid multiple times. Defaults to false.
redirectUrlStringNoURL to redirect the customer to after a successful payment.

Response 201 Created

Returns the details of the newly created payment link.

{
"message": "Payment link created successfully",
"link": {
"id": "uuid-link-789",
"merchantId": "uuid-merchant-456",
"slug": "october-sub", // Or the generated slug
"title": "Monthly Subscription Fee",
"description": "Payment for premium access - October",
"amount": 250000,
"currency": "NGN",
"isActive": true,
"isReusable": true,
"redirectUrl": "https://yourdomain.com/payment-success",
"createdAt": "2023-10-27T11:00:00.000Z",
"updatedAt": "2023-10-27T11:00:00.000Z"
// Excludes the nested 'merchant' object
}
}

Errors

  • 400 Bad Request: Validation failed.
  • 401 Unauthorized: Invalid or missing JWT.
  • 404 Not Found: Merchant not found.
  • 409 Conflict: Custom slug already exists for this merchant.
  • 500 Internal Server Error