Webhook: purchase.completed

The purchase.completed event is triggered upon purchase completion. It should be used to fulfill the player's purchase.

Example

{
  "id": "d20f0f08-694d-4798-9faf-fccd5b61ed39",
  "type": "purchase.completed",
  "version": 2,
  "isSandbox": true,
  "data": {
    "purchase": {
      "id": "1bfb9321-0013-4196-ac9c-a864ecce522f",
      "orderNumber": "KJ7Z-KJNW-BMDB",
      "checkoutId": "a50adc04-a5c7-487e-a684-4f0d539bc3d8",
      "subtotalAmount": 199,
      "taxAmount": 18,
      "taxRate": 0.08875,
      "totalAmount": 217,
      "discountAmount": null,
      "currency": "USD",
      "status": "complete",
      "externalReferenceId": null,
      "externalMetadata": null,
      "accountId": "simple_user",
      "email": "[email protected]",
      "locale": "en-US",
      "date": "2024-02-05T22:42:02.552Z",
      "fee": {
        "settlementCurrency": "USD",
        "fxRate": 1.0000,
        "feeAmount": 60,
        "netProceeds": 139
      },
      "items": [
        {
          "sku": "qty2-sku",
          "name": "Iron Shield",
          "price": 199,
          "referencePrice": 199,
          "referenceCurrency": "USD",
          "quantity": 1
        }
      ],
      "events": [
        {
          "id": "902c342b-2d1b-434b-9f38-efd1a564a666",
          "date": "2024-02-05T22:42:02.552Z",
          "type": "sale",
          "amount": 217,
          "currency": "USD"
        }
      ]
    }
  }
}

events

The events field is shown for consistency with the /purchases/{purchaseId} endpoint. The possible events and event types are shown in more detail, but for this webhook there will only ever be a single sale event.