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",
      "initialCurrency": "USD",
      "status": "complete",
      "playerCountry": "US",
      "initialPlayerCountry": "US",
      "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,
          "bundleContents": []
        }
      ],
      "events": [
        {
          "id": "902c342b-2d1b-434b-9f38-efd1a564a666",
          "date": "2024-02-05T22:42:02.552Z",
          "type": "sale",
          "amount": 217,
          "currency": "USD"
        }
      ],
      "referral": {
        "source": "facebook",
        "method": "utm",
        "host": "www.facebook.com",
        "utmMedium": "social",
        "utmCampaign": "summer_sale",
        "utmSource": "facebook"
      },
    }
  }
}

events

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

referral

The referral field is shown in consistency with the /purchases/{purchaseId} endpoint. Refer to the referral field on the Purchase response body for the expected return values.

referral.source is derived from a combination of UTM parameters, click IDs, and HTTP headers sent in the initial request. referral.method describes which method was used for deriving the referral.source. More information about referral is here



Did this page help you?