#CheerfulGolem

1 messages · Page 1 of 1 (latest)

hidden fossilBOT
atomic grotto
#

hello! can you share the Subscription id?

civic hedge
#

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

atomic grotto
#

alright, gimme a while to get back to you

civic hedge
#

The setup intent was created with off_session - Is that why this is happening?

atomic grotto
#

if you didn't set either, then the Subscription wouldn't know what PaymentMethod to charge

civic hedge
#

Hmm, but it uses the payment method on the customer no?

#

That was added via setup intents?

atomic grotto
#

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

civic hedge
#

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?

atomic grotto
#

did you create / collect the PaymentMethod for the customer prior to creating the Subscription Schedule with a SetupIntent?

civic hedge
#

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?

atomic grotto
#

nah, it's alright, i don't need to see the code

civic hedge
#

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

atomic grotto
#

out of curiosity, why don't you wait to create the Subscription Schedule after you've successfully collected/created the PaymentMethod?

civic hedge
#

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 ^^

atomic grotto
#

maybe lets take a couple of steps back

civic hedge
#

Let me try that hehe

atomic grotto
#

why do you need to delay the subscription creation too?

civic hedge
#

You mean delay the start date of the subscription?

atomic grotto
#

yep

civic hedge
#

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

atomic grotto
#

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

civic hedge
#

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

civic hedge
#

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

atomic grotto
civic hedge
#

Do I need to add a customer or just advance the time? because i advanced the time, and the invoice is still in draft

#

Oh yea looks I do