#HM-invoice
1 messages ยท Page 1 of 1 (latest)
@brave mauve Here is my test code ๐
Just as a reminder, you should never share your secret API keys, regardless of whether it's a test or live mode key. You may want to roll your test mode key immediately as the one you sent is now considered compromised: https://dashboard.stripe.com/test/apikeys
Okay thanks I'll change the test API key. I'll be careful.
i see that you were using cus_KuyqiChzw3PEth, let me take a quick look and get back to you
okay thank you๐
if i understood your question correctly, you have a subscription, and you want to check the datetime of when the subscription will be invoiced next?
you can retrieve current_period_end [0] of the subscription. As the docs mention
End of the current period that the subscription has been invoiced for. At the end of this period, a new invoice will be created.
[0] https://stripe.com/docs/api/subscriptions/object#subscription_object-current_period_end
@brave mauve For example, current_period_end is '2022-02-13 03:46:56'. It means next invoice will be created "2022-03-14 00:00:00" and charge customer's payment?
or on '2022-03-13 03:46:56'?
if current_period_end is '2022-02-13 03:46:56'. It means next invoice will be created ~'2022-02-13 03:46:56' -> there may be some delay when the invoice is created and finalized
May I inform the customer that they will be invoiced and charged on 02/13/2022? (May be I setted 'auto_charged' option)
Am I understanding correctly?
It may be delay, so I will do not display time.
hmmm, i think there's a chance that if they started their subscription close to midnight, if there's a delay, they may be charged the following day
you may want include a warning or some info that informs the user that there may be instances where the charge is delayed slightly, i think it should be fine
hm.. okay, I will do that ๐
Thank you @brave mauve
I have a webhook.
When the next invoice is charged, does the webhook event type come in as 'subscription_schedule.created'?
maybe the first question is, what are you trying to do?
My customer have a subscription and paid it.(auto charged). If my customer payment "next invoice", what is do I receive the event response 'type' by webhook?
'subscription_schedule.created' right..?
maybe let me rephrase my question, what are you trying to do after you receive this event?
that'll help me be able to better advise you
A customer pays the next invoice. Then we will give that customer our points when we receive the webhook's response.
i would suggest listening for the invoice.paid event [0]
[0] https://stripe.com/docs/api/events/types#event_types-invoice.paid
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
I was debating between "subscription schedule.created" or "subscription schedule.created". I will proceed with "invoice.paid" Thank you!!
i was thinking that you would provide them points every time they pay an invoice right?
this isn't only limited to the first time a subscription is created
if one customer create a subscription, we give customer points for each month when create invoice for that subscription once a month.
so how I know my customer paid invoice for subscription once a month by webhook?
is your subscription monthly?
yes right
"plan": {
"active": true,
"aggregate_usage": null,
"amount": 5000,
"amount_decimal": "5000",
"billing_scheme": "per_unit",
"created": 1638259085,
"currency": "usd",
"id": "price_1K1RE1EhcKQZEEpHRx6yObTg",
"interval": "month",
"interval_count": 1,
"livemode": false,
"metadata": {},
"nickname": null,
"object": "plan",
"product": "prod_Kgorr1N0UYikOS",
"tiers_mode": null,
"transform_usage": null,
"trial_period_days": null,
"usage_type": "licensed"
},
"interval" is setted "month"
then it makes sense to use invoice.paid
thank you so much!