收到错误:您无法在 PaymentMethod 创建期间将 PaymentMethod 附加到客户。在定期付​​款意向条中

tak*_*aks 7 stripe-payments

我正在研究定期付款意向,当我尝试这样做时Charge the saved card later Server-side,我收到以下回复:

Array
(
    [error] => Array
        (
            [message] => You cannot attach a PaymentMethod to a Customer during PaymentMethod creation. Please instead create the PaymentMethod and then attach it using the attachment method of the PaymentMethods API.
            [type] => invalid_request_error
        )

)
Run Code Online (Sandbox Code Playgroud)

为此我使用了curl方法

curl https://api.stripe.com/v1/payment_methods \
  -u ********: \
  -d customer="{{CUSTOMER_ID}}" \
  -d type=card
Run Code Online (Sandbox Code Playgroud)

谁能帮我解决这个问题吗?我已经参考了这个页面

https://stripe.com/docs/payments/save-and-reuse
Run Code Online (Sandbox Code Playgroud)

小智 4

我遇到了同样的问题..根据他们的文档,我们需要首先创建一个付款方式,然后将其附加给客户。不过,不知道为什么他们提供了客户字段