#fabian_api
1 messages ¡ Page 1 of 1 (latest)
đ Welcome to your new thread!
â˛ď¸ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.
âąď¸ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.
đ This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1268244509968433233
đ Have more to share? Add more details, code, screenshots, videos, etc. below.
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.
- fabian_api, 27 minutes ago, 24 messages
Subscription Schedules don't have a client secret
Do I have to go this way?
const subscription = await stripe.subscriptions.retrieve(
scheduleSubscription?.subscription.id
);
```
Sorry:
const subscription = await stripe.subscriptions.retrieve(
scheduleSubscription?.subscription
);
Do I need the client_secret to finish the payment process?
I'm not sure. Why would you need a client secret?
My current flow: User enters InvoiceData => Server creates customer => Server creates subscription for customer => Return client_secret to handle checkout.
This works for a normal subscription. Now I would like to create a Subscription with 3 month monthly billing and annually billing afterwards.
Wouldn't you already have a saved payment method in this case? Why do you need to handle checkout again?
The client secret would be on a Payment Intent, so you need to get the Payment Intent or the Setup Intent depending on what you're using
Isnt the payment intent created with the subscription?
Is there any example for a checkout process with a scheduledSubscription?
Not necessarily. The Payment Intent is created once the Invoice on the Subscription is finalized
Does this make sense:
const scheduleSubscription = await stripe.subscriptionSchedules.create({
customer: customerId,
start_date: 'now',
end_behavior: 'release',
phases: phases,
});
const subscription = await stripe.subscriptions.retrieve(
scheduleSubscription?.subscription as string,
);
const initialAmount = subscription.items.data[0].price?.unit_amount || 0;
const paymentIntent = await stripe.paymentIntents.create({
amount: initialAmount,
currency: 'eur',
customer: customerId,
payment_method_types: ['card, sepa_debit'],
metadata: {
subscription_id: subscription.id,
payment_behavior: 'default_incomplete',
},
});
You can't create the Payment Intent for the Subscription. Stripe has to do that automatically
The Payment Intent will be created once the Invoice is moved to a finalized state
It depends on your subscription flow and a number of factors. I would recommend creating a few test Subscriptions and inspecting each object to understand
Why does it work if create a normal subscription
Is there some basic example for what I am trying to achieve?
Unfortunately no, as this is not a simple integration.
How are you accepting payment method details right now? Payment Element?
yes