Event
The Event object represents a webhook notification about activity in your Fungies store.
Events are notifications that inform you when something significant happens in your Fungies account. When an event occurs - such as a successful Payment or Subscription cancellation - we create an Event object and send it to your configured webhook endpoints.
You can use events to trigger workflows in your application, such as fulfilling Orders, sending custom emails, or syncing data with your backend systems.
Event delivery
Events are delivered to your webhook endpoints via HTTP POST requests. Each event includes:
- A unique
idfor deduplication - An
idempotencyKeyto prevent duplicate processing - The event
typeindicating what happened - A
datapayload with relevant objects
Events may be delivered more than once. Use the idempotencyKey to ensure you process each event only once.
Event types
These are the event types currently supported. We may add more at any time, so your code should handle unknown event types gracefully.
| Event Type | Description |
|---|---|
payment_success | A Payment has been successfully processed. Use this to fulfill orders and grant subscription access. |
payment_refunded | A Payment has been refunded (full or partial) |
payment_failed | A Payment attempt has failed |
subscription_created | A new Subscription record exists in Stripe/Fungies. May include PENDING payment data if sent before checkout finishes — not a paid signal by itself. |
subscription_interval | A Subscription's billing interval has been charged |
subscription_updated | A Subscription has been modified |
subscription_cancelled | A Subscription has been cancelled |
Subscription signup events
On the first subscription checkout, Fungies sends both events when your webhook is subscribed to both types. They are produced by different Stripe notifications and may arrive seconds apart or out of order.
subscription_created— subscription object created;data.lastPaymentmay still bePENDINGanddata.subscription.statusincomplete. There is nodata.orderon this event.payment_success— initialsubscription_initialpayment isPAID; safe to fulfill.
Treat subscription_created as informational (lifecycle, CRM, analytics). Treat payment_success as the fulfillment trigger for the first charge.
The Event object
idstringrequiredUnique identifier (UUID) for this event. It carries no prefix.
typestringrequiredThe type of event that occurred. See Event types above.
idempotencyKeystringrequiredUnique key (UUID) for idempotent event processing. Use this to prevent duplicate handling of the
same event. It is always equal to id — deduplicating on either one is the same thing.
testModebooleanrequiredWhether this event occurred in test mode (true) or live mode (false).
dataobjectrequiredThe event payload containing related objects. Its shape depends on the event family — see Payload shape by event below. Do not assume a key is present without checking the table.
Payload shape by event
data carries different keys for payment events and subscription events. The most common mistake is
reading data.order or data.payment on a subscription event: neither exists there.
| Key | Payment eventspayment_success, payment_failed, payment_refunded | Subscription eventssubscription_created, subscription_updated, subscription_interval, subscription_cancelled |
|---|---|---|
items | ✅ always | ✅ always |
user | ✅ always | ✅ always |
customer | ✅ always (alias of user, kept for compatibility) | ❌ absent |
order | ✅ always | ❌ absent |
payment | ✅ always | ❌ absent |
lastPayment | ❌ absent | ✅ always — the most recent payment for the subscription |
subscription | Only when the payment belongs to a subscription | ✅ always |
refund | Only on payment_refunded | ❌ absent |
On payment events, data.customer and data.user are the same User object.
Prefer data.user — it is the one key present on every event.
data.itemsarrayArray of line items involved in the transaction. See Item object below.
data.userUserThe User object representing the customer.
data.orderOrderThe Order object associated with this event. Payment events only.
data.paymentPaymentThe Payment object for the transaction. Payment events only.
data.lastPaymentPaymentThe most recent Payment object for the subscription. Subscription
events only — on subscription_created it can still be PENDING.
data.subscriptionSubscriptionThe Subscription object. Always present on subscription events; on payment events, present only when that payment belongs to a subscription.
data.refundRefundThe refund this event is about. Present on payment_refunded only — see
Refund object below.
Refund object
data.refund describes the single refund that triggered a payment_refunded event. An order can be
refunded more than once: each refund sends its own event, and cumulativeAmountRefunded is the
running total across all of them — use it rather than adding up amounts, because events can arrive
out of order or be redelivered.
This object was added to payment_refunded after the event type first shipped. If your handler
needs it, treat it as optional until you have confirmed your integration receives it.
objectstringObject type identifier. Always "refund".
idstringrequiredThe payment provider's own identifier for this refund. Use it to reconcile against your provider records and to deduplicate repeat deliveries of the same refund.
statusstringrequiredOne of pending, succeeded, failed, canceled, requires_action. A refund can be reported
before the bank settles it, so pending is a normal first state.
amountintegerrequiredAmount refunded by THIS refund, in the currency's minor units (e.g. 1050 = 10.50). Tax included.
currencystringThree-letter currency code, matching the order's currency.
cumulativeAmountRefundedintegerrequiredTotal refunded on the order so far, this refund included, in minor units. Compare it against the order total to tell a partial refund from a full one.
reasonstringWhy the refund was issued, when one was given.
createdAtintegerUnix timestamp in milliseconds for when the refund was created.
Item object
Each item in the data.items array represents a line item in the Order.
objectstringObject type identifier. Always "item".
idstringrequiredUnique identifier (UUID) for this line item.
namestringrequiredDisplay name of the item.
valueintegerrequiredItem price in the smallest currency unit. Defaults to 0.
quantityintegerrequiredNumber of units purchased.
currencystringrequiredThree-letter ISO 4217 currency code.
productobjectrequiredThe Product this item belongs to, in short form — object, id
(UUID), type, and internalId. Not the full Product object: there is no name here, so read
the item's own name for display.
offerobjectrequiredThe Offer purchased, in short form — object, id (UUID), and
internalId. Always present.
variantobject | nullThe product variant, in short form — object, id (UUID), and internalId. null when the
offer has no variant.
planobject | nullFor a Subscription offer, the same variant object repeated under
a subscription-friendly name (variants are used as plans). null for one-time offers.
customFieldsobject | nullKey-value pairs of custom fields defined by you and filled by the customer during checkout. Only keys that exactly match a field's Key (configured in the Dashboard) are included — an unmatched or undefined key is silently omitted rather than sent as an empty value.
Example event payload
Payment event
{
"id": "770e8400-e29b-41d4-a716-446655440010",
"type": "payment_success",
"idempotencyKey": "770e8400-e29b-41d4-a716-446655440010",
"testMode": false,
"data": {
"items": [
{
"object": "item",
"id": "cc0e8400-e29b-41d4-a716-446655440020",
"name": "Pro Plan - Monthly",
"value": 2999,
"quantity": 1,
"currency": "USD",
"product": {
"object": "product",
"id": "bb0e8400-e29b-41d4-a716-446655440006",
"type": "Subscription",
"internalId": "prod_pro"
},
"offer": {
"object": "offer",
"id": "aa0e8400-e29b-41d4-a716-446655440005",
"internalId": "plan_pro_monthly"
},
"variant": {
"object": "variant",
"id": "dd0e8400-e29b-41d4-a716-446655440030",
"internalId": "var_monthly"
},
"plan": {
"object": "variant",
"id": "dd0e8400-e29b-41d4-a716-446655440030",
"internalId": "var_monthly"
},
"customFields": {
"license_type": "single"
}
}
],
"order": {
"object": "order",
"id": "550e8400-e29b-41d4-a716-446655440000",
"number": "L8VQK3N2M7KpQ9nR",
"status": "PAID",
"value": 2999,
"currency": "USD"
},
"payment": {
"object": "payment",
"id": "660e8400-e29b-41d4-a716-446655440001",
"number": "L8VQK3N2M7KpQ9nR",
"status": "PAID"
},
"user": {
"object": "user",
"id": "123e4567-e89b-12d3-a456-426614174000",
"email": "customer@example.com",
"username": null,
"internalId": "usr_abc123"
},
"customer": {
"object": "user",
"id": "123e4567-e89b-12d3-a456-426614174000",
"email": "customer@example.com",
"username": null,
"internalId": "usr_abc123"
}
}
}Subscription event
Note what is missing: no order, no payment, no customer.
{
"id": "770e8400-e29b-41d4-a716-446655440011",
"type": "subscription_interval",
"idempotencyKey": "770e8400-e29b-41d4-a716-446655440011",
"testMode": false,
"data": {
"items": [
{
"object": "item",
"id": "cc0e8400-e29b-41d4-a716-446655440020",
"name": "Pro Plan - Monthly",
"value": 2999,
"quantity": 1,
"currency": "USD",
"product": {
"object": "product",
"id": "bb0e8400-e29b-41d4-a716-446655440006",
"type": "Subscription",
"internalId": "prod_pro"
},
"offer": {
"object": "offer",
"id": "aa0e8400-e29b-41d4-a716-446655440005",
"internalId": "plan_pro_monthly"
},
"variant": {
"object": "variant",
"id": "dd0e8400-e29b-41d4-a716-446655440030",
"internalId": "var_monthly"
},
"plan": {
"object": "variant",
"id": "dd0e8400-e29b-41d4-a716-446655440030",
"internalId": "var_monthly"
},
"customFields": {}
}
],
"user": {
"object": "user",
"id": "123e4567-e89b-12d3-a456-426614174000",
"email": "customer@example.com",
"username": null,
"internalId": "usr_abc123"
},
"subscription": {
"object": "subscription",
"id": "L8VQK3N2M7KpQ9nR",
"status": "active"
},
"lastPayment": {
"object": "payment",
"id": "660e8400-e29b-41d4-a716-446655440004",
"number": "L8VQK3N2M7KpQ9nR-0003",
"status": "PAID"
}
}
}subscription and lastPayment are the full Subscription and
Payment objects; the examples above are abridged.
Related resources
Last updated