Documentation Index
Fetch the complete documentation index at: https://docs.metrifox.com/llms.txt
Use this file to discover all available pages before exploring further.
Overview
Thecredit.purchased webhook is triggered when credits are purchased or provisioned for a customer in your Metrifox account. Credits can be used to pay for usage-based features or other charges.
When It’s Triggered
This event is sent immediately after credits are successfully purchased or provisioned, which can happen when:- A customer purchases credits through checkout
- Credits are manually assigned to a customer
- Credits are provisioned through the API
- Credits are added as part of a plan or promotion
Payload Structure
Data Fields
The payload includes credit order and result:data.order
id: Internal order IDpolicy: Policy applied to the order (if any)status: Order status (e.g., “fulfilled”)paid_at: Payment timestamp (if paid)is_manual: Whether the order was created manuallytenant_id: The tenant ID this order belongs tocreated_at: Timestamp when the order was createdexpires_at: Order expiration timestamp (if any)updated_at: Timestamp when the order was last updatedchange_type: Order change type (if any)customer_id: ID of the customer who placed the ordercustomer_key: Your external customer identifierfulfilled_at: Timestamp when the order was fulfilledorder_number: Human-readable order numbercurrency_code: Currency code (e.g., “USD”, “NGN”)billing_interval: Billing interval (e.g., “monthly”)total_in_base_unit: Total amount in base unitssetup_intent_result: Setup intent result (if any)subtotal_in_base_unit: Subtotal amount in base unitsbilling_interval_value: Billing interval valuetransitioning_subscription_id: Transitioning subscription ID (if any)
data.result
id: Credit allocation IDused: Amount of credits usedactive: Whether the allocation is activeamount: Amount allocatedbalance: Remaining balanceorder_id: Order ID associated with the allocationtenant_id: The tenant ID this allocation belongs towallet_id: Wallet IDcreated_at: Timestamp when the allocation was createdexpires_at: Expiration date (if any)invoice_id: Invoice ID associated with the allocation (if any)updated_at: Timestamp when the allocation was last updatednext_reset_at: Next reset timestamp (if any)billing_end_date: Billing end date (if any)next_provision_at: Next provision timestamp (if any)credit_entitlement_id: Credit entitlement IDrollover_source_pool_id: Rollover source pool ID (if any)
Example Use Cases
- Send credit purchase confirmation emails
- Update customer credit balance in your system
- Trigger notifications about available credits
- Sync credit purchases to your accounting system
- Track credit usage and analytics
- Update customer dashboards with credit information

