PayAgency Logo
PaymentLink

Payment Link API

The Payment Link API allows users to create encrypted payment links with optional parameters like amount, currency, expiry date, and terminal. It returns a secure URL that customers can use to make payments.


API Endpoint

POST https://backend.pay.agency/api/v1/payment-link

Request Body Parameters

ParameterTypeRequiredDescription
payment_template_idStringYesID of the payment template to use for this link.
amountNumberNoPayment amount.
currencyStringNoCurrency code (e.g., USD, INR).
expiry_dateStringNoExpiry date must be in yyyy-mm-dd format.
terminal_idStringNoTerminal ID to route the transaction through a specific connector.
order_idStringNoUnique order from merchant side

Headers

Header NameDescription
Content-TypeSet to application/json.
AuthorizationBearer token (your Secret key or Test key).

Environment Behavior

The behavior of the API response depends on the type of key used in the Authorization header:

  • If you provide a Test key, the API will return a test payment link (prefixed with /test).
  • If you provide a Secret key, the API will return a live payment link (prefixed with /live).

This allows you to safely test integrations before going live.


Success Response

If the payment link is created successfully, the API returns the secure link:

{
  "message": "Payment link created successfully.",
  "data": "https://portal.pay.agency/link/TEMPLATE123/PLK7923412397/live?encrypted_config=ENCRYPTED_STRING"
}

Error Response

{
  "message": "Invalid Payment Template ID or Connector Terminal ID."
}

On this page