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

Webhook verification and recovery

Configure the endpoint#

In your TLY Pay dashboard, open Integrations > Webhooks > Add Webhook. Enter Endpoint URL, submit, and save the credential from Save this signing Secret on your receiver. Existing signing Secrets are not shown in the Webhook list or detail. Open the Webhook detail and use Edit Webhook to change its URL or delivery status.
The API alternative is for automated integration setup: use a Key with webhook:bootstrap and call POST /v1/webhook-endpoints with Idempotency-Key and {"url":"https://merchant.example/webhooks/tly"}. This URL is illustrative. Use your real registered HTTPS domain, port 443, and no credentials, query string or fragment. The sender does not follow redirects.
Your account can have several Webhook endpoints, for example one for each website or plugin installation. Every active endpoint receives every payment.updated event of your account, including Payments created by other integrations and Payment Links. Each endpoint signs with its own Secret.
API setup finds or creates the endpoint for the submitted URL. If your account already has an endpoint with that URL, it is reused: its signing Secret is replaced by a new one, a pending rotation is discarded, and a disabled endpoint is enabled again. Both cases return 200 with resource_id and secret. Later deliveries are signed only with the new Secret, so save it on your receiver before relying on the endpoint.
Use a new Idempotency-Key for each setup intent and keep it only until you have saved the returned Secret. Retrying the same Key and URL shortly afterwards returns the same resource_id and secret; a later retry returns only resource_id. If you did not save the Secret, repeat the setup with a new Idempotency-Key to receive a new one. Reusing a Key with a different URL returns 409. Verify saved API setup credentials with POST /v1/webhook-endpoints/{webhook_endpoint_id}/verify and {"secret":"<WEBHOOK_SECRET>"}.
secret_kind identifies an active or pending signing Secret. For rotation, open the Webhook detail under Integrations > Webhooks, choose Rotate Secret > Generate new Secret, and save the new signing Secret. Update your receiver to accept the pending signing Secret, then choose Activate rotated Secret > Activate Secret. The old signing Secret stays active until this explicit switch; afterward the sender uses only the new active signing Secret. A bounded receiver overlap can accept requests already in flight with the old signature.

Verify before parsing or processing#

TLY Pay sends an event JSON object containing schema_version, event_id, event_type, occurred_at and data. The event is payment.updated; creation, first Checkout activation and disabling Checkout access do not emit it. Updates, accepted amount changes, payment outcomes, expiration, cancellation and review can emit it.
Each delivery carries:
To verify the signature, use the timestamp's exact ASCII bytes, a period byte, and the original HTTP body bytes. Use the complete trusted Webhook signing Secret, exactly as supplied, as the HMAC-SHA256 key. Do not parse the unverified body to select a Secret, and do not reserialize JSON before verifying it.
Choose max_skew_secs in your receiver configuration and pass the current trusted Unix time as now_secs. Your HTTP framework must retrieve these case-insensitive headers correctly.
Parse only the fields your integration needs and ignore unknown fields in the event and in data; optional fields can be added within schema_version "1". Events created before a field existed may omit it.
After verification, decide whether the event belongs to your integration (see the next section), durably record or enqueue it, deduplicate by event_id, and compare data.status_version only with the same Payment's stored version. Duplicate or stale facts must not overwrite newer facts. Return 2xx after accepting responsibility for the event. This example verifies the message only; it does not provide durable storage or fulfill an order.
The acknowledgment and business processing can happen separately after durable acceptance. HTTP 2xx acknowledges delivery, not a paid order. Use the authoritative Payment query when you need to recover missing payment facts.

Recognize your Payments#

Because every active endpoint receives all Payments of your account, decide ownership after verifying the signature and before storing the event. data.client_ref is the reference supplied when the Payment was created, or null. TLY Pay platform plugins generate one reference per installation, a two-letter platform code, _, and 20 characters from 0-9 and a-z (for example wc_ followed by 20 characters for WooCommerce), keep it across reconnections and send it as client_ref on POST /v1/payments. The same field is returned by GET /v1/payments/{payment_id} and POST /v1/payments/{payment_id}/cancel. Other integrations omit client_ref and identify their Payments by payment_id.
client_ref is present and is not yours: return 2xx and do not store the event.
client_ref is yours and you know the payment_id: process the event. If you have not recorded the Payment yet because your creation request is still in progress, return a retryable status such as 503 so the event is delivered again; if there is no such request, return 2xx and log the event.
client_ref is null or absent: look up data.payment_id in your own records and return 2xx without storing events for unknown Payments.

Delivery and recovery#

Each event is delivered to each active endpoint separately. Retries keep the event identity and envelope but use a new delivery timestamp and signature, with increasing intervals between attempts. HTTP 2xx acknowledges delivery. Network failures, 401, 403, 408, 425, 429 and 5xx receive finite retries; other non-2xx results are permanent failures. 401 and 403 are retried so that events still arrive while a reconnected integration is saving a new Secret. A redirect is not an acknowledgment.
When an endpoint keeps failing, TLY Pay backs off and sends it a single probe delivery at growing intervals until it accepts one. If it continues to fail for an extended period, the endpoint is disabled automatically, its waiting deliveries are paused and your dashboard shows a notice. To resume, fix the receiver and enable the endpoint with Edit Webhook, or repeat the API setup for the same URL.
When an endpoint is created, enabled again, its URL is changed, or its Secret is replaced by API setup, it also receives the latest payment.updated event of each recent Payment of your account. These events keep their original Event ID and status_version; deduplicate them like any other event. After a URL change, deliveries that are still waiting go to the new URL.
If a notification is missing, query GET /v1/payments/{payment_id} with payment:read. Querying does not change delivery state. Open Integrations > Webhook log, where each delivery is one event sent to one endpoint, select a delivery to inspect its status and attempts, and use Replay Delivery > Queue replay when you have permission to retry it. Replay is available for a finished delivery while its endpoint is active and is rate limited for each delivery. It queues the same event again for that endpoint, preserving its Event ID and original envelope. Delivery timestamps and signatures are generated for the new attempt. A queued replay is not proof that the receiver accepted it. Finished deliveries and their attempts stay in the Webhook log for 90 days; keep your own record if you need a longer history.
Associate an event with your integration using the verified Webhook signing Secret, client_ref and the Payment ID, order reference, source amount and status version. Never derive payment success from Webhook delivery success alone.
Previous
HTTP conventions and payment status
Next
Create a Payment
Built with