Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

getting error : You cannot attach a PaymentMethod to a Customer during PaymentMethod creation. in recurring payment intent stripe

I am working on recurring payment intent, when i am trying to Charge the saved card later Server-side, I am getting this response :

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
        )

)

for that i have use curl method

curl https://api.stripe.com/v1/payment_methods \
  -u ********: \
  -d customer="{{CUSTOMER_ID}}" \
  -d type=card

Can anyone please help me how to resolve this issue ? I have refer this page

https://stripe.com/docs/payments/save-and-reuse
like image 571
taks Avatar asked Oct 15 '22 08:10

taks


1 Answers

I encountered the same problem.. according to their docs, we need to first create a payment method and then attach it with the customer. Though, don't know then why they have provided customer field

like image 150
Balram Kukreja Avatar answered Oct 21 '22 07:10

Balram Kukreja