#alex.esch

1 messages · Page 1 of 1 (latest)

outer zenithBOT
#

Hello! We'll be with you shortly. 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.

spare yacht
#

Hello

#

How can I help?

dusky bison
#

hello
we are selling a bundle, for which one, in a feature, we are creting an subscription

right now, to increase or MRR, we are moving to selling a subscription with add_invoice_items

our checkout flow is based on payment intent + stripe elements

so, now, in case of any problem with the payment method, we are getting an error and showing it to the customer

with the new approach (setup intent, confirm, get webhook, create a subscription), how can we handle any possible errors with the payment method?

#

as far i remember, if i'll create a subscription with payment method, it will not be charged at the moment, it takes up to 1 hour

spare yacht
#

Why are you creating a SetupIntent here?

#

Why not just use the Subscription's PaymentIntent or SetupIntent to set up your Payment Method?

dusky bison
#

i'm using setupintent to set payment method

#

but "set" means attached, no?
is not being validated

spare yacht
#

Yes that is the correct way to set up a PaymentMethod

#

Are you collecting the PaymentMethod before creating the Subscription later on when your customer is not in your checkout flow?

dusky bison
#

yes

spare yacht
#

Okay

dusky bison
#

can you please confirm, if i'll create a subscription for a payment method set in setupintent, it will be charged at the moment? or it will take some time?

spare yacht
#

If you create a collection_method: charge_automatically Subscription then it charges immediately.

dusky bison
#

and in case there are no any suficint funds, i 'll get an error about it?

spare yacht
#

Yes the charge will fail if there is an insufficient funds decline

dusky bison
#

so, it will not a good idea to move this flow (creation of a new subscription) into stripe webhook callback, right?

spare yacht
#

What webhook?

dusky bison
#

setupintent.succeed

spare yacht
#

That would indicate your customer is still in your checkout flow then.... ?

#

So that is back to the beginning.

dusky bison
#

you are right...

spare yacht
#

Let's pause.

#

Are you using trials here?

#

Is the initial Invoice for your Subscription $0?

dusky bison
#

look, i'll try to explain in more details

#

right now we are selling a bundle, for 399
this bundle includes a subscription, but this subscription is create in 2 months after bundle purchase
everything is managed by a payment intent and is working fine

now, i have a requirement from marketing team, to increate MRR for our products (subscriptions)

this means, i need to charge the user and create a subscription at the moment

but, as the real subscription will become active in 2 months, i though about to

  • create a subscription
  • and just after, pause it
  • then the moment will arrive, unpause it
spare yacht
#

If the Subscription isn't active for 2 months then it is on trial, no?

#

So you would just use a trial period?

dusky bison
#

paused

#

we don't have a fixed time, when it will become active

#

it can be a month, can be 6, not depends on us

spare yacht
#

Okay still though... that is a trial. You can't pause a Subscription that was never active.

#

So really you have to use a trial here

dusky bison
#

well, ok

spare yacht
#

So here is your flow:

#

So in step 1 you want to also expand: [pending_setup_intent]

#
  1. Take that SetupIntent's client_secret and set up the PaymentMethod
#
  1. When your customer wants to activate the Subscription, end the trial.
dusky bison
#

thank you
but i need to charge the user for bundle purchase

#

this is that i'm trying to do right now
$subscription = $stripe->subscriptions->create([
'customer' => $stripe_customer_id,
'default_payment_method' => '',
'items' => [
[
'price' => $subscription_id,
],
],
'add_invoice_items' => [
[
'price' => $bundle_product_id,
],
],
]);

#

bundle price = 399

#

subscription price = 99
so in invoice items, i'm adding a custom product, for 300$

#

so my idea was to create a subscription with a payment method from setupintent
charge the user for 399$ there 99 will go to MRR of the subscription
and just after this, pause the subscription
wait till arrive the moment, and reactivate the subscription

spare yacht
#

Ah I thought you said you weren't taking any initial payment at all?

dusky bison
#

my bad, sorry

#

we MUST charge the user first

spare yacht
#

Oh okay well then yeah you still don't need a SetupIntent -- you just use the initial PaymentIntent from the Subscription to collect the PaymentMethod.

dusky bison
#

ok, so flow will be

  • create a subscription without payment method
  • get the payment intent from subscription
  • send it to frontend
  • the frontend will do all the stuff related to payments
  • the frontend will complete the payment (paymentintent confirm)
  • subscription will be created and paid
  • at the moment of receving webhook for paymentintent.complete, i'll get this subscription and will pause it
spare yacht
#

Yep

#

The key is you want to use payment_behavior: default_incomplete when you create your Subscription

#

That will ensure that the initial payment attempt isn't triggered until you pass the client_secret to the frontend and confirm on the frontend

dusky bison
#

great

#

thank you

#

last question

#

if i'll create a subscription
and the payment intent is not completed

will i receive any webhook? something like abandoned in 1 hour?

#

or i should check these orders by cron on my side and canceling this created subscriptions?

spare yacht
#

The Susbcription will moved to incomplete_expired in 23 hours if there is no successful payment

#

And a customer.subscription.updated Event will be sent for that

#

Feel free to test this out with test clocks as well

dusky bison
#

ok, and, in this case i'll be unable to process multiple subscriptions, right?
user can purchase multiple bundles at once, each one have a subscription

spare yacht
#

Once you have successfully attached the PaymentMethod from the initial payment of the first Subscripton then you can use that same PaymentMethod for other Subscriptions if you want.

#

I believe that is what you are asking?

dusky bison
#

ok

#

thank you very much!

spare yacht
#

👍