mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-03-25 02:31:59 -05: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
1 changed files with 3 additions and 0 deletions
|
@ -155,6 +155,9 @@ module.exports = class StripeWebhookService {
|
||||||
* @returns {Promise<void>}
|
* @returns {Promise<void>}
|
||||||
*/
|
*/
|
||||||
async invoiceEvent(invoice) {
|
async invoiceEvent(invoice) {
|
||||||
|
if (!invoice.subscription) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
const subscription = await this._stripeAPIService.getSubscription(invoice.subscription, {
|
const subscription = await this._stripeAPIService.getSubscription(invoice.subscription, {
|
||||||
expand: ['default_payment_method']
|
expand: ['default_payment_method']
|
||||||
});
|
});
|
||||||
|
|
Loading…
Add table
Reference in a new issue