Programatic shipping and taxes with Stripe Subscription - stripe-payments

I would like to use Stripe for a physical subscription site.
Small number of SKUs
Some customers pick up instead of ship
Customers whose addresses are in one state are charged state and local sales tax
I'd like to use Stripe Subscriptions to do this but shipping costs and state/local taxes will be slightly different for every single customer and but unlike in the Stripe Orders API, it does not look like Subscriptions allows for me to dynamically calculate shipping and taxes. Is my reading of this correct, or is there a way for me to programatically edit recurring shipping and taxes on a per-subscription basis?
Thank you!

Answer via #mattwc in #stripe freenode: An invoice is created by the subscription each period 1 hour before it is charged. You can subscribe to this event via webhook and edit the invoice to add shipping and tax information.

Related

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 Connect Fixed/Flat Fee based on value for Connected Accounts

I am creating a Stripe Connect marketplace which charges a fixed fee based on value of sales, e.g. up to £2500 of revenue (for a connected account in a calendar month) will incur a flat fee of £200 per month to the platform.
I have read the Stripe documentation but still quite unclear how I can achieve this using a Standard Connect account. I understand the concept behind adding a flat fee per transaction but my use case is based around the amount of revenue over a time period.
Any help is always appreciated.
it sounds like you want to keep track of the payments processed by your connected accounts in order to figure out what to charge them.
The best way to do this is probably to set up a Connect webhook and listen for events like charge.succeeded and keep a running total each month for each account.
You have a number of options for charging your accounts, but using Billing to create a subscription that you update as their revenue grows is probably the best experience. You could also use metered billing with pricing tiers based on the payments you track.
If you need to calculate historic revenue, you'd need to manually retrieve the payments and calculate the total for the month(s) you're interested in.
NOTE: For both the webhook events and the retrieval approaches you'd need to be aware of several different objects other than Charges that may affect revenue up or down, like PaymentIntents, Refunds, Disputes etc depending on the details of the connect account's integration.
Hope that helps!

Paying an invoice with multiple credit cards in Stripe

I have a scenario where a customer may have multiple credit cards. The customers are charged with a subscription fee and extras that depend on the customer behavior. The customer is charged once a month for both the subscription fee and the extras. The extras should be paid by the credit card that is selected according to certain rules. Basically, the invoice should be split between multiple credit cards (but there is no strict requirement that there should be single invoice).
Any suggestions how can this be accomplished with Stripe?
Thanks!
Answering myself because I received the answer at Stripe's IRC channel from timebox.
"The only way to do different cards per Subscription is to create a separate Customer object for each Card, and create the Subscriptions separately on each Customer object."
It isn't possible to have multiple Subscriptions and pay them by different cards because Subscription is always paid by the default card.
Having multiple Customer objects seems to be the only way.

stripe API - possible to combine multiple invoices into one payment?

i have a use case where its possible for a user to accumulate multiple unpaid invoices with a stripe subscription (which would be marked as overdue). The only way i see to pay the invoices via the API would be to pay each one as a separate manual invoice payment (thus producing X lines items on a users credit card).
Is there any way to combine all unpaid invoices into one payment ?
It's not something that the Stripe API supports. The best solution would be to create a one-time charge for the total amount of all the invoices and then mark each invoice as forgiven.
You could also create multiple invoice items, one for each invoice with a clear description and amount and then invoice the list so that your customer knows what he's paying for.
From the Stripe docs, it suggests that you can batch multiple transactions together but only if the customer has a payment method saved (and it still may require some custom programming to get it working the way you want):
https://support.stripe.com/questions/batch-multiple-transactions-from-one-customer-into-a-single-charge
Stripe docs also offers this option as well, on combining multiple products into one subscription:
https://stripe.com/docs/billing/subscriptions/multiple
Yes, You can combine multiple invoices using pass stripe customer id in to
/Stripe/Invoices::retrieve({customer_id});
You can get all the invoice of the customer, you can also search date wise invoices using a function.

Recurring billing with Stripe - will Subscriptions suffice?

My application allows a customer to purchase credits for later in-app use.
I want to enable customers to buy credits throughout the month, and only get billed at the end of the month.
Should I be using a Stripe Subscription at an amount that equals the price of one credit, and change the quantity according to the number of credits the customer purchased?
(After a successful invoice - I'll reset the subscription quantity to 0)
Is there a better solution? Perhaps some clever method of using Stripe Checkout?
Your proposed approach sounds reasonable.
I've not tried it but an alternative I can think of would use a free plan and the Invoice Items part of the API.
Create a free plan with amount with amount field set to 0. As far as I can see from the docs, all the subscription lifecycle webhooks should be triggered for Customers who're subscribed to the plan.
Through the month, create InvoiceItems for the Customer. According to the docs, at the end of the billing cycle, those InvoiceItems are added to the customer's invoice.
Sometimes you want to add a charge or credit to a customer but only actually charge the customer's card at the end of a regular billing cycle. This is useful for combining several charges to minimize per-transaction fees or having Stripe tabulate your usage-based billing totals.
Beyond that, you'll want to consider if you should have Stripe generate/email your invoices.
I don't think this is the way to go, because subscriptions are billed the first time among other things.
The recommanded way is: stripe doc: Place a hold on a card
summary
You first ask authorization for a certain amount (the max amount). Eg: 1000$
Your custommer buy 50 credits in the month
At the end of the month you charge the customer for 50$ (it can not be greater that the maximum you authorized in the first step)
That's all :)

Resources