PayByLink

Creates a new payment link

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

post/v2/payment-links

Request

  • Base URL
    https://docs.teya.com (the document declares no server; this is the origin it was published from)
  • Auth
    • OAuth 2
      Authorization codehttps://id.teya.xyz/oauth/v2/oauth-authorize
      Client credentials
      Token URLhttps://id.teya.xyz/oauth/v2/oauth-token
    • or OAuth 2
      Authorization codehttps://id.teya.com/oauth/v2/oauth-authorize
      Client credentials
      Token URLhttps://id.teya.com/oauth/v2/oauth-token
  • TypeScript
    A function with typed inputs. Its response is checked against the schema.

Headers

Idempotency-Keystring 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-Agentstring required
Example:YourCompany-Integration/1.0

Identifies your integration, for example YourCompany-Integration/1.0. Requests without a User-Agent can be blocked by our firewall before they reach the API.

Request body

cancel_urlstring

URL to redirect the customer once the transaction has finished with error or cancellation (must use HTTPS)

customer_success_emailstring

If present, an email is sent to the customer upon successful payment with the receipt.

expires_atstring 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.

languagestring

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
merchant_referencestring

An identifier that can be used to reference the transaction on the merchant's side. Overrides 'source_reference_id

merchant_success_emailstring

If present, an email is sent to the merchant upon successful payment with the receipt.

metadataobject

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_fieldsstring[]

Customer fields that must be collected during checkout

store_idstring uuid

The unique identifier of a store

success_urlstring

URL to redirect the customer once the transaction has successfully finished (must use HTTPS)

supported_card_brandsstring[]

Array of supported card brands. If null, defaults to all card brands enabled for the store.

supported_payment_methodsstring[]

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.

Example request

{
  "amount": {
    "currency": "USD",
    "value": 100
  },
  "billing_address": {
    "city": "London",
    "country": "GB",
    "street_address_line1": "Main Street",
    "zipcode": "SW1A1AA"
  },
  "cancel_url": "https://mywebsite.com/checkout/cart",
  "customer": {
    "email": "emailaddress@example.com",
    "name": "John Doe",
    "phone_number": "+447911123456"
  },
  "customer_success_email": "john.doe@example.com",
  "delivery_info": {
    "email": "emailaddress@example.com",
    "phone_number": "+447700900123"
  },
  "expires_at": "2024-07-03T13:37:58.709Z",
  "language": "en-GB",
  "line_items": [
    {
      "description": "Product 1",
      "quantity": 1,
      "unit_price": 100
    }
  ],
  "merchant_reference": "12345678",
  "merchant_success_email": "merchant@example.com",
  "metadata": {
    "order_id": "12345",
    "table_number": "5"
  },
  "post_success_payment": "REDIRECT",
  "required_customer_fields": [
    "EMAIL",
    "PHONE"
  ],
  "store_id": "f47ac10b-58cc-4372-a567-0e02b2c3d479",
  "success_url": "https://mywebsite.com/checkout/success",
  "supported_card_brands": [
    "VISA",
    "MASTERCARD"
  ],
  "supported_payment_methods": [
    "CARD",
    "APPLE_PAY"
  ],
  "transaction_type": "SALE",
  "type": "SINGLE_USE"
}

Response

New payment link has been created

payment_linkstring url

The created payment link

payment_link_idstring uuid required

A unique identifier for the created payment link

Example response

{
  "payment_link": "https://pbl.teya.com/20eb276c-5b6b-4474-a5a1-49bcd6193148",
  "payment_link_id": "20eb276c-5b6b-4474-a5a1-49bcd6193148"
}

Changes

No recorded changes to this operation across all 1 revision of this API.