Webhook: purchase.completed

The purchase.completed event is sent when a purchase completes. Use it 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",
      "itemsSubtotalAmount": 199,
      "totalExcludingTaxAmount": 199,
      "subtotalAmount": 199, // deprecated
      "taxAmount": 18,
      "taxRate": 0.08875,
      "totalAmount": 217,
      "discountAmount": null,
      "promoCode": null,
      "fee": {
        "fxRate": 1,
        "feeAmount": 60,
        "netProceedsAmount": 139,
        "settlementCurrency": "USD"
      },
      "currency": "USD",
      "initialCurrency": "USD",
      "pricingSheetName": null,
      "status": "complete",
      "externalReferenceId": null,
      "externalMetadata": null,
      "accountId": "simple_user",
      "email": "[email protected]",
      "ipAddress": "203.0.113.42",
      "locale": "en-US",
      "playerCountry": "US",
      "initialPlayerCountry": "US",
      "date": "2024-02-05T22:42:02.552Z",
      "items": [
        {
          "id": "6f1c2a7e-3b0d-4c55-9a51-0d2f8e7b4c11",
          "sku": "qty2-sku",
          "name": "Iron Shield",
          "price": 199,
          "referencePrice": 199,
          "referenceCurrency": "USD",
          "quantity": 1,
          "bundleContents": [],
          "refundableQuantity": 1
        }
      ],
      "payments": [
        {
          "method": "credit_card",
          "amount": 217
        }
      ],
      "referral": {
        "source": "facebook",
        "method": "utm",
        "host": "www.facebook.com",
        "utmMedium": "social",
        "utmCampaign": "summer_sale",
        "utmSource": "facebook"
      },
      "events": [
        {
          "id": "902c342b-2d1b-434b-9f38-efd1a564a666",
          "date": "2024-02-05T22:42:02.552Z",
          "type": "sale",
          "amount": 217,
          "currency": "USD"
        }
      ]
    }
  }
}

The purchase object has the same shape as the response from /purchases/{purchaseId}. All amounts are expressed as 100x the currency's base unit; see Currencies.

Amounts

  • itemsSubtotalAmount: the sum of all items (price × quantity).
  • totalExcludingTaxAmount: the total excluding tax (totalAmount − taxAmount).
  • subtotalAmount: deprecated. Use itemsSubtotalAmount or totalExcludingTaxAmount instead.

fee

The fee Neon charged and your net proceeds, both in your settlement currency. fxRate is the rate used to convert from the purchase currency to your settlement currency.

payments

Every payment that funded this purchase, one entry per payment method. A split payment, where part of the purchase is paid from the player's Neon wallet and the rest through a payment processor, has two entries: the wallet first, then the processor.

"payments": [
  { "method": "neon_wallet", "amount": 100 },
  { "method": "credit_card", "amount": 117 }
]

Each amount is in the purchase currency.

events

referral has the same shape as on the /purchases/{purchaseId} response body. Refer to the events field on the Purchase response body.

For this webhook there is only ever a single sale event.

referral

referral has the same shape as on the /purchases/{purchaseId} response body. 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?