#gunwant_dev-Subscription Schedules
1 messages · Page 1 of 1 (latest)
Hello
could you please give me the subscription schedule id or the request id? here's how you can find one https://support.stripe.com/questions/finding-the-id-for-an-api-request
Find help and support for Stripe. Our support center provides answers on all types of situations, including account information, charges and refunds, and subscriptions information. Get your questions answered and find international support for Stripe.
Ya sure.
subscription schedule id : sub_1L80QNHWMWhDPqNoBO2qW4lw
this is the subscription id
no worries I will find it
fyi, it's sub_sched_1L80QNHWMWhDPqNoz6ZDWMMI
Ohhh sorry.
sub_sched_1L80QNHWMWhDPqNoz6ZDWMMI
Yes
Hey, actually I want client_secret when the subscription schedule is created.
Can you please help me how can i get?
Hello, Are you there?
yes sorry I'm still looking into it
Okay.
Take your time.
Hey, taking over here! The resulting invoice is still a draft. The PI will be created once finalised
Okay
Let me check it.
Hello
can you please check it?
Is it an excellent way to get client_secret.
try {
const schedule = await stripe.subscriptionSchedules.create({
customer,
start_date: 'now',
end_behavior: 'cancel',
phases: [
{
items: [
{
price: priceId,
quantity: 1
}
],
iterations: 3
},
],
expand: ['subscription', 'subscription.latest_invoice', 'subscription.latest_invoice.payment_intent']
});
console.log('Schedule Info', JSON.stringify(schedule, null, 2));
const subscription = await stripe.subscriptions.update(
schedule.subscription.id,
{
expand: ['latest_invoice.payment_intent'],
payment_settings: {
payment_method_types: ['card', 'us_bank_account']
},
}
);
console.log('subscription', JSON.stringify(subscription, null, 2));
const invoice = await stripe.invoices.finalizeInvoice(
subscription.latest_invoice.id
);
console.log('invoice', JSON.stringify(invoice, null, 2));
const paymentIntent = await stripe.paymentIntents.retrieve(
invoice.payment_intent
);
console.log('paymentIntent', JSON.stringify(paymentIntent, null, 2));
res.send({
subscriptionId: subscription.id,
clientSecret: paymentIntent.client_secret,
});
} catch (error) {
console.error('error', error);
return res.status(400).send({ error: { message: error.message } });
}
const invoice = await stripe.invoices.finalizeInvoice(
subscription.latest_invoice.id
);
You can expand the payment_intent field here
Prevents having the additional API call to retrieve the PI
Okay.
But It shows only a single payment method.
I'm not sure what that means?
I have added two payment_method_types.
payment_method_types: ['card', 'us_bank_account']
But when I have initialized the stripe payment element using client_secret it shows only the card payment element.
Can you share the pi_xxx ID?
pi_3L81AvHWMWhDPqNo1kDTZOuQ
Do you meet all the requirements for that payment method? https://stripe.com/docs/payments/ach-debit
i.e. located in USA?
I only see:
payment_method_types: [
"card"
],
Please look this code:
try {
const schedule = await stripe.subscriptionSchedules.create({
customer,
start_date: 'now',
end_behavior: 'cancel',
phases: [
{
items: [
{
price: priceId,
quantity: 1
}
],
iterations: 3
},
],
expand: ['subscription', 'subscription.latest_invoice', 'subscription.latest_invoice.payment_intent']
});
console.log('Schedule Info', JSON.stringify(schedule, null, 2));
const subscription = await stripe.subscriptions.update(
schedule.subscription.id,
{
expand: ['latest_invoice.payment_intent'],
payment_settings: {
payment_method_types: ['card', 'us_bank_account']
},
}
);
console.log('subscription', JSON.stringify(subscription, null, 2));
const invoice = await stripe.invoices.finalizeInvoice(
subscription.latest_invoice.id,{
expand: ['payment_intent'],
}
);
console.log('invoice', JSON.stringify(invoice, null, 2));
res.send({
subscriptionId: subscription.id,
clientSecret: invoice.payment_intent.client_secret,
});
} catch (error) {
console.error('error', error);
return res.status(400).send({ error: { message: error.message } });
}
After subscription schedule I have updated subscription payment method.
also make sure you have ACH enabled as a payment method on https://dashboard.stripe.com/settings/billing/invoice , Invoices are weird and use their own separate settings
ACH enabled in my stripe dashboard payment method.
on the specific page I linked though?
there are two separate places in the dashboard settings for payment methods unfortunately, Invoices have their own page and settings
Okay.
Let me check it
I checked and it's not enabled there
so I'd give that a try quickly and see if it helps
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
nope not that page
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
ah, you do have it enabled there
Okay
hmm, I really don't know then
ah, great(I guess you enabled it just now)
Yes.