#icurrytheteam

1 messages · Page 1 of 1 (latest)

crimson dawnBOT
broken kelp
#

So to give some background information, I have a website where users can subscribe to vendors for their content. In the subscription flow, it'll automatically use their default payment (should it exist) or they'll enter in some card/bank info.

dusk pivot
#

Hi there, I don't quite understand the requirement, can you bring in a use case so that I can better understand you?

broken kelp
#

Yeah, sure.

#

So say for a example a customer wants to subscribe to a vendor. They click the subscribe button and enter their payment information. On the backend, I'm passing the clientSecret to the frontend so that I can do "confirmPayment". Thing is, there are instances where it takes some time load and if the user closes the page (or something like that, maybe power goes out), then the subscription invoice status will be left in pending. So I'm asking if Stripe handles instances like these or do I need to have a webhook or cron job that handles this. Does this make a little more sense or no?

dusk pivot
#

then the subscription invoice status will be left in pending. -> Do you have example that I can take a look?

broken kelp
#

How would I show you? Would I recreate these actions?

dusk pivot
#

So it's just a hypothesis, not a problem that you are currently solving, am I right?

broken kelp
#

I'll admit, this is going to sound rather strange but this is an issue that my associate/coworker is reporting and I'm not understanding.

dusk pivot
#

OK, do you have the invoice ID or subscription ID?

broken kelp
#

I can get it for you, but I'll need a second. Is that ok?

dusk pivot
#

Sure

broken kelp
#

Great, thanks.

#

Ok, so he's not answering at the moment but I believe that this is the invoice ID - in_1Mb8zFKwCfM7dUhHoho8W6uO

dusk pivot
#

OK, so this invoice's status is open and it's not yet paid.

broken kelp
#

Yes

#

Im not sure if the default payment method was provided before the subscription was created, but if it was, then it shoudlve used that

#

If not, then it wouldve allowed the user to enter a payment method.

dusk pivot
broken kelp
#

Auto_advance? May I have a second to read this?

#

Is this something that I must do while I call stripe.Subscription.create()? I can access the invoice from the subscription and modify it.

#

I'm seeing that this can be used for modifying the invoice directly.

dusk pivot
#

Let's take a step back. What's the problem that you want to solve here?

#

So far I only see you create a subscription, and it's first invoice is not yet paid.

broken kelp
#

I want to create a subscription and pay its first invoice

dusk pivot
#

OK, how do you intent to pay it?

broken kelp
#

By either using the customer's default payment method (should it exist), or by letting the user enter card/bank details

dusk pivot
broken kelp
#

May I ask why that's the case even though I see, in the dashboard, a default payment method listed?

dusk pivot
#

What's the ID of the customer that you are looking at?

broken kelp
#

cus_NLqMaaIIoOHuJI

#

When I create the subscription, I check the default_source and invoice_setting.default_payment_method fields.

dusk pivot
#

I see, this customer has a default_source field set.

broken kelp
#

Yes, so when creating the subscription, shouldn't the default_source be the payment method used?

dusk pivot
#

Let me take a look

broken kelp
#

ok

#

Any updates or no?

dusk pivot
#

Thanks for waiting.

broken kelp
#

Yeah, np

dusk pivot
#

If you have already set the customer's default_source, and you wish to use this source to pay the invoices generated by subscription. You should set payment_behavior to allow_incomplete instead of default_incomplete

#

By setting payment_behavior to allow_incomplete, Stripe will automatically attempt the first invoice with available payment_method after subscription creation.

broken kelp
#

I have an if statement that checks the default_source and invoice_setting.default_payment_method fields. If both are empty, then I want the user to enter their card/bank info. I'm using default_incomplete to achieve this functionality. Are you saying that I should switch it to allow_incomplete instead?

dusk pivot
#

Let me summarize

  • If your customer has a default_source or invoice_setting.default_payment_method, set payment_behavior to allow_incomplete
  • Otherewise, set payment_behavior to default_incomplete
broken kelp
#

Correct. What I'm trying to do is always use a customer's "default payment method" for a subscription. However, there are cases where they may not have one saved, so I want to let them enter payment info for the transaction to be completed.

#

Is what I'm doing making sense?

dusk pivot
#

It looks good to me

broken kelp
#

Ok and I have a frontend setup using stripe elements.

#

I can use confirmPayment to complete the payment.

#

But when I inspect the status of the payment intent, say it's processing.

#

What happens if I close my browser while the status of the payment intent is still processing?

dusk pivot
#

Do you have the PaymentIntent ID?

broken kelp
#

pi_3Mb8zFKwCfM7dUhH29L2ScVm

#

this should be it

dusk pivot
#

The status of this PI is requires_payment_method

broken kelp
#

so it acts as if the payment method was never captured?

#

Am i going to have to handle this using a webhook or cronjob?

dusk pivot
#

No, I don't see this PI went to processing status at all.

#

https://stripe.com/docs/payments/intents This is the lifecycle of a PaymentIntent. In most of cases a card paymentIntent won't go into processing status. The processing is for paymentIntent that was paid with certain payment method which payment result can't be confirmed immediately (i.e., ACH)

Learn about the status and lifecycle of PaymentIntents and SetupIntents.

broken kelp
#

Let me take a look a tthis

#

How long does it take for transactions to process if purchasing a subscription with a us bank account?

dusk pivot
broken kelp
#

Since we are accepting bank payments, how would we handle a situation where bank transactions take multiple days?

dusk pivot
broken kelp
#

ok great