#devangbhuva97
1 messages · Page 1 of 1 (latest)
hello @humble dome ! The draft invoice created will pull in all pending invoice items on that customer, it's not possible to only include certain pending invoice items.
Looks like this will create some edge case. Suppose for a same customer, from multiple sources, invoice items are creating at a same time. Now whoever will request for new invoice from those sources, all items will be linked that source invoice. Rest of the sources will get error.
Multiple sources means - may be we are using invoice api in our couple of features or may be other stripe integrations are using invoice api for that particular stripe account & customer
or @lethal igloo do you have any api suggestion instead of invoice for our below use case?
We are managing one time products in our system & our customer will be choose one or more then one products & we want to charge for that.
https://stripe.com/docs/billing/subscriptions/multiple-products searching similar api for one time products only
Create subscriptions with multiple products, all billed in a single invoice.
it would be a very rare edge case i feel.
Starting in June 2021, Platforms using OAuth with read_write scope will not be able to connect to existing accounts. So if you're starting as a new Platform, your connected accounts will be linked only to your Platform.
As to your point about one time products only, are you referring to one time payment? and not subscriptions
yes.. one time payment
I did not get So if you're starting as a new Platform, your connected accounts will be linked only to your Platform.
you mentioned previously, that maybe other stripe integrations are using invoice api for that particular stripe account & customer -> this is no longer possible. A Platform will only have read_write access to a connected account if the Platform created that connected account.
if you want to create one time payment for your customers, i'd recommend referring to this guide using Checkout : https://stripe.com/docs/checkout/integration-builder
Your customers would select and pay for their items "on the spot"
Yes.. currently we are using same thing... calculate sum of all the one time products.
but want to charge separate for all the products
this doesn't seem like the best user experience - if i buy 10 items i would have to pay 10 times....
is there a reason why you want to charge separately for each product?
What our features: We have list of the recurring & one time products. If someone select 1 recurring & other one time products, we are using multiple subscription api. So in that case, we are showing all the separate details in invoice for all products. But if someone select only one time products, need to call payment intent with sum of the amount.
So our client use-experience will be different for both case
if i understood this correctly, you want separate invoices for recurring & other one time products? One invoice would be for the recurring, one invoice would be for the sum of all one time products?
No
Case 1: One recurring + multiple one time products -> going into 1 invoice with separate product charge..... this flow is working fine for me
Case 2: Only multiple one time products -> we are using payment intent with sum of amount.... but want to make same as case 1.
Using this API -> https://stripe.com/docs/billing/subscriptions/multiple-products. It's creating 1 invoice with all the separate details of products
onesec let me test something
Sure... FYI: I tested subscription without recurring item & only pass one time items but not working
@humble dome can you pass me the request id for what you tested? it'd look something like req_123
Sure... let me find out
Request id: req_63f9w6PIpdfkaT
Error: Missing required param: items
a Subscription expects a Price with a recurring interval, what you're trying to do wouldn't work
yes.. that i know
I was searching for similar api for one time products. That's why I tried
you're using Checkout right? When creating a Checkout Session, create it with the number of one time Prices that you want
cURL Example
curl https://api.stripe.com/v1/checkout/sessions \
-u sk_test_...: \
-d success_url="https://example.com/success" \
-d cancel_url="https://example.com/cancel" \
-d "payment_method_types[0]"=card \
-d "line_items[0][price]"=price_H5ggYwtDq4fbrJ \
-d "line_items[0][quantity]"=2 \
-d "line_items[1][price]"=price_1JXgRCJQtHgRImA7fDIHY4B2 \
-d "line_items[1][quantity]"=1 \
-d mode=payment
edited a small issue in the code above ^
Not using checkout
I think you still not get what we are trying to achieve. Let me explain in more details
We have set of products in our page & customer can select multiple products & buy. Now suppose customer selects 3 one time products. So now I want to charge for those 3 products but want to add all the products details in that charge like invoice items. So client can see that as separate charges
And I think it's easy to refund for 1 product if requires
Currently we are doing sum of all 3 products & charge using payment intent api.
have you tried creating an invoice _item for each price, then creating an invoice?
yes... then I feel there is edge - #886854142604230657 message
How I want to make sure that we are charging only currently selected items by customer?
this is the only way to go about it, and the edge case would be very rare. In most cases, your Customer is going to be in one "checkout" at a time
yes... it's very very rare case
but still we don't want to take risk on that.. if any alternative solution will be available
You can use Checkout instead, where users will only pay for the selected products in that Session.
It's stripe checkout builtin flow. Right?
Can we use our frontend & checkout api combination?
if what you meant is that it uses a Stripe hosted page, yes
so you can let the user select the products they want in your frontend, then create the Checkout Session based off the selected products, after which, direct the user to the Stripe Checkout page to make payment
Sorry but that behaviour won't need.
Still I'm little bit confused... is there any specific reason for not providing api like that?
Because there is invoice api behind multiple subscription api. So in that api, we can pass multiple one time products but limitation is only required at least 1 recurring product
Same for checkout flow, we can pass multiple one time products but limitation is need to redirect on stripe hosted page.
It seems that Checkout doesn't work for you either as you don't want to redirect to a Stripe hosted page.
i think the main problem here is that you're concerned about non-selected invoice items being included in the invoice when using the Invoice API. I will pass the feedback on to the product team that it would be great if a user can select specific items to be invoiced for. Unfortunately, there just isn't an 100% foolproof way to guarantee that certain invoice items are being invoiced for.
I guess you could also prevent the user from creating multiple sessions on your website, and always check if there are only the selected products as Invoice Items on the Customer before creating and finalizing the Invoice immediately - these are all situations which you have to account for on your own site though
Yes... that's very helpful for us and I think for others as well who are waiting this kind of api. Hopefully you also feel that this is valid use-case & many customers needed. Thanks for helping us & passing our feedback to your product team. Also let us know if there is any idea board or developer API request board where we can put this one as well
yes we can do by adding our validations but it's not 100% full proof solution.
we don't have an external site for you to post your feedback on, but i'll definitely pass on the feedback!
That's great! 👍
I'm thinking like... first create 1 invoice item for $0, then create invoice. then check invoice items in that invoice. If there will be more than 1, then delete those items. After that create actual items with invoice id
@humble dome you could always list all pending invoice items. Use pending=true [0] for the particular Customer [1]
[0] https://stripe.com/docs/api/invoiceitems/list#list_invoiceitems-pending
[1] https://stripe.com/docs/api/invoiceitems/list#list_invoiceitems-customer
Just want to confirm invoice items logic - once invoice in draft mode, it won't add newly created invoice items automatically in that draft invoice?