#harshil-ahir_code
1 messages · Page 1 of 1 (latest)
👋 Welcome to your new thread!
⏲️ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.
⏱️ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.
🔗 This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1397074503317717052
📝 Have more to share? Add more details, code, screenshots, videos, etc. below.
Hi there, is there a specific error you're seeing in your test?
no i am not seeing any error i am created a client secret key in my local of a customer and product which is created in stripe test mode and i am sending these to FE team and they are paying that amount in my dev server so that i am able to see the logs of payment done and event hit in first time but after there is nothing when the event is hit from webhooks ,also in my webhook i am added every event which is necessary
But once the payment is made by FE side i am calling these function in my local will it work
public TestClock advanceTestClock(String testClockId, Long seconds) throws StripeException {
Stripe.apiKey = stripeSecretyKeyTest;
TestClock testClock = TestClock.retrieve(testClockId);
TestClockAdvanceParams advanceParams = TestClockAdvanceParams.builder()
.setFrozenTime(testClock.getFrozenTime() + seconds)
.build();
return testClock.advance(advanceParams);
}
which will help me to call my recuring payment early
Are you testing recurring payments like Subscriptions or normal one-time payments like PaymentIntents?
Subscriptions
Test clocks should work with subscriptions
Yes i know and i am working on subscriptions as i have explained whole scenario to you
yes but I'm sorry, I'm having a hard time grasping the question or the unexpected behaviour. What do you mean by "call my recuring payment early?"
to clarify, once a customer or subscription is created inside a Test Clock, the Test Clock needs to be advanced in order to progress along the subscription's billing cycle
like the product i have purchase its recuring on daily basic i want to test that automatic payment is working or not on next bill so i have used the advanceTestClock method from which my next billing date will occur today only
Yes
yes i want to do that advance thing
in which i am failing to do so
what you just described here would work with Test Clocks
What is the error you're seeing?
or could you share with me the Subscription ID so that I can have a better look at your integration ?
Thats the thing i am not seeing any error for now the first time i am able to see the event triggered and called from webhook in my server logs but after advancing the clock i am unable to check it
i havent stored subscription id but maybe these event logs help you to check the scenario
in these you can get subscription id also easily
sub_1RnJExEO9jafft5P1mJbhwaB
your subscription's second invoice is still in Draft mode
Means ??
sub_1RnIqeEO9jafft5PNleZpFOY
sub_1RnIQOEO9jafft5PB2ghBONR
before that i have created these subscription also
I believe this is the webhook endpoint you've set up - we_1QtSq5EO9jafft5PjBMVeQxP — this webhook endpoint is not set to listen to invoice.created or invoice.finalized events, this is likely the reason your webhook didn't receive events when your test clock advanced.
Invoice being in Draft means that Stripe hasn't initiate payment: https://docs.stripe.com/invoicing/integration/workflow-transitions
For subscriptions' invoices, Stripe takes an hour to finalize the invoice from the invoice creation time: https://docs.stripe.com/billing/invoices/subscription
it is shown in the Dashboard that payment will be collected at 7/22/25, 7:21 PM
i have just used invoice.paid for payment in which i am updating the data for my database which come in my first payment these event is trigger and i am updating my data should i need to add other event also for recuring payments not the first one
yes thats what i want to check that it will automatically deducting the payment or not
yes and with the testclock i want to check it now before billing date
It should automatically deduct the payment. You can advance your test clock to July 22, 2025 | 7:30 PM GMT+5:30 to check
Could you clarify what you meant by "checking it now before the billing date"? The subscription charges automatically so the customer will be billed when the invoice finalized on 7/22/25, 7.21PM.
..?
like for the one day billing recuring payment i want to test that payment today only after my first payment done
invoice.paid should be sufficient. There isn't specific Stripe events sent for recurring payments
You cannot test recurring payments sooner than expected
because you have said here that i am not using invoice.created and another event thats why
cant i with testclock in test mode ??
No, the subscription will follow Test Clock's time. Your test clock time is currently at 6:21PM and the invoice is set to finalize at 7:21PM. It is not possible to trigger the payment sooner
i want to test the trigger event is working properly or not by automatic deduction
for today ??
also i have a question how test clock works like suppose my billing duration is daily and if i passed 24 hours in advanceClock so will it trigger the event now or i want to add the time like 5 minutes with that testclock id so that my event trigger in 5 minutes
then how can i trigger the payment event sooner as testclock help us to test it sonner
It is not possible to trigger payment events sooner than expected with Subscriptions. Subscriptions follows a billing cycle and each subscription has a billing cycle anchor [0] that determined when recurring payments are collected.
Using Test Clocks will not help trigger payment events sooner than expected. If the invoice finalized at 7:21PM but the Test Clock's time is set at 6:21PM, you have to advance your test clock past 7:21PM to verify that the subscription's invoice has collected payment.
It shouldn't matter whether you advance 24hours or with an additional 5 minutes as long as the new test clock time takes into consideration the one hour invoice finalization time. Therefore, if your test clock time is at 6:21PM but your invoice finalized at 7:21PM the next day, you need to advance your testclock 25 hours ahead, plus ~few minutes ahead to be sure your test clock passed the invoice finalization time.
[0] https://docs.stripe.com/api/subscriptions/object#subscription_object-billing_cycle_anchor
Okay can you just let the chat opened so i can test the code withthese logic
we close idle threads on Discord but you can always start a new thread if you have another question.
will these new threads will continue these chats
nope it will not be a continuation. You will be prompted to post a new question
sub_1RnaSREO9jafft5PgicWHS7k
can you check for these subscription whats the next payment time as i have already added advanced clock time for 25 hours
@winged horizon you there ??
@whole needle your subscription's next payment is set to invoice on Jul 24, but your test clock time is currently at Jul 23
I would recommend advancing the test clock in the Dashboard so that you can very its current time to avoid any confusion
how can it be possible when i have added 25 hours and created a daily plan
how can i do these
You can click on the Advance time button at the top right of the purple banner
Okay thank for the info after advancing the time my event didnt trigger invoice.paid event it just only triggered invoice.created,dont my invoice automatically should be paid in subscription ???as i suscribe it
Hey! Taking over for my colleague. Could you please share the invoice Id you are referring to ?
in_1RnarjEO9jafft5PNRICAPCy
i get event of invoice created but i am using subscription and automatic payment will be done and i have added invoice.paid for recuring payment in my webhooks
THis invoice in still in draft mode, try advancing the test clock by 1 hour and it should be finalized and paid
It worked thanks for you support @delicate burrow & @winged horizon