I am using Stripe to test how my code would react to recurring subscription renewal payment attempts for a product we are working on (need to test success, failure ...etc.). And it seems that most answers on StackOverflow suggest creating a subscription with a recurring payment of 1 day (which is the minimum recurring payment available at Stripe), and waiting until next day to see how my code would react to the webhook notifications. (By the way, I could not find much documentation on Stripe to suggest testing methodologies for recurring payment).
I do not agree much with this approach, because it stretches the testing of my code to more than a week, maybe even two, but in normal conditions I might finish that testing within a couple of hours.
I think one of the following two approaches would be sufficient to do my coding/testing.
Find a way to make recurring subscription interval happen on shorter custom periods, such as every 15 minutes, or every 10 minutes.
A better solution is to make recurring subscriptions trigger on demand. That is, I create a subscription, and then I would update the date for the next renewal manually to a custom value, such as "1 minute in the future" or "30 seconds in the future" which would trigger the payment attempt.
Is there a way of doing any of those two options in Stripe? If neither is a viable option, how do I test recurring payments efficiently.
Thanks.
Testing paymentsYou can issue cards and simulate purchases using your own Stripe integration in test mode. This allows you to test your integration before you go live without having to make real purchases. You can only use these cards for testing within your Stripe account and not for external purchases.
Viewing Test Transactions in Your Stripe Account To begin, you'll need to log in to your Stripe account. Then click on Payments in the menu at the top of the screen. Next, near the top right corner of the screen, toggle on the Test Mode option.
To your actual question, to find any active subscriptions on that customer, you can look at the subscriptions property on the customer response (https://stripe.com/docs/api#customer_object).
Our solution was to reset the billing cycle of the subscription.
This will trigger a new subscription payment and all the associated webhooks.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With