#iambhanu-subscription-approve-payment

1 messages ยท Page 1 of 1 (latest)

blissful voidBOT
dreamy cave
#

Hi ๐Ÿ‘‹ the flow sounds a bit complex, so I'm not exactly sure this is what you're looking for, please let me know if it doesn't accomplish what you're hoping.

You can look at using default_incomplete as the payment_behavior for the Subscription. That will cause the Subscription to be created in an incomplete state, and it will remain there until you confirm the first payment.
https://stripe.com/docs/api/subscriptions/create#create_subscription-payment_behavior

bitter eagle
#

Yes, I already use, this method but in this case I want to retrieve the payment method of the user and save it in the subscription so when the admin approves the request, I will do the subscription paid for a particular user subscription.

dreamy cave
#

iambhanu-subscription-approve-payment

bitter eagle
#

Can you just let me know, how can I do that like if a user creates a subscription with the provided parameters and I just want to subscription should be paid when the admin wants or you can when the admin triggers something at this time I will perform a code of stripe, the particular subscription user has purchased that will be paid at that time.

#

\Stripe\Subscription::create([
'customer' => $customer->id,
'items' => [[
'price' => $price_id,
'quantity' => 1,
]],
'payment_behavior' => 'default_incomplete',
'payment_settings' => ['save_default_payment_method' => 'on_subscription'],
'expand' => ['latest_invoice.payment_intent'],
]);

dreamy cave
#

Oh, sorry, I think I understand now.

What I would recommend is:

  1. Use a Setup Intent to render your Payment Element and collect payment method details from your customer:
    https://stripe.com/docs/payments/save-and-reuse?platform=web&ui=elements
  2. Create the Subscription, setting:
    payment_behavior to default_incomplete
    default_payment_method to the ID of the Payment Method created by the Setup Intent from Step 1.
  3. When you're ready to process the first payment for the Subscription, confirm the first Invoice's Payment Intent. (You will want to have a flow ready in case the payment fails because an SCA/3DS challenge needs to be completed, in which case you'll need to bring your customer back on-session to complete that authentication challenge)
blissful voidBOT
bitter eagle
#

I don't think you understand

#

See the above screenshot

#

The is the coach profile

final current
#

๐Ÿ‘‹ stepping in here as toby needed to step away

bitter eagle
#

When a coach creates a profile, they will have to fill in all the validated profiles and have to submit their profile for validation. After the successfully validated by the admin coach can buy the subscription. This is our current scenario.

#

Now my client want,
can we request the coach to subscribe first before submitting their profile?
And then we only debit when the admin validates the profiles (=official date of the start of the subcription)?

final current
#

Yeah what toby suggested is the correct flow in this case.

#

You collect a payment method via a SetupIntent

#

Then you create the Subscription later once the admin validates the profile.

bitter eagle
#

so the subscription will be created with different ID and updated in the database instead of the above screenshot right?

final current
#

Not sure what ID you are referencing.

#

But you would control when the Subscription is created here

bitter eagle
#

I am referring subscription ID

bitter eagle
final current
#

That's correct

bitter eagle
#

Can I update the stripe subscription "incomplete" to "paid"?

final current
#

It will automatically update to active when the latest invoice is paid

#

If you are starting the Subscription later on after collecting the PaymentMethod then you can actually use payment_behavior: allow_incomplete

#

Which will trigger a charge attempt immediately on the first Invoice

#

This will work since you already have a PaymentMethod

bitter eagle
#

When a coach buys the subscription, I am just collecting the payment information of them and creating a subscription with the status of "Incomplete". When admin validates the profile, can I update the subscription "incomplete" to 'active' and the invoice paid? If "yes" can you suggest me the code? what code I can use to paid the existing subscription?

final current
#

Well do you want the Subscription start date to be when you collect the payment method or when the admin validates the profile?

bitter eagle
#

When the admin validate

#

Ahh got it

#

So in this case, I have to create a subscription at the time of admin validate

final current
#

Yeah

#

With allow_incomplete