#CheerfulGolem
1 messages · Page 1 of 1 (latest)
hello! can you share the Subscription id?
sub_1MqPPWHVU4O1reMux4HJT6n5
Note, the invoice was succesful, because I had to manually charge the customer there
Also this is in test mode
Invoice id: in_1MqPPWHVU4O1reMuXWpiOzZX
alright, gimme a while to get back to you
The setup intent was created with off_session - Is that why this is happening?
you need to set the default payment method, either on the customer via invoice_settings.default_payment_method [0] or on the Subscription Schedule [1]
[0] https://stripe.com/docs/api/customers/update#update_customer-invoice_settings-default_payment_method
[1] https://stripe.com/docs/api/subscription_schedules/create#create_subscription_schedule-phases-default_payment_method
the Subscription will attempt to charge the payment method set in invoice_settings.default_payment_method [0] if it can't find one defined on the Subscription. See https://stripe.com/docs/api/subscriptions/object#subscription_object-default_payment_method
if you didn't set either, then the Subscription wouldn't know what PaymentMethod to charge
Hmm, but it uses the payment method on the customer no?
That was added via setup intents?
you attached the PaymentMethod to the customer, but didn't set it as invoice_settings.default_payment_method on the customer
maybe try it out
Okay let me try it out
Oh wait
How do I do that, when I don't have a payment method at the time of creating the subscription schedule?
I guess I need to update the subscription schedule in a webhook, when the setup intent is successful? And add it there?
did you create / collect the PaymentMethod for the customer prior to creating the Subscription Schedule with a SetupIntent?
No so it happens in the same step
I create customer, create a setupintent for that customer, create a subscription schedule for that customer, and then send clientSecret to frontend
Should i show my code?
nah, it's alright, i don't need to see the code
I would like to mention, that we are trying to simulate, how custom-payment flow looks like for Subscriptions
e.g. you create a customer, you create a subscription, and then you get the clientSecret from that subscription
The only reason we're using SubscriptionSchedule is to delay the start date, but other than that we want to keep everything the same
out of curiosity, why don't you wait to create the Subscription Schedule after you've successfully collected/created the PaymentMethod?
Umm, good point lol
Guess I didn't think of that, when I was too focused on how the code looked for subscriptions
Cause in subscriptions it all happens in one step ^^
maybe lets take a couple of steps back
Let me try that hehe
why do you need to delay the subscription creation too?
You mean delay the start date of the subscription?
yep
Oh it's just our use-case, basically we are doing a special promotion where people can setup recurring donations for the last 10 days of the month (Ramadan)
so we need to delay the start date to when the last 10 days start
aaah, okay, then yep, lets go with what was discussed - collect the payment method, once that's successful, set it as the default payment method on the customer (or alternatively set the default payment method on the Subscription Schedule) then create the Subscription Schedule
People would usually donate indivisual payments on the last 10 days, so we want to automate it for them
Ah okay yea let me try that
Do you know how I can move a invoice from draft to finalize, to test if it iwill automatically collect payment via dashboard?
It says Invoice is in draft, and will finalize after an hour
in case you haven't seen this yet, you can use test clocks to mimic the passing of time : https://stripe.com/docs/billing/testing/test-clocks