#cyclops_api
1 messages ยท Page 1 of 1 (latest)
๐ Welcome to your new thread!
โฒ๏ธ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.
โฑ๏ธ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.
๐ This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1217884316009369784
๐ Have more to share? Add more details, code, screenshots, videos, etc. below.
Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.
- cyclops_api, 2 days ago, 3 messages
Hi there!
So just to add when i do advance time the susbcription should use default payment method but it isn't using it
Just reading through your question to make sure I understand
I don't quite follow this:
after that I'm updating the default payment method where the card gets attached to customer but the payment gets failed and then I tried to advance time
What default payment method are you updating? Is this subscription.default_payment_method or customer.invoice_settings.default_payment_method ?
customer.invoice_settings.default_payment_method
Quick question just to clarify, the option to make a payment_method default on customer "https://dashboard.stripe.com/test/customers/" url uses which api is it
stripe.Customer.modify(
"cus_NffrFeUfNV2Hib",
)
OR
stripe.PaymentMethod.attach(
"pm_1MqM05LkdIwHu7ixlDxxO6Mc",
customer="cus_NbZ8Ki3f322LNn",
)
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
Sorry, don't quite understand. The Dashboard doesn't always use the API to update/create objects; there are some Dashboard-specific endpoints.
okay
Let's take a step back. Could you clearly summarize what you're trying to test with Test Clocks and what isn't working as expected?
Yeah, sure
So I created an trial subscription with 4242 card which works as expected then I went to customer dashboard in stripe and change the default payment to 0341 (which gets attach to customer payment method but fails when invoice is charged), but when I use test clock to go to future time to charge to the subscription the subscription uses 4242 card insted of 0341 card (which is my default card which I changed manually for stripe customer dashbaord)
Gotcha, okay! If you look at the subscription, its default_payment_method is the 4242 card. If there's a value here, this takes precedence over the customer's invoice_settings.default_payment_method
Okay got you on that now I want to understand how to make sure this case take customer default payment methid
method*
You should update the subscription to remove default_payment_method.
Any reference, how can I do that?
If I don't send a "default_payment_method" while creating the subscription will it use customer default payment method?
https://docs.stripe.com/api/subscriptions/update#update_subscription-default_payment_method
You'll essentially make this blank/null
Yes, if neither subscription.default_payment_method nor subscription.default_source are set, we'll default to customer.invoice_settings.default_payment_method
Is it okay to pass it empty while creating the subscription?
This way I won't have to update it again, to save api calling.
Yep, this can be empty when creating the subscription
Okay, thanks for the help, I have one more question if you can help me on that too
How to update default payment of a customer using stripe api
Can you be more specific? Is this after you've already created a PaymentMethod?
Yes
Once I create a Paymentmethod and I have attach it to customer now I want to make it as a default payment method
You can make a call to update the Customer and pass a value for invoice_settings.default_payment_method: https://docs.stripe.com/api/customers/update#update_customer-invoice_settings-default_payment_method
But lets take a step back. You shouldn't have to make a separate call to attach a PM to a customer. How are you currently creating the PM?
Creating PM on front-end and the parsing that PM ID to backend, calling PM.attach api on backend, to attach to the specific customer
Gotcha. And your intent in this case is to save and use that PM for future charges, correct? You're not saving that PM for an immediate payment?
Yes, first a PM would be added and that is going to be a default one to the specific customer, so stripe can use it for subscription creation and in future if the end-user changes there default payment method we can charge it directly without updating the subscription.
Gotcha. I recommend using SetupIntents instead: https://docs.stripe.com/payments/save-and-reuse?platform=web&ui=elements
You won't need to make a manual call to attach the PM to the customer; this will be done for you on frontend confirmation. You'll still need to set the newly-created PM as the customer's default though
We are using PM method in frontend for the card entered by the customer, is it different then setup-intent?
We aren't using client_secret for payment, that's something which is getting handle on backend part and not on front end we are just creating PM from front-end parsing it to backend and the using it to do the payments
I recommend reading through the SetupIntent guide above. SetupIntents also use client secrets, but these are totally separate from the client secret used for a payment.
The guide above will still create a PM frontend, as part of a frontend request to confirmSetup. This confirmation request will automatically create a PM and attach the PM to a customer (as long as you passed a customer ID when creating the SetupIntent server side)
Okay, let me go through the documentation, thanks for the help on payment_method ๐
Sure thing!
Just last thing
Is setupintents similar to paymentmethod or both are completly different?
A SetupIntent is used to collect payment method details from a customer. When a SetupIntent is successfully confirmed, a PaymentMethod will be created
okay, got it
This might be helpful: https://docs.stripe.com/payments-api/tour
This doesn't go into much detail regarding SetupIntents but they're similar to PaymentIntents. The primary difference is that a PaymentIntent is used to manage payment attempts/charging a customer now, while a SetupIntent is used to collect and store payment method details for future charges.
A PaymentMethod that was collected via a SetupIntent can be used to create a Subscription server side, yes. If you plan on doing this, I recommend passing usage: off_session when creating the SetupIntent: https://docs.stripe.com/api/setup_intents/create#create_setup_intent-usage
Okay, thanks for the help will look into it and will ping back to help if something else come's up ๐