1

I'm using the onCharge event to populate a separate purchases table that I can query elsewhere (combining both stripe and my other Paypal payments system).

The onCharge event is mostly working, but it's not populating the $chargeModel->amount.

It's also not populating the $chargeModel->userId if a new user is being registered (it only populates if there was a previously existing user).

Any idea why the charge model wouldn't have all of its information during the onCharge event?

Here's what I have in my plugin:

craft()->on('charge.onCharge', function(Event $event) {    
    // Adding New Charges to Purchases Table
    craft()->purchases_newPurchase->addChargePurchase($event->params['charge']);
});
2

I'm pretty sure this issue is caused because the model is being passed to the event without being populated first (it only has the EXACT details that are manually populated when the record is created, not the additional functions).

I was able to use $chargeModel->planAmount just fine, and I was actually able to re-look up the model based on the passed model id, which properly populated the model before passing it back.

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.