Stripe Implementation for subscriptions - stripe-payments

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.

Related

Stripe - Monthly notification for six month or annual subscriptions

According to the Stripe docs if I have a monthly subscription I'll get an invoice.paid/payment_failed webhook telling me if the payment or successful or not
Then my understanding is that if I were to create an annual subscription, I'd only get one webhook each year notifying me on whether the new payment or successful or not...
My app works in such a way that if you have any sort of active subscription it'll give you access to more data, regardless if your subscription is paid monthly or every six months and so on... so, is there a way for me to get notified monthly about any active subscription regardless if they are every-six-months/annually paid?

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.

Stripe appears to be billing twice for each Subscription

We are using Stripe subscription. In that if a user creates a Product then they can set the price suppose $9.99.
If the other users wants to subscribe the same product they have to pay $9.99. From the paid $9.99, the admin will get 2% and (2.9 + 0.30)% Stripe fee will be deducted and the remaining amount will be sent to the product creator's connect account.
The issue is if the user subscribe a product, a charge is created and the amount deducted from the subscriber. Then the invoice will generate and that time, again the amount will deduct from the subscriber a/c. Double time payment cuts from the subscriber's account.
I'm using destination-charges method to apply the charge and transfer the amount to creator's connect account for any subscription in the invoice.payment_succeeded webhook's method.
How to prevent 2nd time payment deduction?
enter image description here
Creating a subscription will generate an invoice that will charge for the upcoming period(they are charged in advance, so if you had also done a destination charge before creating the subscription, you are charging the customer twice — I assume that's what you mean?
What you probably want to do here is one of :
instead of doing a one-off destination charge or doing a transfer manually from a webhook handler, just set the application fee on the subscription so it's deducted from the invoice instead, by setting the destination of the funds and the application fee you keep :
https://stripe.com/docs/billing/subscriptions/connect#transfer
https://stripe.com/docs/api/subscriptions/create#create_subscription-application_fee_percent
if for some reason that is not an option and you still need to do a separate charge than the first invoice, maybe create the subscription with trial_end set until the next billing date, which will skip the first payment (sine you already processed it)
https://stripe.com/docs/api/subscriptions/create#create_subscription-trial_end

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 monthly subscription with annual payment?

What is the best way to subscribe my users to a plan that renews monthly yet bills yearly using stripe subscriptions, as i contacted Stripe's support and they said a plan with an interval of month and interval_count of 12 will not generate any events (ex: customer.subscription.updated event) until the end of the 12 months interval while i need these events to be generated on monthly basis.
The best solution here would be to subscribe the customer to a $0 monthly plan. This ensures that, each month, a new billing cycle starts and a new invoice is created. The invoice will be for $0 but send an invoice.created event to your webhook endpoint.
There, you can decide whether you need to bill the customer anything or not. If you don't, you simply ignore the event and the customer won't be charged anything. If you do, you will simply add an invoice item for the correct amount to this invoice. This is covered in the Invoices section of Stripe's documentation.
For the first invoice, you would add the invoice item first which means three steps:
Create the customer
Create the invoice item for the correct price
Create the subscription to the $0 monthly plan
The last step will automatically pull the invoice item in the invoice and charge them that amount as expected.
If you have follow up questions, I'd recommend talking to Stripe's support here.

Resources