#maufcost - SS Payment Intent confirmation
1 messages ยท Page 1 of 1 (latest)
HI again ๐
There is a beta feature for this. We cannot discuss it on Discord but you can request early access to start testing it out here:
https://stripe.com/docs/payments/finalize-payments-on-the-server
Awesome. Thanks. Another quick question: I'm trying to get the client secret from a subscription schedule I am creating with:
const schedule = await stripe.subscriptionSchedules.create({
customer: customerId,
start_date: 'now',
end_behavior: 'cancel',
phases: [
{
items: [{
price: price.id,
quantity: 1,
}],
iterations: numberOfIterations,
},
],
// Allows us to simultaneously create a payment
// intent and get its client secret.
expand: ['subscription.latest_invoice.payment_intent']
})
However, the .paymentIntent property is always null when I try to access: schedule.subscription.latest_invoice.payment_intent.client_secret.
Can you share the ID of the subscription schedule?
Yes: sub_1LKQHJDTqg4XgBDsV493w2U9
The payment Intent for that invoice (in_1LKQHJDTqg4XgBDsksEXdEqh) is null. ๐ค
Correct
Is there another property I should be passing perhaps when creating the subscription schedule?
Checking on that
Oh, got it!
The invoice is in draft mode
It'll stay that way for 1 hour to allow an last minute changes
The Payment Intent gets generated once the Invoice is finalized
It does that inherently? Isn't there a way for me to get the client secret immediately so that I can charge the customer at the time the user is on the checkout page?
In this case it has to do with the fact you created the sub through a schedule. You can speed the process along by finalizing the Invoice through the API.
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
So, I can create the subscription schedule with the call I currently have and then create another call to finalize an invoice instantaneously?
Yeah so you would just retrieve the subscription.latest_invoice ID value and use that in the Finalize API call
Got it! And after finalizing the invoice, how can I retrieve its PI?
You would pass the expand parameter on the Finalize API call. expand=['payment_intent'] and retrieve the client_secret
Sweet! Thanks a lot again ๐