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 allocation and wallet information:data.credit_allocation
id: Internal credit allocation IDwallet_id: ID of the wallet the credits were added tocustomer_id: ID of the customer who received the creditscustomer_key: Customer keyamount: Amount of credits purchased/provisionedcurrency: Currency code (e.g., “USD”, “NGN”)credit_type: Type of credit (e.g., “prepaid”, “promotional”)expires_at: Expiration date for the credits (if applicable)tenant_id: The tenant ID this credit allocation belongs tocreated_at: Timestamp when the credits were purchasedupdated_at: Timestamp when the credit allocation was last updated- Additional credit allocation-specific fields
data.wallet (optional)
id: Wallet IDcustomer_id: ID of the customer who owns the walletbalance: Current wallet balance after the credit purchasecurrency: Currency code- Additional wallet-specific fields
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

