---
title: "Generate link"
method: POST
path: "/api/channels/{entityId}/payments"
tags: ["Generate or cancel"]
---

# Generate link

`POST /api/channels/{entityId}/payments`

Generate a unique payment link for a transaction and optionally send this link to the recipient via email, SMS, WhatsApp, or a combination of the three.

For more information, see the [documentation](https://developer.peachpayments.com/docs/generate-link-1).

## Path parameters

- `entityId` string, required

## Request body

- GenerateLinkPayment
  - `payment` object, required — The payment object contains the payment details, files, and notes for the payment link.
    - `merchantInvoiceId` string, required — Invoice ID that can be used to link the payment to an invoice on the merchant's system.
    - `amount` number, required — Payment amount. An amount of 0 is only supported when the `paymentType` is `PA` and `tokeniseCard` is set to `true`.
    - `currency` 'ZAR' | 'KES' | 'USD', required — The currency code of the payment request amount (ISO 4217).
    - `files` string[] — Files to attach to the payment link.
    - `notes` string — A note to include with the payment link.
  - `customer` Customer, required — Optional object sent if customer data is required.
    - `email` string, email — The customer's email address.
    - `fax` string — The customer's fax number, if provided.
    - `givenName` string — The customer's first name or given name. Peach Payments recommends including the name so that it displays in the Peach Dashboard and is available for subsequent queries.
    - `surname` string — The customer's last name or surname. Peach Payments recommends including the surname so that it displays in the Peach Dashboard and is available for subsequent queries.
    - `mobile` string — The customer's mobile phone number.
    - `phone` string — The customer's phone number.
    - `ip` string — The customer's IP address.
    - `merchantCustomerLanguage` string — The language used for the customer on the merchant's site.
    - `status` string — Used to determine if this is a new or returning customer.
    - `merchantCustomerId` string — The customer's ID on the merchant's site.
    - `taxId` string — The customer's tax ID, if required.
    - `taxType` string — The customer's tax type, if required.
    - `birthDate` string — The customer's birth date.
    - `browser` object — The customer's browser details.
      - `acceptHeader` string — The value of the accept header sent from the customer's browser.
      - `language` string — The value representing the browser language as defined in IETF BCP47.
      - `screenHeight` string — The total height of the customer's screen in pixels.
      - `screenWidth` string — The total width of the customer's screen in pixels.
      - `timezone` string — The time-zone offset in minutes between UTC and the local time of the customer's browser.
      - `userAgent` string — The exact content of the HTTP user-agent header.
      - `javaEnabled` string — The boolean that represents the ability of the customer's browser to execute Java.
      - `javascriptEnabled` string — The boolean that represents the ability of the customer's browser to execute JavaScript.
      - `screenColorDepth` string — The value representing the bit depth of the colour palette for displaying images in bits per pixel.
      - `challengeWindow` string — The dimensions of the challenge window that has been displayed to the customer.
  - `options` PaymentOptions, required — The options object contains all the communication preferences for the payment link.
    - `sendEmail` boolean — Indicates whether to send an email to the customer after creating the payment link.
    - `sendSms` boolean — Indicates whether to send an SMS to the customer after creating the payment link.
    - `sendWhatsapp` boolean — Indicates whether to send a WhatsApp message to the customer after creating the payment link.
    - `emailCc` string — List of comma-separated email addresses to CC.
    - `emailBcc` string — List of comma-separated email addresses to BCC.
    - `expiryTime` integer — Time in minutes until the link expires. By default, expiry time is set to 30 days, which is also the maximum expiry time.
    - `notificationUrl` string — Peach Payments sends a webhook to this URL for any changes to this payment, overriding your default webhook.
  - `checkout` CheckoutOptions, required — The checkout object contains the default payment method and whether to tokenise the card number.
    - `defaultPaymentMethod` string, nullable — The default payment method to show when Checkout loads.
    - `forceDefaultMethod` boolean, nullable — Force the default payment method to be the only payment method.
    - `tokeniseCard` boolean — Tokenise the card number to allow it to be stored. You must get permission from your customer before tokenising their cards.
    - `paymentType` 'DB' | 'PA', nullable — The payment type for the request. Does not accept `RG`, but you can tokenise a card by performing a DB or PA with `tokeniseCard`. PA is only supported when `forceDefaultMethod` is set to `true` and `defaultPaymentMethod` is `CARD`. Following a PA, you can either [capture](https://developer.peachpayments.com/docs/card-manage-payments#capture-a-preauthorisation) or [reverse](https://developer.peachpayments.com/docs/card-manage-payments#reverse-a-preauthorisation) the PA. Refund transactions through the Dashboard or as described in the [documentation](https://developer.peachpayments.com/docs/checkout-refund).

## Response `200`

OK.

- GenerateLinkResponse
  - `url` string, required — Payment link.
  - `id` string, required — ID of payment link.

## Other responses

- `400` — Bad request.
- `401` — Request lacks valid authentication.

---

[API](https://skmtc.net/peachpayments/apis/checkout.md) · [All operations](https://skmtc.net/peachpayments/apis/checkout/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/peachpayments/checkout/revisions/3a98165665f8/schema)
