Storrik LogoStorrik Docs
APIWebhooks

Webhook Overview

Learn how to use webhooks on storrik

Webhooks

Storrik sends webhook events to notify your system about transaction lifecycle changes. Each webhook is delivered as a signed HTTP POST request with a JSON payload.

All transaction webhooks share the same envelope format and differ only by type and the transaction state.


Common Webhook Envelope

All webhook events follow this structure:

{
  "id": "evt_xxx",
  "object": "event",
  "type": "transaction.created",
  "api_version": "2025-11-07.alpha",
  "created": 1768293724,
  "livemode": false,
  "data": {
    "object": { ... }
  }
}

Envelope Fields

FieldTypeDescription
idstringUnique event ID
objectstringAlways "event"
typestringEvent type
api_versionstringAPI version used
creatednumberUnix timestamp (seconds)
livemodebooleanWhether event was generated in live mode
data.objectobjectThe resource associated with the event

Transaction Object

Both transaction.created and transaction.succeeded include a transaction object.

{
  "id": "txn_xxx",
  "object": "transaction",
  "status": "incomplete",
  "amounts": {
    "gross": 3400,
    "tax": 0,
    "discount": 0,
    "net": 3400,
    "currency": "USD"
  },
  "customer": {
    "id": "CUS_xxx",
    "email": "customer@example.com",
    "country": "US"
  },
  "items": {
    "product_id": "prod_xxx",
    "variant_id": "var_xxx"
  },
  "tax": {
    "collected": false,
    "amount_cents": 0
  },
  "metadata": {},
  "created": 1768293724
}

Transaction Fields

FieldTypeDescription
idstringTransaction ID
objectstringAlways "transaction"
statusstringCurrent transaction state
amounts.grossnumberTotal amount before fees and tax (cents)
amounts.taxnumberTax amount collected (cents)
amounts.discountnumberDiscount applied (cents)
amounts.netnumberNet amount after deductions (cents)
amounts.currencystringISO currency code
customer.idstringCustomer ID
customer.emailstringnull
customer.countrystringnull
items.product_idstringnull
items.variant_idstringnull
tax.collectedbooleanWhether tax was collected
tax.amount_centsnumberTax amount in cents
metadataobjectCustom metadata
creatednumberUnix timestamp (seconds)

Events

transaction.created

Sent when a transaction is first created.
At this stage, the transaction is not yet completed.

Status

  • status: "incomplete"

Example Payload

{
  "id": "evt_123",
  "object": "event",
  "type": "transaction.created",
  "api_version": "2025-11-07.alpha",
  "created": 1768293724,
  "livemode": false,
  "data": {
    "object": {
      "id": "txn_123",
      "object": "transaction",
      "status": "incomplete",
      "amounts": {
        "gross": 3400,
        "tax": 0,
        "discount": 0,
        "net": 3400,
        "currency": "USD"
      },
      "customer": {
        "id": "CUS_123",
        "email": "customer@example.com",
        "country": null
      },
      "items": {
        "product_id": null,
        "variant_id": null
      },
      "tax": {
        "collected": false,
        "amount_cents": 0
      },
      "metadata": {},
      "created": 1768293724
    }
  }
}

transaction.succeeded

Sent when a transaction has been successfully completed and funds are captured.

Status

  • status: "succeeded"

Example Payload

{
  "id": "evt_456",
  "object": "event",
  "type": "transaction.succeeded",
  "api_version": "2025-11-07.alpha",
  "created": 1768293800,
  "livemode": false,
  "data": {
    "object": {
      "id": "txn_456",
      "object": "transaction",
      "status": "completed",
      "amounts": {
        "gross": 3400,
        "tax": 0,
        "discount": 0,
        "net": 3400,
        "currency": "USD"
      },
      "customer": {
        "id": "CUS_456",
        "email": "customer@example.com",
        "country": "US"
      },
      "items": {
        "product_id": "prod_123",
        "variant_id": "var_123"
      },
      "tax": {
        "collected": false,
        "amount_cents": 0
      },
      "metadata": {
        "invoiceId": "03ff07b1-2ad9-47f2-8c90-5ac3da9f1d32"
      },
      "created": 1768293800
    }
  }
}

Verifying Webhooks

Non-Discord webhooks include the following HTTP headers:

  • Storrik-Signature
  • Storrik-Event
  • Storrik-Webhook-Id

The request body is signed using HMAC SHA-256 with your webhook secret.

To verify a webhook, compute an HMAC SHA-256 signature of the raw request body using your webhook secret and compare it to the value provided in the Storrik-Signature header.

If the signatures match, the webhook payload can be trusted as coming from Storrik.