Creating payment link
POST /api/public/v1/payment_links
Creates a payment link and returns a hosted page URL to redirect your end user to. The end user selects a cryptocurrency and network on the hosted page; Txn then creates the child invoice or payout automatically.
Headers
Content-Type
application/vnd.api+json
Authorization
Bearer <api_key>
Request Body
data.type
string
Yes
Can only be payment_links.
data.attributes.amount
string
Yes
Payment amount to display to the end user.
data.attributes.currency
string
Yes
Display currency of the payment amount shown to the end user. Accepts any supported currency code — fiat or cryptocurrency. If currency is a display fiat currency (one that cannot be used directly as a settlement or funding account), accountCurrency must also be provided. See Supported Currencies.
data.attributes.paymentType
string
Yes
Invoice or Payout.
data.attributes.expires_at
string
Yes
ISO 8601 timestamp of when the payment link should expire, e.g. 2026-06-01T23:00:00.000Z.
data.attributes.accountCurrency
string
No
Merchant account currency for settlement (invoice payment links) or funding (payout payment links). Equivalent to targetCurrency on invoices and chargeCurrency on payouts. Must be a tradable fiat or cryptocurrency — display fiat currencies are not accepted. If omitted, defaults to currency, which must then itself be a tradable fiat or cryptocurrency. See Supported Currencies.
data.attributes.paymentMethods
array
No
Payment methods available on the hosted page. on_chain generates a deposit address for a direct on-chain transfer. binance_pay generates Binance Pay instructions. nft generates NFT purchase instructions. Defaults to ["on_chain"].
data.attributes.payCurrencies[]
array
No
Restrict which cryptocurrencies the end user can choose from on the hosted page. If omitted, all supported options are shown. See Supported Currencies.
data.attributes.reference
string
No
Your internal correlation key for this payment link. Must be unique per payment link.
data.attributes.successRedirectUrl
string
No
Invoice payment links only. URL to redirect the end user to after successful payment.
data.attributes.unsuccessRedirectUrl
string
No
Invoice payment links only. URL to redirect the end user to if the invoice expires, is cancelled, or rejected.
cURL
curl -X "POST" "https://api.sandbox.txn.io/api/public/v1/payment_links" \
-H 'Content-Type: application/vnd.api+json' \
-H 'Authorization: Bearer <api_key>' \
-d $'{
"data": {
"type": "payment_links",
"attributes": {
"amount": "100",
"currency": "EUR",
"accountCurrency": "EUR",
"reference": "8c40d8b6-ccdf-4861-a6d6-6c3125ce3f31",
"expires_at": "2026-06-01T23:00:00.000Z",
"paymentType": "Invoice",
"paymentMethods": ["on_chain"],
"payCurrencies": ["USDT", "BTC"],
"successRedirectUrl": "https://example.com/success",
"unsuccessRedirectUrl": "https://example.com/fail"
}
}
}'Response Body
data.id
string
Payment link ID.
data.type
string
Always paymentLinks.
data.attributes.amount
string
Payment amount displayed to the end user.
data.attributes.currency
string
Currency of the payment amount.
data.attributes.accountCurrency
string
Merchant account currency used for settlement or funding.
data.attributes.network
string
Network code selected by the end user on the hosted page. null until a selection is made.
data.attributes.networkName
string
Human-readable network name. null until the end user selects a network.
data.attributes.reference
string
Your internal correlation key, as set at creation.
data.attributes.hostedPageUrl
string
URL of the Txn-hosted page to redirect your end user to.
data.attributes.approvalStatus
string
Approval workflow status for payout payment links subject to an approval rule. null otherwise.
data.attributes.expiresAt
string
ISO 8601 timestamp of when the payment link expires.
data.attributes.createdAt
string
ISO 8601 timestamp of when the payment link was created.
data.attributes.paymentType
string
Invoice or Payout.
data.attributes.paymentMethods[]
array
Payment methods available on the hosted page.
data.attributes.successRedirectUrl
string
Success redirect URL. null if not set.
data.attributes.unsuccessRedirectUrl
string
Unsuccessful redirect URL. null if not set.
data.relationships.target.data
object
ID and type of the child invoice or payout. null until the end user selects a cryptocurrency on the hosted page.
Response
Duplicate reference.
Currency code in payCurrencies is not supported.
Last updated