#devangbhuva97

1 messages · Page 1 of 1 (latest)

lethal igloo
#

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.

humble dome
#

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.

lethal igloo
#

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

humble dome
#

yes.. one time payment

humble dome
lethal igloo
#

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.

humble dome
#

Yes.. currently we are using same thing... calculate sum of all the one time products.

#

but want to charge separate for all the products

lethal igloo
#

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?

humble dome
#

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

lethal igloo
#

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?

humble dome
#

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.

humble dome
lethal igloo
#

onesec let me test something

humble dome
lethal igloo
#

@humble dome can you pass me the request id for what you tested? it'd look something like req_123

humble dome
#

Sure... let me find out

#

Request id: req_63f9w6PIpdfkaT

#

Error: Missing required param: items

lethal igloo
#

a Subscription expects a Price with a recurring interval, what you're trying to do wouldn't work

humble dome
#

yes.. that i know

#

I was searching for similar api for one time products. That's why I tried

lethal igloo
#

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 ^

humble dome
#

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.

lethal igloo
#

have you tried creating an invoice _item for each price, then creating an invoice?

humble dome
#

How I want to make sure that we are charging only currently selected items by customer?

lethal igloo
#

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

humble dome
#

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

lethal igloo
#

You can use Checkout instead, where users will only pay for the selected products in that Session.

humble dome
#

It's stripe checkout builtin flow. Right?

#

Can we use our frontend & checkout api combination?

lethal igloo
#

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

humble dome
#

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.

lethal igloo
#

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

humble dome
#

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

humble dome
lethal igloo
#

we don't have an external site for you to post your feedback on, but i'll definitely pass on the feedback!

humble dome
#

That's great! 👍

humble dome
lethal igloo
humble dome
#

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?