#geimsdin-SubscriptionSchedule
1 messages · Page 1 of 1 (latest)
Hi, this is the payment id: pi_3Ld3IdLmxBucQd150G6XssHf
This is the sub id: sub_1Ld3IbLmxBucQd15Lfh2VG5m
Okie so you created a Sub Schedule. It generated a Subscription and an Invoice, a PaymentIntent underlying. But I think you haven't confirmed the PaymentIntent
The customer used for the Subscription does have a lot of Payment Method attached, but none was set as their default
So the Subscription won't "automatically" choose a PaymentMethod to charge
mmm... ok, I check on that
I don't know if it is wrong but I create a new customer for every schedule I create, is that correct or Stripe che create it automatically and recognize if the same customer is creating a new sub?
Not sure about that recognize part. You pass a customer id when create the Sub Schedule and it will be used
A side note that your account is still having the warning
Your account's business owner information needs review
We couldn’t verify the information provided about your business owner.
This account is only used for developing purposes in test mode
How to set the last payment method as the default?
Yes but Charge and Payout are restricted. It could block some functionality of automatic transition
How to set the last payment method as the default?
set it in the customer's invoice_settings.default_payment_method
Ok then I need to retrieve the payment method, store it and then update the invoice before requesting the payment
Test mode should not have such limitations. How can I create an account only for developing purposes?
It can have. I am not sure by 100% but I would suggest just verify the Business information to get rid of it
STRIPE CLI on my account can charge without problems, I guess it works because of that, is just my code is missing the default payment method in the phase (I hope)
Let's try it first
Where qould you suggest me to retrieve the payment method id?
When I get that data back from STRIPE?
It depends on your integration. How did you create the Payment Method Id?
If you confirmed a PaymentIntent earlier, then you will have webhook events
I create the payment method using STRIPE js Elements
I don't create myself a payment method ID
I guess then I try to retrieve it by webhook
payment_intent.created is one of the event I receive
So you created the Payment Method first, then create PaymentIntent specifying that Payment Method?
After I create the Payment Method I attach it to the client and I create a Subscription Schedule always attached to the client
But I never included in the subscription Phase the default payment method
I'm making some confusion, let me test the code after the information you gave me and I will be back in case it doesn't work
Sure
Can I set a payment intent as default payment method or they are 2 totally different things?
no they are different. pi_xxx vs. pm_xxx
Then I never get the payment method
Can you share the payment method id?
No because I don't get it through API
I try to explain the flow
1 - I create a payment element from STRIPE JS
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
Look here and you would see your request initiated in step 1
2 - if the payment element is submitted succesfully I create a Subscription schedule connected to the customer
Ok, nice and thanks I didn't know I can see all my logs
But still I don't understand when I get back a payment method id
I don't get it from the payment element submission
You use the Payment Element correct? What client secret you supply to it? a SetupIntent?
I create the setupintent attached to the customer
then with that data I create the payment element
Great. Let's try to listen to https://stripe.com/docs/api/events/types#event_types-setup_intent.succeeded
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Inside that webhook event, you will have the SetupIntent object, which will have the Payment Method id
Ok, I log that event now, will get back to you
Yeeeah...
"payment_method": "pm_1Ld4LiLmxBucQd15mnUdmXXk",
I got it, thanks
Great! Now try to set it here: https://stripe.com/docs/api/customers/update#update_customer-invoice_settings-default_payment_method
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
That's the Update Customer API
Is it not better to set it in the subscription phase? So that every recurring invoice will use that
That could work too. Setting here will automatically take the pm for any Subscription from now on, tho
missing - card
Cannot charge a customer that has no active card
Now I get this
should I try to set the default payment method directly on the customer? I would avoid that because a customer could choose to pay one product with a card and another one with another card.
Yes it's up to you, to set default on Customer level or Subscription level