Skip to content
SwapWalletDocs
فارسیGet an API key

Webhook deliveries

Each time SwapWallet sends an invoice-paid webhook, it records the request and your server's answer. Read an invoice's record to debug your endpoint, and resend the webhook once it's fixed.

SwapWallet retries failed deliveries on its own for about three days (see Webhook events), so you don't need to retry after a short outage.

The webhook delivery log object

An invoice's webhook status and every attempt to deliver it, with what was sent and what your server answered.

Attributes

  • statusenum

    Overall state of the webhook.

    Possible values

    • DISABLEDNeither the invoice nor your business has a webhook URL.
    • PENDINGNothing has been sent yet.
    • SUCCEEDAt least one attempt was delivered.
    • FAILEDEvery attempt so far has failed. SwapWallet may still be retrying.
  • callsarray of objects

    Every delivery attempt, oldest first.

    Show child attributesHide child attributes
    • requestIdUUID

      The requestId in this attempt's body. Each attempt has its own.

    • urlstring

      URL the request was sent to.

    • requestBodystring

      The exact JSON body that was sent, as a string.

    • responseBodystringnullable

      Your server's response body. Empty when there was no response.

    • statusinteger

      HTTP status your server returned, or -1 if it couldn't be reached or didn't answer within 10 seconds.

    • succeedboolean

      Whether this attempt counts as delivered: any response except a 4xx or 5xx status.

    • createdAtISO 8601 timestamp

      When the attempt finished.

The webhook delivery log object
{
  "status": "SUCCEED",
  "calls": [
    {
      "requestId": "560fc0fe-773f-46e4-8446-259ed7a9f6d0",
      "url": "https://pixelshop.example/webhooks/swapwallet",
      "requestBody": "{\"requestId\":\"560fc0fe-773f-46e4-8446-259ed7a9f6d0\",\"hmac\":\"f68377fb0576dbd1a37670acddf2ee1ce964ff312db26567af514f0a828708f9\",\"event\":{\"time\":\"2026-11-23T09:19:42.612394118Z\",\"type\":\"INVOICE\",\"invoice\":{\"id\":\"bcbb332e-0bf8-4da2-a42f-a75a0be6c36f\",\"supportCode\":\"AI-8LEYRQH-G8HM\",\"status\":\"PAID\",\"description\":\"Spotify Premium, 1 month\",\"customData\":\"{\\\"cartId\\\":\\\"c-88412\\\"}\",\"wallet\":null,\"ownerId\":905513,\"telegramInlineMessageId\":null,\"userLanguage\":\"FA\",\"returnUrl\":\"https://pixelshop.example/orders/1042\",\"webhookUrl\":\"https://pixelshop.example/webhooks/swapwallet\",\"orderId\":\"ORD-1042\",\"amount\":{\"number\":\"9.18\",\"unit\":\"USDT\"},\"value\":{\"number\":\"9.18\",\"unit\":\"USD\"},\"feePayer\":\"APPLICATION\",\"feeAmount\":{\"number\":\"0.0918\",\"unit\":\"USDT\"},\"paymentLinks\":[],\"paidAmount\":{\"number\":\"9.18\",\"unit\":\"USDT\"},\"paidAt\":\"2026-11-23T09:19:41.552904Z\",\"blockchainStatus\":\"CONFIRMED\",\"userId\":\"u-58213\",\"userEmail\":\"parsa@example.com\",\"userPhoneNumber\":\"+989123334455\",\"userTelegramId\":974181500,\"userDisplayName\":\"Parsa\",\"lockHours\":0,\"expiredAt\":\"2026-11-23T10:12:04.318227Z\",\"createdAt\":\"2026-11-23T09:12:04.318512Z\"}}}",
      "responseBody": "Service Unavailable",
      "status": 503,
      "succeed": false,
      "createdAt": "2026-11-23T09:19:42.731205Z"
    },
    {
      "requestId": "a7d0cb53-b035-44b4-b48e-4b04a59d5f97",
      "url": "https://pixelshop.example/webhooks/swapwallet",
      "requestBody": "{\"requestId\":\"a7d0cb53-b035-44b4-b48e-4b04a59d5f97\",\"hmac\":\"e14c8f2ae561e80d64faffc2274c823c2b0aedc4bb9e32918fafe991f6d43bf6\",\"event\":{\"time\":\"2026-11-23T09:20:43.004871392Z\",\"type\":\"INVOICE\",\"invoice\":{\"id\":\"bcbb332e-0bf8-4da2-a42f-a75a0be6c36f\",\"supportCode\":\"AI-8LEYRQH-G8HM\",\"status\":\"PAID\",\"description\":\"Spotify Premium, 1 month\",\"customData\":\"{\\\"cartId\\\":\\\"c-88412\\\"}\",\"wallet\":null,\"ownerId\":905513,\"telegramInlineMessageId\":null,\"userLanguage\":\"FA\",\"returnUrl\":\"https://pixelshop.example/orders/1042\",\"webhookUrl\":\"https://pixelshop.example/webhooks/swapwallet\",\"orderId\":\"ORD-1042\",\"amount\":{\"number\":\"9.18\",\"unit\":\"USDT\"},\"value\":{\"number\":\"9.18\",\"unit\":\"USD\"},\"feePayer\":\"APPLICATION\",\"feeAmount\":{\"number\":\"0.0918\",\"unit\":\"USDT\"},\"paymentLinks\":[],\"paidAmount\":{\"number\":\"9.18\",\"unit\":\"USDT\"},\"paidAt\":\"2026-11-23T09:19:41.552904Z\",\"blockchainStatus\":\"CONFIRMED\",\"userId\":\"u-58213\",\"userEmail\":\"parsa@example.com\",\"userPhoneNumber\":\"+989123334455\",\"userTelegramId\":974181500,\"userDisplayName\":\"Parsa\",\"lockHours\":0,\"expiredAt\":\"2026-11-23T10:12:04.318227Z\",\"createdAt\":\"2026-11-23T09:12:04.318512Z\"}}}",
      "responseBody": "{\"received\":true}",
      "status": 200,
      "succeed": true,
      "createdAt": "2026-11-23T09:20:43.118940Z"
    }
  ]
}

Retrieve webhook deliveries

GET/v1/merchants/invoices/{invoiceId}/webhook

Retrieves an invoice's webhook status and every delivery attempt, oldest first, with the body sent and your server's response.

Path parameters

  • invoiceIdUUIDRequired

    ID of the invoice.

Returns

Errors

  • 404INVOICE_NOT_FOUND

    Your business has no invoice with this ID.

GET/v1/merchants/invoices/{invoiceId}/webhook
curl https://swapwallet.app/api/v1/merchants/invoices/bcbb332e-0bf8-4da2-a42f-a75a0be6c36f/webhook \
  -H "Authorization: Bearer $SWAPWALLET_BUSINESS_KEY"
Response
{
  "status": "OK",
  "result": {
    "status": "SUCCEED",
    "calls": [
      {
        "requestId": "560fc0fe-773f-46e4-8446-259ed7a9f6d0",
        "url": "https://pixelshop.example/webhooks/swapwallet",
        "requestBody": "{\"requestId\":\"560fc0fe-773f-46e4-8446-259ed7a9f6d0\",\"hmac\":\"f68377fb0576dbd1a37670acddf2ee1ce964ff312db26567af514f0a828708f9\",\"event\":{\"time\":\"2026-11-23T09:19:42.612394118Z\",\"type\":\"INVOICE\",\"invoice\":{\"id\":\"bcbb332e-0bf8-4da2-a42f-a75a0be6c36f\",\"supportCode\":\"AI-8LEYRQH-G8HM\",\"status\":\"PAID\",\"description\":\"Spotify Premium, 1 month\",\"customData\":\"{\\\"cartId\\\":\\\"c-88412\\\"}\",\"wallet\":null,\"ownerId\":905513,\"telegramInlineMessageId\":null,\"userLanguage\":\"FA\",\"returnUrl\":\"https://pixelshop.example/orders/1042\",\"webhookUrl\":\"https://pixelshop.example/webhooks/swapwallet\",\"orderId\":\"ORD-1042\",\"amount\":{\"number\":\"9.18\",\"unit\":\"USDT\"},\"value\":{\"number\":\"9.18\",\"unit\":\"USD\"},\"feePayer\":\"APPLICATION\",\"feeAmount\":{\"number\":\"0.0918\",\"unit\":\"USDT\"},\"paymentLinks\":[],\"paidAmount\":{\"number\":\"9.18\",\"unit\":\"USDT\"},\"paidAt\":\"2026-11-23T09:19:41.552904Z\",\"blockchainStatus\":\"CONFIRMED\",\"userId\":\"u-58213\",\"userEmail\":\"parsa@example.com\",\"userPhoneNumber\":\"+989123334455\",\"userTelegramId\":974181500,\"userDisplayName\":\"Parsa\",\"lockHours\":0,\"expiredAt\":\"2026-11-23T10:12:04.318227Z\",\"createdAt\":\"2026-11-23T09:12:04.318512Z\"}}}",
        "responseBody": "Service Unavailable",
        "status": 503,
        "succeed": false,
        "createdAt": "2026-11-23T09:19:42.731205Z"
      },
      {
        "requestId": "a7d0cb53-b035-44b4-b48e-4b04a59d5f97",
        "url": "https://pixelshop.example/webhooks/swapwallet",
        "requestBody": "{\"requestId\":\"a7d0cb53-b035-44b4-b48e-4b04a59d5f97\",\"hmac\":\"e14c8f2ae561e80d64faffc2274c823c2b0aedc4bb9e32918fafe991f6d43bf6\",\"event\":{\"time\":\"2026-11-23T09:20:43.004871392Z\",\"type\":\"INVOICE\",\"invoice\":{\"id\":\"bcbb332e-0bf8-4da2-a42f-a75a0be6c36f\",\"supportCode\":\"AI-8LEYRQH-G8HM\",\"status\":\"PAID\",\"description\":\"Spotify Premium, 1 month\",\"customData\":\"{\\\"cartId\\\":\\\"c-88412\\\"}\",\"wallet\":null,\"ownerId\":905513,\"telegramInlineMessageId\":null,\"userLanguage\":\"FA\",\"returnUrl\":\"https://pixelshop.example/orders/1042\",\"webhookUrl\":\"https://pixelshop.example/webhooks/swapwallet\",\"orderId\":\"ORD-1042\",\"amount\":{\"number\":\"9.18\",\"unit\":\"USDT\"},\"value\":{\"number\":\"9.18\",\"unit\":\"USD\"},\"feePayer\":\"APPLICATION\",\"feeAmount\":{\"number\":\"0.0918\",\"unit\":\"USDT\"},\"paymentLinks\":[],\"paidAmount\":{\"number\":\"9.18\",\"unit\":\"USDT\"},\"paidAt\":\"2026-11-23T09:19:41.552904Z\",\"blockchainStatus\":\"CONFIRMED\",\"userId\":\"u-58213\",\"userEmail\":\"parsa@example.com\",\"userPhoneNumber\":\"+989123334455\",\"userTelegramId\":974181500,\"userDisplayName\":\"Parsa\",\"lockHours\":0,\"expiredAt\":\"2026-11-23T10:12:04.318227Z\",\"createdAt\":\"2026-11-23T09:12:04.318512Z\"}}}",
        "responseBody": "{\"received\":true}",
        "status": 200,
        "succeed": true,
        "createdAt": "2026-11-23T09:20:43.118940Z"
      }
    ]
  }
}

Retry a webhook delivery

POST/v1/merchants/invoices/{invoiceId}/webhook/retry

Queues a new delivery of the invoice's invoice-paid webhook, carrying the invoice as it is now. It works for any paid invoice, settled ones included, whether or not an earlier delivery succeeded.

If the new delivery fails, it's retried on the usual schedule. Check the outcome with Retrieve webhook deliveries.

Path parameters

  • invoiceIdUUIDRequired

    ID of the invoice.

Returns

Returns {"status": "OK"} once the delivery is queued.

Errors

  • 400APPLICATION_INVOICE_WEBHOOK_RETRY_NOT_ALLOWED

    The invoice isn't paid.

  • 404INVOICE_NOT_FOUND

    Your business has no invoice with this ID.

POST/v1/merchants/invoices/{invoiceId}/webhook/retry
curl -X POST https://swapwallet.app/api/v1/merchants/invoices/bcbb332e-0bf8-4da2-a42f-a75a0be6c36f/webhook/retry \
  -H "Authorization: Bearer $SWAPWALLET_BUSINESS_KEY"
Response
{
  "status": "OK"
}