1. TLY Pay API
English
  • English
  • 简体中文
  • TLY Pay API
    • Getting started
    • HTTP conventions and payment status
    • Webhook verification and recovery
    • Payment integration
      • Create a Payment
      • Get Payment status
      • Cancel a Payment
      • Disable Checkout access
      • Check pricing configuration
      • Configure a Webhook endpoint
      • Verify a Webhook signing Secret
  • Schemas
    • CreatePayment
    • CreatedPayment
    • ErrorResponse
    • BootstrapWebhook
    • MerchantPaymentView
    • MerchantStoreSourceView
    • MerchantStoreAssetView
    • OneTimeSecretResponse
    • SourceAmount
    • MerchantStoreView
    • MerchantSourceAmountView
    • VerifyWebhookBinding
    • WebhookBindingView
  1. TLY Pay API

Getting started

This reference is for developers integrating TLY Pay payments into their applications. Use the TLY Pay API from your server to create a Payment, open Hosted or Embedded Checkout, and reconcile the result through a signed Webhook or an authoritative query.
The API and app use Payment for the payment record, shown under Payments. The app's Create Payment Link action creates a Payment Link for opening Hosted Checkout. Your customers pay through Hosted or Embedded Checkout. Both use the same Payment.

Choose your integration#

If you use a platform plugin, follow its connection instructions under Integrations > Platforms. The WooCommerce plugin manages its own Checkout integration; you do not need to implement the script below. Connecting that plugin does not automatically fill Website (optional).
For a custom integration, choose how customers open Checkout:
Hosted CheckoutEmbedded Checkout
Customer experienceOpen the supplied Checkout pageOpen a payment overlay on your website
Website settingOptional, used for the merchant website linkOptional, used for the merchant website link
Create requestOmit checkout_originSet checkout_origin to the HTTPS origin of the page that opens the Widget
Browser integrationOpen /#payment_id=<payment_id> on the Checkout originLoad the Widget once and call CryptoPay.open
There is no separate Embedded enable switch: your server selects the presentation when creating each Payment. The Embedded preview in the app shows its appearance, not whether your website integration is ready.

Set up your TLY Pay account#

The following action names match the English app interface:
1.
Sign in and complete account registration.
2.
Open Settings > Payment settings. If you have no verified receiving wallet, choose Connect a Wallet, name your Wallet, and approve the connection once in TLY Wallet. Verification completes automatically. A wallet already connected and verified can be reused. Display currency changes only how estimated Wallet values are displayed; it does not change Payment pricing or accepted payment assets.
3.
Open Checkout. In Enabled networks and currencies, confirm which currencies are enabled for the verified wallet. These are the currencies customers can pay with.
4.
Website (optional) on the same Checkout page adds a link to your website for customers. Neither presentation requires it.
5.
Open Integrations > API keys and choose Issue API Key. This action issues the standard scopes below. Save the credential from Save this API Key; existing credentials cannot be revealed again.
6.
If using payment notifications, prepare your receiver, then open Integrations > Webhooks > Add Webhook, enter the receiver's public HTTPS URL, and save the signing Secret. Use the separate Webhook guide for verification and rotation.
Wallet connection requires TLY Wallet for approval and proof of control. Your integration server and customers do not use your wallet credentials. Reading wallet balances and addresses does not require the extension.
The standard API Key scopes are:
payment:write: create or cancel Payments and disable Checkout access.
payment:read: query payment status and verify pricing configuration.
webhook:bootstrap: configure a Webhook endpoint and verify its signing Secret.
Keep API Keys and Webhook signing Secrets on your server. Use Authorization: Bearer <API_KEY>; never put an API Key in browser code, a URL, screenshots or logs. Your plan sets how many active API Keys you can have: Free includes 1 and Business 5. Each connected website, plugin or app uses one. To replace a Key, issue a new one, deploy and verify it, and revoke the old one in your TLY Pay dashboard; on Free, revoke the old Key first, which stops API calls until the new Key is deployed.
TLY Pay provides the API, Hosted Checkout and the Embedded Checkout script. Examples use your server-side TLY_API_ORIGIN and TLY_API_KEY configuration. Set TLY_API_ORIGIN to https://api.tlypay.com.

Platform addresses#

PurposeAddress
Server-side APIhttps://api.tlypay.com
Hosted Checkouthttps://pay.tlypay.com
Embedded Checkout scripthttps://pay.tlypay.com/widget/crypto-pay.js
Keep your API Key on your server. Your website loads the script from TLY Pay; you do not need to build, download or host crypto-pay.js. Your own application only implements order creation and the call that opens Checkout.

Check pricing and create a Payment#

Read GET /v1/store with your API Key to verify the configured pricing source and website domain before building the request. Use the returned primary_source kind, ref and decimals to construct source_amount. Do not infer Payment pricing from Display currency or from the asset your customer will pay with. payments_ready is true once the Store has a verified wallet with at least one enabled network; hide the payment method while it is false and re-check periodically, because creating a Payment fails until the Store is ready. payment_assets lists the assets your customers can pay with right now (symbol, name and enabled network names); cache it with the readiness check and show the symbols next to the payment method.
curl --request POST "${TLY_API_ORIGIN}/v1/payments" \
  --header "Authorization: Bearer ${TLY_API_KEY}" \
  --header "Content-Type: application/json" \
  --header "Idempotency-Key: order-example-1048" \
  --data '{"order_ref":"ORDER-EXAMPLE-1048","source_amount":{"kind":"fiat","currency":"USD","amount_raw":"12800"}}'
All values are illustrative. source_amount must match your configured primary pricing source. USD 12800 means USD 128.00. Use positive integer strings without leading zeros, not floating-point numbers. The service determines decimals. For crypto pricing, provide kind: "crypto", your configured pricing_ref, and amount_raw; do not substitute a token contract address or a network ID for a pricing ref.
order_ref is optional and is not a unique key. Keep one Idempotency-Key for each creation intent and reuse both that Key and the same request body after a timeout. A successful create or identical replay returns HTTP 200, not 201. Creating a Payment does not mark the order paid.
Omit client_ref unless you are a TLY Pay platform plugin; plugins send their installation reference so they can recognize their own Payments in Webhooks, as described in the Webhook guide.
Save the returned payment_id with your order. Use it to open Checkout, query payment status and identify the Payment when contacting support. You and your customers use the same ID, which can be displayed and copied. Checkout remains subject to website authorization, risk checks, expiry and access restrictions. Queries and changes from your server require your API Key.

Open Checkout and reconcile the order#

Hosted Checkout#

Create the Payment without checkout_origin. Open https://pay.tlypay.com/#payment_id=<payment_id>, replacing <payment_id> with the returned ID. The app's Create Payment Link action also creates Hosted Payments. Customers do not need to remain on your website to pay. Set the optional return_url to a page of your website, such as the order confirmation, and Checkout shows a button that returns your customer there once the Payment is paid; it never redirects automatically.

Embedded Checkout: choose the origin#

1.
Decide which HTTPS origin of your website opens the Widget: scheme, host and port, without a path, query, fragment or login details. Any origin of your own website is accepted; no website registration is required.
2.
Your server must supply that exact origin as checkout_origin when creating the Payment. TLY Pay records it on the Payment, and the Widget can only be opened from that origin: https://shop.example.com does not permit https://www.example.com, https://shop.example.com:8443 or a plain http:// page. The hosted Checkout origin is not accepted. Use your server's trusted configuration, not an unchecked value supplied by the browser.
Omitting checkout_origin still creates a Hosted Payment. The origin is fixed when the Payment is created and returned as checkout_origin by GET /v1/payments/{payment_id} (null for Hosted Payments). An Embedded Payment can also be completed on the Hosted Checkout page (a plugin uses it as its fallback when the Widget is unavailable); a Hosted Payment cannot be opened in the Embedded Widget.

Embedded Checkout: create the Payment on your server#

Add checkout_origin to the same creation request used above. This illustrative request assumes USD is your configured pricing source; replace the website, order and amount with your own validated values.
{
  "order_ref": "ORDER-EXAMPLE-1048",
  "source_amount": { "kind": "fiat", "currency": "USD", "amount_raw": "12800" },
  "checkout_origin": "https://shop.example.com"
}
Send this body to POST /v1/payments with your server-side API Key and an Idempotency-Key. Save the returned payment_id against the order and pass only that ID to your browser application. Retrying this creation intent must reuse the same body and idempotency key.

Embedded Checkout: load and open the Widget#

Load the platform-managed Widget once in your document shell, before your application's deferred script. Use the complete TLY Pay script URL below. /your-checkout-integration.js represents your own application code, containing the openPayment function below and your Pay button handler; replace that example path with your application's script path.
Your application's integration script can define the following action. Supply the Payment ID returned by your server and a positive action timeout from your application configuration. Call it from your Pay button, disable that button while it is pending, and display a retryable error if it rejects.
open accepts only { paymentId }. Do not pass API Keys, amount overrides, a runtime API URL or a payment-success callback. A resolved open() means the overlay has mounted, not that the payment session is ready or the order has been paid.
Use window.CryptoPay.close() when your integration needs to dismiss the overlay. Closing does not cancel the Payment. A document supports one active Widget: opening another Payment closes the previous overlay. Coordinate calls across page components; do not load the script again during client-side navigation. If you use a dynamic loader instead, share one pending load, impose a load timeout and allow explicit retry after failure. Do not use an iframe.
If your website uses Content Security Policy, permit https://pay.tlypay.com in script-src and connect-src, and https://cdn.tlypay.com in img-src. Wallet-specific connections may require additional provider origins; allow only the providers used by your integration. Do not disable your site's CSP to make the Widget load.

Handle integration failures#

SymptomWhat to check
Creation rejects checkout_originThe value is an HTTPS origin without a path, query, fragment or login details, and it is not the hosted Checkout origin
Script fails to load or the Widget global is unavailableUse https://pay.tlypay.com/widget/crypto-pay.js, allow the platform origin in CSP, load the script once, then reload and retry
Overlay cannot access the PaymentConfirm the page origin equals the Payment's checkout_origin, and check expiry and access through your server; do not infer the cause from a generic browser authentication error
Browser closes or loses connectionQuery the existing Payment from your server; do not create another Payment solely because the overlay closed

Confirm the payment on your server#

Configure a signed payment.updated Webhook, or query GET /v1/payments/{payment_id} from your server with payment:read. Query responses describe authoritative payment facts. A browser redirect or Webhook delivery result is not a payment receipt.
Only fulfill an order according to the authoritative status and your exception policy. Handle partial payments, overpayments and review-required payments explicitly. Webhooks can be duplicated or arrive out of order; use the event identity and the Payment's status_version as described in the Webhook guide.
The Webhook exchange is optional when your integration uses authoritative queries instead. A state event can describe an incomplete or exceptional payment; receiving it is not by itself a reason to fulfill an order. Hosted Checkout and Embedded Checkout use the same payment facts.

Optional operations#

Cancel an open, unexpired Payment with no accepted or confirming funds using POST /v1/payments/{payment_id}/cancel. Repeating a successful cancellation reads the current state.
Disable Checkout access using DELETE /v1/payments/{payment_id}/consumer-access. Customers will no longer be able to access this Payment through Checkout. Its payment status is unchanged; you can still query the Payment from your server.
Use GET /v1/store to verify the API Key's configured pricing source and website domain.
API Key management is under Integrations > API keys. Wallet connection and Display currency are under Settings > Payment settings; Enabled networks and currencies and Website (optional) are under Checkout. Webhook management is under Integrations > Webhooks.
Next
HTTP conventions and payment status
Built with