#nicefellow1234
1 messages · Page 1 of 1 (latest)
Hi there. Let's chat in this thread
Ok, sure.
I am trying to fetch paymentIntent id linked to the subscription through list endpoint. How will I be able to fetch that?
I am using the following endpoint code:
$subscriptions = \Stripe\Subscription::all([
'status' => 'active',
'expand' => ['data.customer.invoice_settings.default_payment_method']
]);
You would need to expand the latest invoice: https://stripe.com/docs/api/subscriptions/object#subscription_object-latest_invoice
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Payment intent is on the invoice: https://stripe.com/docs/api/invoices/object#invoice_object-payment_intent
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Can you confirm the value that I would need to pass under expand key array?
data.latest_invoice
I believe data.latest_invoice.payment_intent
$subscriptions = \Stripe\Subscription::all([
'status' => 'active',
'expand' => [
'data.customer.invoice_settings.default_payment_method',
'data.latest_invoice'
]
]);
Will this expand payment_intent as well under latest_invoice?
Ofcourse I just confirmed when I don't mention the payment_intent in the expand parameter so it doesn't expand the payment_intent object in the invoice but rather the payment_intent stays a string in there but then when I mentioned it so it expanded it as well.
Yeah. Recommend taking a look at: https://stripe.com/docs/expand