Stripe Payment Links - promo codes for non-recurring Products - stripe-payments

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

Related

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 API v3: When to use Invoice vs PaymentIntent (Node SDK)

I've been reading Stripe's api documentation (v3) and it's not apparent to me when to use Stripe's Invoice vs PaymentIntent objects. From reading the documentation, here's what I understand:
Stripe sees payment intents being the primary way of facilitating payments through their API going forward and Charges will be deprecated at some point.
Processing an Invoice creates a PaymentIntent under the hood and and initiates payment right away. What I don't understand is why is there no destination account field for the Invoice? If the Invoice is defaulted to be sent to the platform's Stripe account (this is an assumption I am making since there is no destination field), why there is an application_fee_amount field which is essentially the platform's "cut" of the transaction?
A PaymentIntent allow you to specify a destination account while taking an "application" or "platform" fee so you don't have to generate a transfer yourself.
A PaymentIntent and Invoice can be processed at time of creation or deferred until later in your payment lifecycle.
My use case requires me to conduct payments between two parties and take a "platform fee" for each transaction. I have successfully done this by creating a PaymentIntent and using the connected Customer account's credit card on file and populating the transfer_data field with the amount to send to the 2nd party involved in the transaction.
I started looking into Stripe's invoicing api since I am planning on building an invoicing solution for my platform and thought it'd be best to leverage what Stripe has to offer, but I'm failing to see a benefit for me to leverage it since I also need to keep track of transaction ids for the payment intents and taxes based on zip code (it looks like Stripe doesn't do this automatically so I might be out of luck here).
I couldn't find a way to get a transactionId for processing an Invoice but I see that the chargeId gets returned as part of the response when you confirm a PaymentIntent (https://stripe.com/docs/api/payment_intents/confirm).
So the questions I have are:
Why is there no destination account field for the Invoice? Does it automatically get send to the platform's Stripe account and require you to manually create a transfer?
Is there an easy way to get a transactionId from an Invoice?
Is there a way to get a transactionId when creating a PaymentIntent and setting the confirm=true so the PaymentIntent gets processed immediately?
For a platform that will have an invoicing flow and facilitate transactions on behalf of two parties, is it recommended to use payment intents, invoicing, or both?
What's the difference between a charge and transaction? When paying an Invoice, a charge id gets returned in the response but when paying a payment intent, a transaction id gets returned.
Thanks in advance!
You can think of invoices as subsets of payment intent, kind of the same way subscriptions are subsets of invoices.
What I don't understand is why is there no destination account field for the Invoice?
Actually there is one, but the field is transfer_data[destination]. Also, note that whenever an invoice is finalized, it will contain a payment intent, which is expandable, and with which you should be able to solve most of the issues you rose in your question.
To sum up:
Yes there is, as explained above.
Expand the invoice's payment intent object.
I'm not used to work with transactions, but I guess you could leverage their metadata to reference your invoice or vice verse to help you retrieve the need object in needed time.
As explained above, their is not dichotomy between those, if your invoicing your clients, the you should use stripe's invoicing system.
From what I see in the docs, transactions only concern purchase 'internal' to stripe, with issued cards. Charges are the attempts stripe will make to charge your bank account through the network, when a charge succeeds, the payment intent status is set to succeeded otherwise the payment intent might attempt more charges or stop trying at some point, and the payment intent will be set to canceled more about payment intent statuses here. In short payment intents are a subset of charges.
I hope this helped and didn't come too late, the answer might still be improve in the future, if others edit it or as I will learn more about stripe's issuing product.

Stripe Plan Pricing with Coupon Applied without charging the customer

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

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.

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