Generate customized payment links from invoices and send them directly to customers for payment. With payment links, you can instantly create mobile- and email-friendly payment requests with your accepted payment methods, branding, and invoice details. You can do this without having to build or host your own payment pages!

This guide covers how to create payment links via the API.

You can create payment links for invoices created via the API. If you create and send an invoice from PartnerHub or PayHub, a payment link is automatically created for the invoice.

When you create an invoice, you can send it to a customer for payment using a payment link.

Start

The process starts after an invoice is created.

1 Generate payment link

Create a payment link for the customer to use to make a payment.

2 Send payment link

Send the payment link to the customer.

3 (Optional)
Update payment link

You can update the payment link content as needed, then refresh it.

4 Customer pays

The customer completes the payment.

The general workflow for creating payment links via the API starts with an invoice.

  1. After you create an invoice, use the generate a payment link from an invoice endpoint to create a tailored payment link.
  2. Send the link to the customer with a call to the send payment link endpoint.
  3. If you need to edit the payment link, use the update payment link endpoint. After you update the payment link, send a request to refresh payment link to update the payment link for the customer.
  4. The customer pays the invoice.

Build the request

First, choose an endpoint. If you’re testing, use the Sandbox endpoint. for your target environment.

Authenticate

Authenticate by sending your API token in the request header with the key requestToken:
--header 'requestToken: API TOKEN'

Path parameter

This request has a required path parameter, idInvoice.

idInvoice
string
required

The ID for the invoice to generate a payment link for.

Query parameter

This request has query parameters.

mail2
string
required

List of recipient email addresses. When there is more than one, separate them by a semicolon (;).

amountFixed
boolean

Indicates whether customer can change the payment amount. A value of true means the amount isn’t modifiable, false means the payor can make changes.

Body parameter

This request requires a body. The body has several required parameters, so refer to the API reference for this endpoint.

Example Request

The example creates a payment link for the invoice with the id 329 and emails it to admin@example.com.

curl --request POST \
     --url 'https://api-sandbox.payabli.com/api/PaymentLink/329?mail2=admin%2540example.com&amountFixed=true' \
     --header 'accept: application/json' \
     --header 'content-type: application/*+json' \
     --header 'requestToken: <API TOKEN>' \
     --data '
{
  "logo": {
    "enabled": false
  },
  "page": {
    "enabled": true,
    "header": "My header",
    "description": "this is a header"
  },
  "paymentMethods": {
    "methods": {
      "visa": true,
      "mastercard": true,
      "applePay": true
      "eCheck": true
    },
    "enabled": true
  },
  "notes": {
    "enabled": true,
    "header": "Notes",
    "placeholder": "Placeholder",
    "value": "This is a pre-populated note"
  },
  "messageBeforePaying": {
    "enabled": true,
    "label": "Message before paying"
  },
  "paymentButton": {
    "enabled": true,
    "label": "MY PAYMENT BUTTON LABEL"
  },
  "review": {
    "enabled": true,
    "header": "Review header"
  },
  "contactUs": {
    "enabled": true,
    "header": "Contact us Header",
    "emailLabel": "Custom Email Content",
    "phoneLabel": "Custom Phone label",
    "paymentIcons": false
  },
  "settings": {
    "redirectAfterApprove": false
  }
}
'

Example response

A successful request returns a 200 response with a JSON body. The payLinkId that you need to manage this payment link via the API is returned as “responseData”.

Success response
{
  "responseText": "Success",
  "isSuccess": true,
  "responseData": "332-1e1e57af-7fd3-4264-803f-df40c277b704-1301"
}

A payment link’s URL is formed by the base URL, plus the entrypoint identifier, plus the payment link ID. For example: https://paypages-sandbox.payabli.com/paymentlink/exampleentrypoint/455-97d0d45e-6f58-44f4-8cab-e4fc197ebc15-1301 In this example the base URL is https://paypages.payabli.com/paymentlink/. The entrypoint ID here is exampleentrypoint, and the paylink ID is 455-97d0d45e-6f58-44f4-8cab-e4fc197ebc15-1301. If you are using custom subdomains, your base URL will be different.