首页 > 解决方案 > 使用有效的付款方式重试后,Stripe 订阅发票保持打开状态

问题描述

我正在使用 stripe-php 库实现条带订阅,遵循此文档https://stripe.com/docs/billing/subscriptions/fixed-price

模拟客户订阅付款方式失败,条带订阅对象生成成功,发票状态打开。

问题是在我的后端实现重试发票时,我的代码如下:

        // retrieve new payment method (valid one)
        $payment_method = \Stripe\PaymentMethod::retrieve (
            $request->paymentMethodId
        );

        // attach customer to payment method
        $payment_method->attach([
            'customer' => $request->customerId,
        ]);

        // update customer default payment method
        \Stripe\Customer::update($request->customerId, [
            'invoice_settings' => [
                'default_payment_method' => $request->paymentMethodId
            ]
        ]);

        // retrieve invoice object
        $invoice = \Stripe\Invoice::retrieve($invoiceId, [
            'expand' => ['payment_intent']
        ]);

在条纹仪表板上,客户默认付款方式已成功更新为最新的(有效卡),但订阅发票保持打开状态。

请帮忙,有人也遇到这个问题吗?恐怕我错过了条纹文档中的一些步骤。

标签: stripe-payments

解决方案


推荐阅读