#mathan
1 messages · Page 1 of 1 (latest)
Hi
You can refer to the latest_invoice of the subscription and check its status:
https://stripe.com/docs/api/subscriptions/object#subscription_object-latest_invoice
You can refer to just the latest invoice of the subscription. Because otherwise the Subscription will expire if its invoice remains unpaid for 23 hours
how can I query the latest invoice using php query any example?
Yes you can retrieve the Subscirption using this API:
https://stripe.com/docs/api/subscriptions/retrieve?lang=php
how to get latest invoice using this query
i need to add something?
$stripe->subscriptions->retrieve(
'sub_1MWEUT2eZvKYlo2CRdShBOrG',
[]
);
Yes and add the expand param on the latest_invoice
https://stripe.com/docs/api/expanding_objects?lang=php
$stripe = new \Stripe\StripeClient("sk_test_your_key");
$stripe->charges->retrieve(
'ch_3MWJ912eZvKYlo2C0lfK51Nb',
['expand' => ['customer', 'invoice.subscription']]
);
this is ok for lates invoice or all invoice
i need latest onlye
The example is for charges API. You need to adapt it to the Subscription API:
$stripe->subscriptions->retrieve(
'sub_1MWEUT2eZvKYlo2CRdShBOrG',
['expand' => ['latest_invoice']]
);
greate let me check
when i changes to other plan, invoice is in draft so how can check this not paid
Not sure what you mean?