API Integration
Payment Links use the HUB2 API. The available endpoints are listed in the following documentation:API Payment Links
Authentication
Your integration uses the same HUB2 API keys for authentication. The key must have the following permissions:Api.payment_intent_create: create and close payment linksApi.payment_intent_read: retrieve and list payment links
Permissions configuration
API Endpoints
Payment Link
POST /payment-links: create a payment link and define the accepted payment methods and providers. The payment intent and the payment are created as the customer goes through the payment page. Example:
typedefaults tosingle_use(one successful payment). Usemulti_useto accept several payments, optionally capped withmaximumPayments.- When
expirationDateis omitted or already in the past, the link expires 15 minutes after creation. successUrlandfailureUrlmust use thehttpsscheme.
PATCH /payment-links/{id}/close: close a payment link before it expiresGET /payment-links: list the payment links you createdGET /payment-links/{id}: retrieve a payment link with its payment attempts
Rate limits per endpoint:
POST /payment-links: 100 requests per 10 secondsGET /payment-links/{id}: 1 request per secondGET /payment-links: 1 request per 5 secondsPATCH /payment-links/{id}/close: 1 request per second
HTTP 429 Too Many Requests.Card payments
A link offers card payments whenpaymentMethods contains credit_card. Card payments always use the card provider configured for your merchant account, so providers never lists a card provider. Your account must have card payments enabled: see Card payments in the configuration guide.
For a card-only link, omit providers. An empty array is rejected with 400:
providers for mobile money:
successUrl or failureUrl if you set them.
A creation request that cannot be accepted returns 400 with a body containing status, code, message and request_id. Use code to decide what to do:
A request that includes
mobile_money without providers is also rejected with 400. Only a card-only link can omit them. A provider name that is unknown in the country is rejected with 400 and the code Bad Request, and each name is at most 64 characters. A known provider that is not enabled for the link’s payment methods, or not available to your account, is left out of the link and missing from the providers of the response.
If the providers cannot be checked, the API returns 503 with the code provider_check_unavailable. Retry the request later.
Webhooks
Payments made through a link trigger the usualpayment.* and payment_intent.* webhooks. Payment links also have their own events: payment_links.created, payment_links.paid, payment_links.completed, payment_links.expired and payment_links.closed. If you have already configured webhooks for payments, no additional step is required. Otherwise, see:
