Refund Flow
Create a Refund
Send a server-side request to create a refund for a paid session.payment_id: The original payment ID to refundreason: Optional reason for the refund
Refund Statuses
Refunds can have the following statuses:pending: Refund created but not yet processedsucceeded: Refund has been successfully processed and funds returnedfailed: Refund failed (e.g., insufficient funds, payment method issues)cancelled: Refund was cancelled before completion
- Refund starts as
pending - Refund resolves to either
succeeded,failed, orcancelled
Timestamp Fields
Refunds include relevant timestamp fields based on their final status:created_at: When the refund was initiatedsucceeded_at: When the refund completed successfully (if applicable)failed_at: When the refund failed (if applicable)cancelled_at: When the refund was cancelled (if applicable)
Webhook Events
ToffeePay sends webhooks for the following refund-related events:refund.created: When a refund is created and processing beginsrefund.succeeded: When a refund has been processed successfullyrefund.failed: When a refund attempt fails
Handle Refund Notifications
When a refund is processed, ToffeePay sends a signed webhook to your backend. Sample Payload:Check Refund Status
You can check the status of a refund at any time:List Refunds
Retrieve historical refunds for audit and analytics:Best Practices
- Idempotency: Use Idempotency-Key header to prevent duplicate refunds
- Revoke Items: When processing a refund webhook, revoke the purchased items from the user’s account
- Webhook verification: Always verify webhook signatures (see Webhooks)