2

I would like to update a specific entry upon the completion of a successful payment through the charge plugin. For this, Charge provides the callback 'charge.onCharge,' as detailed in the 'Hooks & Events Page' of the documentation.

The issue is that I have no idea where to put PHP code to utilize this callback, nor what this code would look like. Is there an example that would explain exactly how to use the callback, and exactly where the code would go?

3

You'd listen to Charge's onCharge event just like you'd listen to any of Craft's own events, using a plugin.

Your plugin's init() method, for example could do this:

craft()->on('charge.onCharge', function(Event $event) {
    // ...
});

There's a nifty Craft plugin scaffold generator to get you started here, too.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.