---
title: "Creates a new payment link"
method: POST
path: "/v2/payment-links"
tags: ["PayByLink"]
---

# Creates a new payment link

`POST /v2/payment-links`

## Request

- Base URL: `https://docs.teya.com` (the document declares no server; this is the origin it was published from)
- URL: `https://docs.teya.com/v2/payment-links`
- Auth: one of:
  - OAuth 2
    - Authorization code: `https://id.teya.xyz/oauth/v2/oauth-authorize`
    - Client credentials
    - Token URL: `https://id.teya.xyz/oauth/v2/oauth-token`
  - OAuth 2
    - Authorization code: `https://id.teya.com/oauth/v2/oauth-authorize`
    - Client credentials
    - Token URL: `https://id.teya.com/oauth/v2/oauth-token`
- TypeScript: <https://skmtc.dev/teya/apis/teya-apis-for-external-plugins/docs/v2/payment-links/post.ts> (a function with typed inputs; its response is checked against the schema)

API to create a new payment link.
<br><strong>Access Token Required scope:</strong> payment-links/create

## Headers

- `Idempotency-Key` string, required: A unique key to identify the request. If the request is repeated with the same key, the same response will be returned. If the request is repeated with a different key or without a key, a new session will be created.
- `User-Agent` string, required

## Request body

- PblCreatePaymentLinkRequestV2: A request to create a payment link. When used with a user token, the field `store_id` is mandatory. When used with a terminal token, the field `delivery_info` is mandatory.
  - `amount` PblAmount, required: The transaction amount in the smallest currency unit according to ISO 4217 format. For example: - 100 ISK (Icelandic króna): the amount is 100 (since 1 ISK = 1 subunit). - 100 EUR (Euro): the amount is 10000 (since 1 EUR = 100 cents). - 100 USD (US Dollar): the amount is 10000 (since 1 USD = 100 cents). - 100 KWD (Kuwaiti Dinar): the amount is 100000 (since 1 KWD = 1000 fils).
    - `currency` 'AED' | 'AFN' | 'ALL' | 'AMD' | 'ANG' | 'AOA' | 'ARS' | 'AUD' | 'AWG' | 'AZN' | 'BAM' | 'BBD' | 'BDT' | 'BGN' | 'BHD' | 'BIF' | 'BMD' | 'BND' | 'BOB' | 'BOV' | 'BRL' | 'BSD' | 'BTN' | 'BWP' | 'BYN' | 'BYR' | 'BZD' | 'CAD' | 'CDF' | 'CHE' | 'CHF' | 'CHW' | 'CLF' | 'CLP' | 'CNY' | 'COP' | 'COU' | 'CRC' | 'CUC' | 'CUP' | 'CVE' | 'CZK' | 'DJF' | 'DKK' | 'DOP' | 'DZD' | 'EGP' | 'ERN' | 'ETB' | 'EUR' | 'FJD' | 'FKP' | 'GBP' | 'GEL' | 'GHS' | 'GIP' | 'GMD' | 'GNF' | 'GTQ' | 'GYD' | 'HKD' | 'HNL' | 'HRK' | 'HTG' | 'HUF' | 'IDR' | 'ILS' | 'INR' | 'IQD' | 'IRR' | 'ISK' | 'JMD' | 'JOD' | 'JPY' | 'KES' | 'KGS' | 'KHR' | 'KMF' | 'KPW' | 'KRW' | 'KWD' | 'KYD' | 'KZT' | 'LAK' | 'LBP' | 'LKR' | 'LRD' | 'LSL' | 'LYD' | 'MAD' | 'MDL' | 'MGA' | 'MKD' | 'MMK' | 'MNT' | 'MOP' | 'MRO' | 'MRU' | 'MUR' | 'MVR' | 'MWK' | 'MXN' | 'MXV' | 'MYR' | 'MZN' | 'NAD' | 'NGN' | 'NIO' | 'NOK' | 'NPR' | 'NZD' | 'OMR' | 'PAB' | 'PEN' | 'PGK' | 'PHP' | 'PKR' | 'PLN' | 'PYG' | 'QAR' | 'RON' | 'RSD' | 'RUB' | 'RWF' | 'SAR' | 'SBD' | 'SCR' | 'SDG' | 'SEK' | 'SGD' | 'SHP' | 'SLE' | 'SLL' | 'SOS' | 'SRD' | 'SSP' | 'STD' | 'STN' | 'SVC' | 'SYP' | 'SZL' | 'THB' | 'TJS' | 'TMT' | 'TND' | 'TOP' | 'TRY' | 'TTD' | 'TWD' | 'TZS' | 'UAH' | 'UGX' | 'USD' | 'USN' | 'UYI' | 'UYU' | 'UZS' | 'VED' | 'VEF' | 'VES' | 'VND' | 'VUV' | 'WST' | 'XAF' | 'XCD' | 'XCG' | 'XOF' | 'XPF' | 'YER' | 'ZAR' | 'ZMW' | 'ZWL', enum, required: Currency code (e.g. `USD`, `GBP`, `EUR`) following ISO-4217 format.
    - `value` integer, required: The transaction amount in the smallest currency unit according to ISO 4217 format.
  - `billing_address` PblAddressDto: An address
    - `city` string: City name
    - `country` string, required: ISO-3166-1 alpha2 country code
    - `state` string: State or province
    - `street_address_line1` string: Street address line 1
    - `street_address_line2` string: Street address line 2
    - `street_address_line3` string: Street address line 3
    - `zipcode` string: Postal/ZIP code
  - `cancel_url` string: URL to redirect the customer once the transaction has finished with error or cancellation (must use HTTPS)
  - `customer` PblCustomer
    - `email` string: Customer email address
    - `name` string: Customer name, used to prefill the hosted checkout form
    - `phone_number` string: Customer phone number. An international phone number including the country code, formatted according to the E.164 standard.
  - `customer_success_email` string: If present, an email is sent to the customer upon successful payment with the receipt.
  - `delivery_info` PblDeliveryInfo
    - `email` string: Email address to send the payment link to
    - `phone_number` string: An international phone number including the country code, formatted according to the E.164 standard. This is the phone number that we will use to share the payment link via SMS
  - `expires_at` string, date-time: Date when the link will be considered expired in ISO 8601 format. If not provided, the payment link will not have an expiry date.
  - `language` string: The language that will be used to notify the client. It follows IETF BCP 47 and: - If provided, it should match any of the supported languages: en-GB, hu-HU, is-IS, cs-CZ, hr-HR, sk-SK, pt-PT, pt-BR, de-DE, es-ES, fr-FR, it-IT, pl-PL If it's different, the request will be rejected with BAD_REQUEST - If not provided, the merchant language will be used
  - `line_items` PblPaymentLinkLineItem[]: Basket information to be shown in payment page
    - `description` string, required: This a description for a item in the basket
    - `quantity` integer, required: The number of items, Must be a positive value
    - `unit_price` integer, required: The price of a single item including VAT, Can be negative for discounts
  - `merchant_reference` string: An identifier that can be used to reference the transaction on the merchant's side. Overrides 'source_reference_id
  - `merchant_success_email` string: If present, an email is sent to the merchant upon successful payment with the receipt.
  - `metadata` object: Metadata key-value pairs. Maximum 10 keys allowed. Keys must not exceed 40 characters and values must not exceed 500 characters.
  - `post_success_payment` 'SHOW_SUCCESS_PAGE' | 'REDIRECT', enum: Defines the behavior after a successful payment. SHOW_SUCCESS_PAGE displays a success page, REDIRECT redirects to the success_url.
  - `required_customer_fields` string[]: Customer fields that must be collected during checkout
  - `store_id` string, uuid: The unique identifier of a store
  - `success_url` string: URL to redirect the customer once the transaction has successfully finished (must use HTTPS)
  - `supported_card_brands` string[]: Array of supported card brands. If null, defaults to all card brands enabled for the store.
  - `supported_payment_methods` string[]: Array of supported payment methods. If null, defaults to all payment methods enabled for the store.
  - `transaction_type` 'SALE' | 'ACCOUNT_VERIFICATION', enum: Indicates the transaction type. Default is SALE. Use SALE for standard payments or ACCOUNT_VERIFICATION to verify a card and optionally tokenize it without charging the customer.
  - `type` 'SINGLE_USE', enum: Indicates the payment link type. Default is SINGLE_USE.

## Response `201`

New payment link has been created

- PblCreatePaymentLinkResponse: The created payment link information
  - `payment_link` string, url: The created payment link
  - `payment_link_id` string, uuid, required: A unique identifier for the created payment link

## Other responses

- `400`: Bad request
- `401`: Lacks valid authentication credentials for the requested resource
- `403`: The server understands the request but refuses to authorise it
- `429`: Too many requests in a given amount of time
- `500`: Internal Server Error

---

[API](https://skmtc.dev/teya/apis/teya-apis-for-external-plugins.md) - [All operations](https://skmtc.dev/teya/apis/teya-apis-for-external-plugins/llms.txt) - [OpenAPI document](https://skmtc.dev/teya/apis/teya-apis-for-external-plugins/revisions/e26c4d895fa7?raw)
