Stripe Plan Pricing with Coupon Applied without charging the customer - stripe-payments

I am trying to figure out how I can get the final total amount from Stripe for a subscription plan with a coupon applied, without charging the customer to show in the confirmation page before checkout.
I see there is API in Stripe to get Plan info and Coupon info that created in Stripe Dashboard but I want to find out if there is a way to get the Plan pricing info after applying Coupon but without charging the customer. All of the rules for the coupon exist in Stripe Dashboard so wanted to see if there is a way Stripe can give me the pricing info otherwise the rules for Coupon would be duplicated in Stripe and in my application server.

You can use the Upcoming Invoice API [1]. Pass in the Customer or Subscription, Coupon, and any invoice items to see what an upcoming invoice would look like for a Customer.
[1] https://stripe.com/docs/api/invoices/upcoming

Related

Stripe Payment Links - promo codes for non-recurring Products

I have two types of products in my Stripe accounts - one which has a recurring payment model (subscription) and another which has a one time payment option. For both products, I am creating a Payment Link and providing 'allow_promotion_codes = true' on the creation call (docs: https://stripe.com/docs/api/payment_links/payment_links/create).
I have created a promo code / coupon which takes 100% off of the entire order - which is for admin/testing purposes only. This promotion code works just fine on the subscription/recurring products. However, when attempting to use the code for the one-time products, I get "The code is invalid" response.
Are promotional codes only applicable to subscriptions? Is there any way to use promo codes for one-time payment products via payment links? I would like to stick with the current model of providing payment links, hoping it's possible to add discounts to both types of products via payment links. Please do let me know if any code is needed to provide more context.
I created the coupon and payment links and the coupon in Stripe. The payment link only accepts the coupon for subscriptions and not the one-time payment products. I would expect the discount to be applied to all products.
It's expected behaviour mentioned in https://stripe.com/docs/payments/checkout/discounts
Checkout does not currently support discounting a purchase below the minimum charge amount for one-time payments.
Note : Payment Links is essentially Checkout under the hood

How to create invoices using Stripe Connect Express, on Stripe Subscriptions invoices are automatically created, but not on Stripe Connect payments

I charge Customers using this guide https://stripe.com/docs/connect/destination-charges adding amount, application fee and Service provider accound_id, after that I listen for "charge.succeeded" event with webhooks. If the payment was successful I generate invoice using this this guide - https://stripe.com/docs/billing/invoices/connect, but I get this error
"Nothing to invoice for customer"
Is it possible Stripe automatically to create Invoice for me?
Do I have to manually create this invoice and then make it paid.
Should I generate the Invoice before Payment or after Payment?
When you process a payment, Stripe will send your customers a receipt automatically per your email settings [1]. In some respects, this receipt serves as an invoice of services rendered, and might be sufficient for your needs. You can see an example of what a receipt will look like for a given payment by looking at a given payment in the dashboard (under the 'Receipt history' heading).
Now, if the receipt automatically generated by Stripe doesn't meet your needs (e.g., you want to be able to list more customer info on there), then you'll want to use the Invoices API [2] instead of the Payment Intents API to process the payment. Using the Invoices API also allows you send the invoice to the customer so they can initiate payment on their own [3].
So, with that out of the way, if you intend to create Invoices for your customers you need to first create Invoice Items on the Customer and then create an invoice off that Customer. Once you finalize the Invoice, Stripe will either process a payment automatically under the hood, or send the Invoice to your Customers via email so they can initiate the payment (through a Stripe hosted page). At that point you can send your customers a copy of the Invoice PDF. With this integration there is no need to process the payment on your own or deal with any other APIs. The Invoices API takes care of everything for you. These steps are documented in detail here:
https://stripe.com/docs/billing/invoices/create
To answer your questions more directly:
No. Stripe will only automatically create invoices when you make subscriptions. But, Stripe does automatically create receipts as described above.
Yes, you manually would need to add Invoice Items to the Customer, then create an Invoice off that Customer. Note that this step will also charge the customer, so you don't need to do that separately.
Invoices process the payment under the hood once they are finalized.
[1] https://stripe.com/docs/receipts
[2] https://stripe.com/docs/billing/invoices/create
[3] https://stripe.com/docs/api/invoices/create#create_invoice-collection_method

Stripe fixed-price subscription elements

I don't know the flow how subscription works in stripe and how to update credit card details, price, billing cycle of a subscription. Will they debit amount on subscription or after first billing cycle. And it will be helpful if you have examples in NodeJS.
There is a repo with various demos for any api-server implementation you would like, which includes nodeJS:
https://github.com/stripe-samples/subscription-use-cases/tree/master/fixed-price-subscriptions
Billing cycle is setup on stripe when you setup the product, and the demo includes a provision for updating plans

Programatic shipping and taxes with Stripe Subscription

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.

Using coupon codes with stripe relay

Can someone please help me understand how coupon codes works with Stripe relay?
According to the api docs, you can pass a coupon code when creating an order:
https://stripe.com/docs/api#create_order
However, what should this coupon code be? From what I understand, coupons created are only available for subscriptions. In the new dashboard, they coupon page is also only found under subscriptions -> coupons.
So, what should the coupon field contain?
I can't handle the discount logic on my side, as you pass the SKU id's of the products, when creating an order, so you don't pass any amount that you can manipulate yourself.
Thanks.
You can use subscription coupons with Relay's orders. Coupons started out as part of the subscriptions API, and are still grouped under "Subscriptions" in the dashboard and the API reference, but they're also usable with Relay.

Resources