Payment Links

Create Payment Link

Changed on

Create a new payment link

post/payment-links

Request

  • The document declares no server URL.
  • Auth
    none declared. Required headers: ApiKey, MerchantId, Environment

Headers

ApiKeystring required

Your api key. To create a key, please get into our dashboard. If you don't have access to it, please reach the Support team.

MerchantIdstring required

Your merchant ID. This information is available in our dashboard. If you don't have access to it, please reach the Support team.

Environment'live' | 'sandbox' required

Allow you to choose between the sandbox mode to perform some tests or the live mode for real world transactions.

Request body

openAmountboolean

When true, the payer decides the amount at payment time. amount must be omitted when this is true.

amountnumber

Amount intended to be charged in the smallest currency unit. Required when openAmount is false or omitted.

minAmountnumber

Minimum amount the payer can enter (only relevant when openAmount is true).

maxAmountnumber

Maximum amount the payer can enter (only relevant when openAmount is true).

currencystring required

Three-letter ISO 4217 currency code

purchaseReferencestring required

Merchant reference for the payment (collection ID for multi_use links)

type'single_use' | 'multi_use' | 'bill_payment'

Defaults to single_use when omitted. multi_use allows multiple successful payments until optional maximumPayments or expiration.

maximumPaymentsnumber

Maximum successful payments for multi_use links. Omit for unlimited. Ignored for single_use (always one success).

providersstring[]

List of supported providers. Required unless paymentMethods is credit_card only: card always uses the merchant's configured card provider, never one listed here. Omit the field on a card-only link: an empty array is rejected with 400. Each name is at most 64 characters. A provider unknown in the country is rejected with 400; a known provider that is not enabled there for a method the link offers, or that the routing check refuses for the merchant, is left out of the link and missing from the response's providers; when none is left for mobile_money, the request is rejected with 400 wrong_provider. When the providers cannot be checked (the routing check does not answer, or is temporarily unavailable), the request is rejected with 503 provider_check_unavailable: retry later.

paymentMethodsstring[] required

Payment method. credit_card is rejected with 400 credit_card_provider_not_configured, credit_card_fees_not_supported or credit_card_provider_unavailable when the merchant cannot take card payments; mobile_money is rejected with 400 wrong_provider when none of the providers offers it in the country; a link offering neither mobile_money nor credit_card is rejected with 400 payment_method_not_supported.

countrystring required

Two-letter ISO 3166-1 alpha-2 country code

expirationDatestring

Expiration date for the payment link (default: 15 minutes from creation)

successUrlstring

URL to redirect to after successful payment

failureUrlstring

URL to redirect to after failed payment

customerPhoneNumberstring

Customer phone number for the payment (optional)

descriptionstring

Description for the payment (optional)

Example request

{
  "amount": 1000,
  "minAmount": 500,
  "maxAmount": 100000,
  "currency": "XOF",
  "purchaseReference": "ORDER-12345",
  "type": "multi_use",
  "maximumPayments": 50,
  "providers": [
    "orange",
    "mtn"
  ],
  "paymentMethods": [
    "mobile_money"
  ],
  "country": "CI",
  "expirationDate": "2025-10-15T14:30:00.000Z",
  "successUrl": "https://merchant.com/success",
  "failureUrl": "https://merchant.com/failure",
  "customerPhoneNumber": "12345678",
  "description": "Payment for order 1234567890",
  "customerFields": [
    {
      "fieldName": "national_id",
      "fieldLabel": "National ID"
    }
  ]
}

Response

Payment link created successfully

idstring required

Unique identifier for the payment link

urlstring required

URL for the payment link

status'active' | 'expired' | 'closed' | 'completed' required

Current status of the payment link

purchaseReferencestring required

Merchant reference for the payment

amountobject nullable required

Amount intended to be charged in the smallest currency unit. Null when openAmount is true.

openAmountboolean

When true, the payer decides the amount at payment time.

minAmountnumber

Minimum amount the payer can enter (only when openAmount is true).

maxAmountnumber

Maximum amount the payer can enter (only when openAmount is true).

currencystring required

Three-letter ISO 4217 currency code

maximumPaymentsnumber

Maximum successful payments allowed (omitted when unlimited multi_use)

currentSuccessCountnumber required

Number of successful payments recorded for this link

maximumAttemptsnumber required

Maximum number of failed payments allowed per user

createdAtstring required

Creation date in ISO 8601 format

updatedAtstring required

Last update date in ISO 8601 format

expirationDatestring required

Expiration date in ISO 8601 format

customerPhoneNumberstring required

Restricted MSISDN

type'single_use' | 'multi_use' | 'bill_payment' required

Type of the payment link

providersstring[]

Mobile money providers the link offers. A provider listed at creation that is not enabled in the country for a method the link offers, or that the routing check refused for the merchant, is missing here. Absent on a card-only link.

Example response

{
  "id": "pl_z1urYtVFgEebtcj8fxp4v",
  "url": "https://pay.hub2.com/pl_z1urYtVFgEebtcj8fxp4v",
  "status": "active",
  "purchaseReference": "ORDER-12345",
  "minAmount": 500,
  "maxAmount": 100000,
  "currency": "XOF",
  "maximumPayments": 50,
  "maximumAttempts": 3,
  "createdAt": "2024-01-15T12:00:00.000Z",
  "updatedAt": "2024-01-15T12:30:00.000Z",
  "expirationDate": "2024-01-15T14:30:00.000Z",
  "customerPhoneNumber": "123456789",
  "type": "single_use",
  "providers": [
    "orange",
    "mtn"
  ],
  "customerFields": [
    {
      "fieldName": "national_id",
      "fieldLabel": "National ID"
    }
  ]
}

Changes