Stripe Refund Monthly and Yearly - stripe-payments

I have a question about refunding in this flow:
2 Subscriptions -> Monthly 5$, Yearly 45$
My refunding period is one hour. After one hour the button dissapears and you cannot refund anymore.
My problem is if the user buys monthly for 5$, and then imediately upgrades to Yearly it takes 40$ because of proliferations.
Then i have 2 payment intents that can be refunded in one hour(one for monthly and one for yearly).
And i need to keep them both in my DB and create logic to refund both 5$ monthly an 40$ yearly if the user wants the refund in that hour. Because if not, i will refund 40$ and the user looses 5$ if he executes this flow and i don't want him to loose money if he can refund in 1 hour range.
Is it okay to store both payment intents in DB and refund him like this?
Do you guys see something wrong about this flow or is it a better one?

Related

Stripe Refund Prorated on Quantity of Days Subscriptions

My goal is this: sub service started to experience issues on 11/9. Instead of pausing payments immediately, I let a few weeks go by. I now want to refund the cost incurred to each user based on the prorated cost for the number of days of bad service. So refund each user 19 or 20 days based on their current subscription. Is there a way to do this via API?
It get's so complex with the past month's proration on the bill. It's a nightmare and this would save me so much time. Willing to compensate. Thank you.
I havent been able to try anything yet.
You can issue a partial refund by specifying an amount less than the original amount of the payment being refunded using the Stripe API. You would specify the payment_intent belonging to the Subscription Invoice in question (which you can find on the Invoice object).
However, you need to calculate the amount you wish to refund on your end based on the amount you want to refund for each Subscription.

Stripe Invoice Partial Payments

I'm trying to model a Stripe subscription where the collection method is send_invoice. However, I want to allow the customer to choose the amount they pay (ad-hoc, I believe its called), and then mark the invoice as paid when the total balance is received.
I can see that this is an option for ACH credit payments but only to handle mistakes from the customer. Is there any way to enable this for card payments on invoices too?
This isn't possible using Stripe out of the box. The Stripe hosted form for an Invoice does not allow the customer to input an amount of their choice. The amount listed on the Invoice is based on the parameters provided when creating the Invoice via the API.
You would need to create your own recurring logic to do the following as long as the full amount is not yet paid :
Get the ad-hoc amount your customer would like to pay. This would have to be via your own custom created form
Then create an Invoice for that ad-hoc amount
You would use webhooks to listen for the invoice.paid event to verify that the invoice is paid successfully. From the event details, you can retrieve the Invoice details and “link” it to the amount owed in the database for that customer.
Calculate the amount left unpaid
Example - I have a customer that owes me $100
Ask the customer how much they would like to pay. Customer decides that they want to pay $10.
Create an Invoice for $10.
After the invoice is successfully paid. Tie the Invoice details to the amount owed in the database.
Calculate the amount left.
Since there is still $90 left,
Ask the customer how much they would like to pay. Customer decides that they want to pay $90.
Create an Invoice for $90.
After the invoice is successfully paid. Tie the Invoice details to the amount owed in the database.
Calculate the amount left.
Mark the amount as fully paid in your database.

How to automatically bill Customer B depending on Customer A's subscription charge on Stripe?

We are looking for a way to bill one customer depending on how much another customer is charged weekly using Stripe Subscriptions. So the idea is to offer a weekly gym membership to full-time employees at city offices. The weekly fee will be $20 and we want the employees' company to contribute a certain amount to the weekly fee. For example, Customer A (employee) will pay $16 and Customer B (employee's Company) will pay the remaining $6. Is there a way to take Customer A's charge successful receipt and trigger Customer B's card to be charged automatically? The $20 subscription fee is not fixed as it will change depending on their usage ($20 is for 5 working days. If they use it for 3 days the total charge will be $12).
Since you are controlling Customer A's subscription and charge you can automate all of this. You indicated that you will change how much you charge Customer A each month. This is something that your code will handle and at that point it can automatically charge Customer B's card for the remainder of the fee.
Otherwise, you can use webhooks and listen for charge.succeeded events. Whenever Customer A has a successful charge, your webhook handler will find the corresponding Customer B in your database and create a Charge for the correct amount.

Stripe Implementation for subscriptions

Trying to engineer a payment system with stripe that will bill the customer on a weekly basis. The customer can have as many documents but each one is charged weekly. So if the customer has 2 documents he would have 2 charges every week until he canceled both or one of them. I would like to be able to have a detailed email invoice too.
Would the best way to do this would just keep updating the subscription quantity every time one is added or deleted. Or is there a better way to do this.
AKA: I am new to online payments
You can create the plan on Stripe with a validity of 7 days and subscribed the customer to that plan on the recurring basis. So the customer will be charged automatically every week.
For the quantity, you can change the quantity of subscription on stripe or you can subscribe a customer to different weekly plans(If you have different documents rate)
For sending an email just enable invoice email from admin setting and each time customer will pay an email will be sent.

Stripe Payments Charge

Is it possible to control the charge date in Stripe? For example, we need to charge:
One-time charge ($5) that needs to be charged on the purchase date.
One-time set up fee ($99) that is charged after 30 days from the purchase date.
Recurring charge ($79) that needs to be charged at the end of the term (It can be either Monthly or recurring)
Is that possible to have all these charges in the same subscription? If so how to do it with Stripe APIs?
When you set up a subscription with Stripe, you define price and interval they are charged. There is an option to have a trial period, so that you can have the first charge delayed - but beyond that there are not other options. Note that subscription plan details (price, interval, etc.) are, by design, not editable
In order to implement the business rules you have listed, you will need to implement that yourself. You can do so by:
create a subscription plan with X day trial (I'm not 100% sure if that's what you mean by 'to be charged at the end of the term').
creating the customer and saving a card for that customer.
charge the one-time charge on the purchase date.
start the subscription for the user on the purchase date (or 30 days later, depending on what is meant by 'end of the term').
then charge the 'set up fee' charge 30 days later.
There may be some services (such as Azure's Logic App Service) that could help you implement this business process but you won't be able to do it with just Stripe.

Resources