#Lime
1 messages · Page 1 of 1 (latest)
If you wish to check whether the customer's subscription has been paid, I'd recommend checking invoice status of a subscription using List Invoice API with subscription set: https://stripe.com/docs/api/invoices/list#list_invoices-subscription
This will return all the invoices on this specific subscription. The most recent invoices will be listed first.
this will work for coupons that give 100% of discount too?, i mean, i need to check if a subscription is active, so i'm not sure if the invoice check the subscriptions that use coupons to be activated
$0 invoice will be generated with 100% discount.
Are you using Webhook or API to check the subscription status? If you use Webhook, you can listen to invoice.paid event for successful payment. If you use API, you can Invoice API with subscription set to check the invoice status or Subscription API to check the subscription status.
i'm using the API, the subscription has a basic value of $1 where i'm using to test it, i'm kinda confuse about how to verify if someone has a already active subscription because when i request some info from the API has multiple places with "paid": true and "status": paid, so i'm thinking which one i should use for reference, but i believe should be the status right?
Yes, you should refer to status field
so maybe i'm doing something wrong? because when i try to access it from my code i get a paid status but when i access it from the website events i see it has a canceled status
Could you share the subscription ID (sub_xxx), so that I can have a check?
here: sub_1MPvdWHrlhnqjXtyJnGAIp5E
This is expected. The invoice was paid, but you made a request to cancel the subscription afterwards: https://dashboard.stripe.com/logs/req_6Jq9kpeMoY4bbl
so how i can check if a subscription has a canceled status? i'm trying to build a code where i check when someone has a active/unpaid or canceled subscription
I'd recommend subscribing to Stripe Webhook events: https://stripe.com/docs/webhooks
Stripe will send webhook events to inform you about any changes on the subscription. These are the events that you can listen to for a subscription: https://stripe.com/docs/billing/subscriptions/webhooks
Since you're using Checkout Session, Stripe will send checkout.session.completed event when the subscription is successfully subscribed. If a subscription is cancelled, customer.subscription.deleted will be sent. Take sub_1MPvdWHrlhnqjXtyJnGAIp5E as an example,
- Initial successful subscription with
checkout.session.completedevent: https://dashboard.stripe.com/events/evt_1MPvdYHrlhnqjXtyrdWmMfzL - Cancelled subscription with
customer.subscription.deleted: https://dashboard.stripe.com/events/evt_1MQik2HrlhnqjXtyTg3c6PRu
If you only want to use API, then you can use Subscription API to check the subscription status and not using Invoice API
alright, got it, ty for the help