Gopi Vetrivel
unread,Feb 24, 2025, 1:20:26 PMFeb 24Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Stripe API Discussion
We have two products in Stripe:
1. **Product One** (e.g., $2)
2. **Product two** (e.g., $6)
We're developing in Java Spring boot with Thymeleaf.
Initially, a user can select the quantity of the Product 1, and the Product 2 is optional. For example, a client might purchase 30 product one with 10 product two. When this happens, we create a subscription in Stripe and map the subscription ID to our database for future reference.
If the same customer wants to add more quantity to either or both products later, we need to retrieve the existing subscription using the stored subscription ID. Then, we must calculate the prorated charges for the new additions and display this amount in our application's embedded UI.
The first time a subscription is created, it handles recurring payments. For subsequent additions, we use the subscription ID to create a payment session. However, we're facing challenges in accurately calculating and displaying the prorated amount for the new quantities, considering the remaining time and unused portion of the existing subscription.
Our goal is to calculate the prorated charges for the new quantities (for the current month) and ensure the recurring payments are handled correctly by the subscription. How can we achieve this calculation and display the correct prorated amount for the additional quantities?
Thanks
Gopi V