#bboystatix

1 messages · Page 1 of 1 (latest)

plucky beaconBOT
jovial wedge
#

Can you share the subscription IDs (sub_xxx)?

prisma slate
#

here's the customer id cus_OvVONFETyGrC5o

#

sub_1O83ZwImFOsfVEtUMjFZjsgM

#

sub_1O83YaImFOsfVEtUBFugkkFy

jovial wedge
#

Thanks for sharing! The subscription creation was made by your server:

Your system shouldn't create a new Subscription (that will create new payment intent under the hood). It should re-used the re-used the payment intent from the first created subscription.

prisma slate
#

Why did the other payment intent get accepted after adding card though

#

is it stripe behaviour?

#

i wanted to leave the older sub as incomplete while creating the new sub

#

and personally im not able to reproduce this issue locally even after following what the customer did

#

in the backend i create sub in this way

subscriptionParams := &stripe.SubscriptionParams{
        Customer:           stripe.String(customerID),
        Items:              priceItems,
        PaymentBehavior:    stripe.String("default_incomplete"),
        CollectionMethod:   stripe.String(string(stripe.SubscriptionCollectionMethodChargeAutomatically)),
        BillingCycleAnchor: stripe.Int64(getBillingAnchorDate().Unix()),
}
#

i know that i can reuse payment intent but i think my approach is also fine

jovial wedge
#

Your system set the saved payment method in invoice_settings.default_payment_method on the customer which will be applied to all subscriptions without setting its own default_payment_method: https://dashboard.stripe.com/logs/req_iT4YKknyZNMQgN So yes, this is the expected behaviour.

If you wish to only apply the payment method on a specific subscription, the payment method shouldn't set to invoice default on customer. It should be saved to subscription's default_payment_method instead: https://stripe.com/docs/api/subscriptions/update#update_subscription-default_payment_method

#

Re-using the payment intent/subscription is still the recommended approach

prisma slate
#

Yes my logic is set such that customer adds card and then i make a subsequent request to make that card default payment method

#

and only after that we create subscription

#

hmm so ur saying that would auto-charge the failed payment intent?

#

im wondering why im not able to reproduce this locally tbh

#

locally the behaviour i saw was that the incomplete sub remained as incomplete

jovial wedge
#

hmm so ur saying that would auto-charge the failed payment intent?
Yes! When a subscription is created and invoice_settings.default_payment_method is set, it will be charged automatically. If the subscription isn't in use, you should cancel the subscription and void the invoice

prisma slate
#

This is me doing the same thing locally
cus_OnBy2dOcpLBrBl
sub_1O8InyImFOsfVEtUVYefPBDB
sub_1O8InUImFOsfVEtUsjX6hAvp

#

So what about the above case in local, one of my subs remains as incomplete

#

will it be charged after a delay or something?

jovial wedge
prisma slate
#

interesting...

#

how can i simulate my customer's case with an appropriate card

#

they usually successfully set up card and fail on the payment due to insufficient funds

#

due to which they then add a diff card which works and thus they sub successfully

prisma slate
jovial wedge
#

The retry of invoice payment doesn't happen immediately and it will take some time

prisma slate
#

hmmm...

#

i see that would make sense

#

ill try waiting for a bit

plucky beaconBOT
prisma slate
#

hmmm still no change

#

maybe on test environment there's no smart retry? or the schedule is different?

arctic granite
#

There's no preset retry schedule, so the actual retries could happen anytime in the next week

#

Just call the /pay endpoint on the invoice directly

prisma slate
#

i knew about smart retries, just never knew they also applied to incomplete subs

#

thought it was only for already created subs,. subsequent recurring charges

#

do the docs explain this?

prisma slate
#

hmm then i wonder what would be the cause behind this customer's double sub

arctic granite
#

Not sure what invoice payment retires have to do with double subscriptions. Looks like your integration just created 2 subscriptions for some reason:

prisma slate
#

Hmm please look above in the convo for context

arctic granite
#

Can you summarise please

prisma slate
#

Basically customer adds card successfully -> subscribes -> fails due to insufficient funds -> edits card -> subscribes again -> success

#

some things to note are

  1. during add card i use setup intents, and after success i set it as their default card
arctic granite
#

Not sure what is unexpected there

prisma slate
#
  1. everytime u press sub it would create a new sub via backend. that shouldnt be an issue cuz the first sub which failed is incomplete
#

the expected result should be that the second time pressing subscribe the user creates a subscription successfully while the previous one remains incomplete

arctic granite
#

As stated by my colleague, if you update invoice_settings[default_payment_method] and then create a new subscription will will use that new PM to automatically confirm the invoice/payment. The old, incomplete sub is impacted (and we don't retry initial sub payments)

prisma slate
#

hmmm i see

#

so the old open invoice belonging to the incomplete sub

#

payment gets attempted on that automatically

#

correct?

arctic granite
#

Maybe I was wrong and we do retry that and that what paid it

#

If you want to test this, you're better off using a test clock

prisma slate
#

Hmm yeah I can try

#

I’m wonder if smart retries work on test environment

arctic granite
#

So somebody opened the URL for the invocie and input new card details to pay that invoice

prisma slate
#

Hmmm…

arctic granite
#

So yeah I'm 99% sure we don't retry initial invoice for a subscription like that one, just subsequent recurring ones

prisma slate
#

Yeah I feel that way too honestly, as for the invoice url I’ll need to investigate this

arctic granite
#

Ah, weird. Well it indicates that the invoice was paid by the hosted invoice surface (the URL all invoices have generated for them)

#

So I'd guess we sent that link to the user via email after the initial payment failed (if you have that setting enabled) and then paid it via that web URL

#

Nothing to do with retries or the 2nd subscription you created

prisma slate
#

cus_Mr1dUnpwSCmtxe
cus_NfJBpYFNkiYUji
cus_OUvJXQvw6L9H7z
cus_OkFWMSkH74mAD4
cus_OvVONFETyGrC5o

#

is it the case for these users as well?

arctic granite
#

Can you share some specific sub_xxx IDs? And is what the case exactly?

prisma slate
#

basically these customers also have the dual subs issue

heady heron
#

Hi! I'm taking over this thread.