mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-25 11:55:03 +03:00
Fixed errors for non-subscription invoices
refs https://github.com/TryGhost/Team/issues/887 Our invoice webhook handling code assumed that every invoice would be for a subscription, but that is not the case. There are valid use-cases of using the same Stripe account in order to sell items with a one-off purchase. Here we update the handling to ignore all invoices which are not for subscriptions.
This commit is contained in:
parent
d0b349828a
commit
635c2614a3
@ -155,6 +155,9 @@ module.exports = class StripeWebhookService {
|
||||
* @returns {Promise<void>}
|
||||
*/
|
||||
async invoiceEvent(invoice) {
|
||||
if (!invoice.subscription) {
|
||||
return;
|
||||
}
|
||||
const subscription = await this._stripeAPIService.getSubscription(invoice.subscription, {
|
||||
expand: ['default_payment_method']
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user