# package.purchased

HTML: https://www.app2email.com/docs/api/webhooks/package.purchased · Index: https://www.app2email.com/docs/api/llms.txt

A prepaid package was bought online (paid) or given to a customer (granted).

Group: Book-and-Pay. Header `X-App2email-Event: package.purchased`. Inside the envelope `{id, type, created, number, test?, data}` ([envelope, headers, signature](https://www.app2email.com/docs/api/webhooks.md)). Every webhook of the number gets every number event: filter by `type`.

## data

| Field | Type | Required | Notes |
| --- | --- | --- | --- |
| `data.purchase` | object | yes | Prepaid sessions a customer holds. Using one on a booking (POST /bookings with use_package) takes a session; a cancellation by the business gives it back. Also in package.purchased. |
| `data.purchase.id` | integer |  |  |
| `data.purchase.contact` | string |  |  |
| `data.purchase.contact_name` | string |  |  |
| `data.purchase.package_id` | string |  |  |
| `data.purchase.package_name` | string |  |  |
| `data.purchase.services` | string[] |  |  |
| `data.purchase.sessions_total` | integer |  |  |
| `data.purchase.sessions_used` | integer |  |  |
| `data.purchase.sessions_left` | integer |  |  |
| `data.purchase.expires` | string |  |  |
| `data.purchase.status` | string |  | one of: `pending`, `active`, `used_up`, `expired`, `refunded`, `cancelled` |
| `data.purchase.payment_id` | integer |  |  |
| `data.purchase.created` | string |  |  |
| `data.payment` | object |  | A payment row. kind booking: the online payment (or deposit) of an appointment; request: a one-off payment request; package: a prepaid package bought online. Money is a number in the payment's currency plus a label such as "$40.00". Also inside booking.paid, booking.refunded and payment.paid. ticket: the online payment of a ticket order (the order's payment.id). |
| `data.payment.id` | integer |  |  |
| `data.payment.kind` | string |  | one of: `booking`, `request`, `package`, `ticket` |
| `data.payment.status` | string |  | one of: `pending`, `paid`, `partly_refunded`, `refunded`, `failed`, `expired`, `cancelled` |
| `data.payment.provider` | string |  | one of: `stripe`, `paypal` |
| `data.payment.amount` | number |  |  |
| `data.payment.amount_label` | string |  |  |
| `data.payment.full_label` | string |  | The price before a discount. |
| `data.payment.discount_label` | string |  |  |
| `data.payment.coupon_code` | string |  |  |
| `data.payment.currency` | string |  |  |
| `data.payment.refunded` | number |  |  |
| `data.payment.refunded_label` | string |  |  |
| `data.payment.description` | string |  |  |
| `data.payment.contact` | string |  |  |
| `data.payment.payer_name` | string |  |  |
| `data.payment.appointment_id` | integer |  |  |
| `data.payment.booking_reference` | string |  |  |
| `data.payment.package_purchase_id` | integer |  |  |
| `data.payment.checkout_url` | string |  | The provider's checkout page while the payment is open. Empty otherwise. |
| `data.payment.link_url` | string |  | A payment request's page on the business's booking site. |
| `data.payment.last_error` | string |  |  |
| `data.payment.paid` | string |  |  |
| `data.payment.refunded_at` | string |  |  |
| `data.payment.created` | string |  |  |
| `data.granted` | boolean |  | true: given without a payment. |
| `data.timestamp` | string |  |  |

## Samples

### granted

```json
{
  "id": "evt_Pay3k9m2Lw8Rt5Yp1Zs04",
  "type": "package.purchased",
  "created": "2026-11-11T01:00:00.000Z",
  "number": "4976659348270",
  "data": {
    "purchase": {
      "id": 5,
      "contact": "61412345678",
      "contact_name": "John Smith",
      "package_id": "ten-pack",
      "package_name": "10 sessions",
      "services": [],
      "sessions_total": 10,
      "sessions_used": 2,
      "sessions_left": 8,
      "expires": "2027-11-11T01:15:00.000Z",
      "status": "active",
      "payment_id": 17,
      "created": "2026-11-11T01:15:00.000Z"
    },
    "payment": null,
    "granted": true,
    "timestamp": "2026-11-11T01:00:00.000Z"
  }
}
```

## Caused by

- [Give a customer a package without a payment](https://www.app2email.com/docs/api/payments/grant-package.md): `POST /v1/{number}/bookings/packages/grant`

Send it to your URL: https://www.app2email.com/docs/api/webhooks/tester?type=package.purchased
