alexmorrisnz / moodle-paygw_stripe

https://moodle.org/plugins/paygw_stripe
10 stars 12 forks source link

Stripe webook error - missing metadata #40

Open djformby opened 1 week ago

djformby commented 1 week ago

https://github.com/alexmorrisnz/moodle-paygw_stripe/blame/7753914973011e45aa03f88a8bd6483c07e1d1fa/webhook.php#L45

When a user cancels a subscription, everything appears to work correctly, but in the background it looks like Stripe sends a webhook event to the Moodle endpoint and it gets an error referencing this line. It appears to be expecting a 'metadata' json object that is not actually sent with the event. The "product" in Stripe does not have any metadata, so I'm guessing something didn't create the product correctly with the expected metadata?

I see that we can manually edit metadata in Stripe, but I'm not sure where to find all the fields (component, paymentarea, and itemid) that it appears to be expecting

Exception - core_payment\helper::get_gateway_configuration(): Argument #1 ($component) must be of type string, null given, called in [dirroot]/payment/gateway/stripe/webhook.php on line 45