Hooks and Events

If you're building a large site and using Charge as part of your payment process sometimes you'll need to add your own custom logic to certain parts of the process. Charge helps you by exposing a few hooks and events for you to trigger your own custom logic against.

Events

charge.onCharge
Fired as soon as a payment successfully completes
charge.onBeforeCharge
Fired just before a charge is attempted

charge.onCharge

Fires as soon as a payment successfully completes. Receives a ChargeModel object containing all the details of the transaction, including populated Stripe response data.

Parameters

charge ChargeModel
The full populated model for the just processed charge payment. Includes all populated Stripe information and keys.

charge.onBeforeCharge

Fires just before a charge is attempted. Includes the ChargeModel object containing all the details of the payment about to be attempted.

Parameters

charge ChargeModel
The partially populated model for the payment about to be attempted.

Need a hook or event that's not listed here? Just get in touch.