#B33fb0n3
1 messages · Page 1 of 1 (latest)
I can do, Yeah. But I don’t think That you will understand my Problem directly if I Just summarize
I had a brief look at your previous thread: https://discord.com/channels/841573134531821608/1054439811546611804
What's your question?
Thanks. Ich checked out the api, but havent found where I can enter multiple PriceIds
Can you be more specific? Do you want multiple price ID for the same product? The same invoice? Something else?
Yeah, one order with multiple items with one charge
So you want to create one invoice will multiple prices IDs? First you create an empty invoice, then you add as many invoice item that you need to that invoice.
You can learn more about this here: https://stripe.com/docs/invoicing/integration/quickstart
But there I can Just include one priceID… :/
True, but you can create multiple invoice item in a row, each with one price.
But thats very inefficient, if I create For every Order and every priceid a invoice item… that Not Good…
Yes it means you need to do a few extra API calls, but that's how it works.
For example:
10 Orders. Each 5 items (Not much) so on your api end: 50 api call.
Can I create the invoiceitem and reuse it For every Order?
10 Orders. Each 5 items (Not much) so on your api end: 50 api call.
Yes that's correct if you want to use invoices.
Can I create the invoiceitem and reuse it For every Order?
No that's not possible.
Hm thats a Problem. Does something like the Order api exists Which will Not be disabled in the Future?
I don't think so. If you have to use invoice and handle the payment yourself (so not using a Checkout Session for example), then you have to create each price ID in an invoice item.
What about a Custom checkout?
What about it?
I Need to Build a Custom checkout, but the Customer don’t want to wait like 30 sec. To Order…. Each request For Stripe api After 1 sec
Which API requests?
If you're attempting to create Invoices via the API with ~50 line items, then yes there will likely be significant delays whilst the API processes those requests. Consider making them async via queue/job, and then sending invoice to customer async or something
Or maybe the Invoices API isn't the right product for your requirements
Yeah, I thought about a direct checkout, but than the Customer need to wait… and than the Customer Go away :/
As stated, perhaps an async process would fit better in that case:
- They checkout.
- In background, make the API requests async necessary to create the invoice and items as you need.
- Once done, send the customer the invoice for payment offline via email.
Yeah, but than the Customer will Break up the payment process… so directly Payments would be Vetter
Then perhaps invoices is not the best solution for your use case!
Yes, thats what I ment. So, How do I resolve the Problem?
What is the problem? What are you trying to build?
A Custom directly checkout with multiple items
The only APIs we have that support 'items' (e.g. line items) today are Checkout and Invoicing. There's no concept of items on Payment Intents direct
You could build your own API to mirror cart/orders functionality with items, which just creates a Payment Intent under the hood if you want a custom checkout
I am complete Free in backend and Frontend, but I don’t know, How the Concept will Look like For this Problem
I'm not sure what that means
You know like a Concept, How to work with the Stripe api, to Make an online Shop with a Custom checkout possible
Well, you'd start here: https://stripe.com/docs/payments/accept-a-payment?platform=web&ui=elements
Thats Not with a Custom checkout :/
Correct. We don't have any cart/checkout APIs, you'd need to build those yourself
Yeah, but How do I work with the api, to have a Good concept?
That's a very broad question. What specifically is problematic?
How to work with your api to make a Perfect concept to Provide a Custom checkout For an online Shop 🙂
Again, very broad. Are you going to build your own cart/checkout or using a third-party?
Yes, I do
Yes to which?
Oh sorry, I Build my own
Then I'd recommend starting on that process first, getting the cart and checkout flow to behave as you need and then adding Stripe/payment processor at the end
If I Build Just my cart as I do, I would come to the problem, That I Need to connect it to the Stripe api. So I want to Build my cart from the api view. So First Check out, How I would do the checkout process with Stripe and After That Build my cart and Provide the Needed Stripe Data
You'd be using our Payment Intents APIs, creating and confirming them, as the payment representation of your cart/order. The flow for this, including using Elements to collect payment details, is all outlined here: https://stripe.com/docs/payments/accept-a-payment?platform=web&ui=elements
As explained, there's no line items concept on that API it's just an amount that's the cumulative total of your cart/order
Ok, I thought about paymentintents. But I Need to provide an amount. Cause I use react to Build it, can the Client modify the amount. Thats a problem
No, you need a server-side component to create/mutate Payment Intents
Normally people work it like this: your cart has a total and maybe when the customer visits the checkout page you create the Payment Intent to reflect that total, and any updates to the cart can be reflected by updating the same Payment Intent
I have
Yes. If the Customer change the total on the Client side, than the cart can be the Same, but the Customer pays less. Thats Not wanted
then you need to update the PaymentIntent when the cart changes, for instance. https://stripe.com/docs/api/payment_intents/update
I can do this, but Themen the Customer get the Same items for a less price
not sure what you mean or how that would happen. Might help to look at some concrete code?
Sure. Example:
const [cart, setCart] = useState([]);.
*to cart a product will be added:
{id: „prod_1637474“, unitamount: 1000, quantity: 2}
Now the Customer Go to checkout.
Normal Case:
The paymentintent will be created with 2000, the secret will be returnen and the Customer can Input the payment Details into the payment Elements. He pays 2000
„Hacker“ Case:
The Client modify the array and change the unitamount to Zero. The paymentintent will be created with 0, the secret will be returnen and the Customer can Input the payment Details into the payment Elements. He pays 0.
(Yes I can cancel the Order, of I See it’s Zero, but the „Hacker“ wouldnt set it to Zero, maybe Just less…)
For the Same product
yep that's why you don't build a cart this way, with the amounts in the frontend.
the frontend would only deal with something like the ID of a product, and you keep the mapping of the product to the actual unit amount stored in your backend server/database.
the frontend just sends you a cart saying "customer is buying 5 x Widgets and 3 x T-shirts", and your backend uses a database etc to know that a Widget is $10 and a T-shirt is $20 and creates a PaymentIntent for $110.
Ok, I thought about That to Just Provide the priceID in the Frontend and ask in my backend For the unitamounts from Stripe api. But I cant get multiple back in one request 😦
then you'll just have to make multiple requests or store some of the info in your database
Can I somehow get with one request multiple unit amounts of Stripe products?
Yeah, thats a Good Direction. Can I give in my request some Data, to get specific unitamounts?
not sure what that means
would be easiest if you just give some things a try in test mode to play around with it I think!
What Kind of testmode? For my Website?
Testmode within Stripe -- you can perform all these requests and changes in testmode and see how the API will behave
Ah yeah, I do have a testmode in Stripe. Wanna have the public key?
Nope no need (and never share your secret keys, even test mode keys)
karllekko was merely suggesting that you can explore how to do what you're asking by trying out different requests safely in test mode without worrying about any actual payments
And if you bump into specific issues and questions while working through that we'd be happy to help sort you out
Ah Yeah, thanks for mentoring. I use that much. My Point was on Here (the the answered message) but get specific unitamount
What do you mean by get specific unit amount?
As in, you want to retrieve a price which has a specific known unit amount, or you want to configure a new price with some amount?
The mentioned method:
.listPrices # get ALL prices
.listPrices(„priceId1“, „priceid2“) # return array of requested price objects
You can't return a list of specific prices like that, no. If you already have the Price IDs you'd just use those since you know them, or retrieve by ID or cache the entire price objects for reference
Ahh. Does something like the orders api exists? You can Deal with Price ids and so on….
No, but can you explain what you're trying to do exactly? Maybe I can offer another suggestion.
Sure, I‘d like to Build an online Shop with a Custom checkout
OK, and where in that process are you having issues?
At the custom checkout
Ok, but that's a long process. What have you tried so far?
I‘ve tried it, but you See, where I am now…
Where are you now? What specific thing are you trying to do next and are stumped by?
The custom checkout is my Next step
So then I'll point you to this guide: https://stripe.com/docs/payments/accept-a-payment?platform=web&ui=elements
and the quickstart walkthrough example for custom payment flows: https://stripe.com/docs/payments/quickstart
And you'll want to work through that to build it into your application.
Yes, I know, please read the Problem from here: #1054687655151009822 message
Hello 👋
Taking over for synthrider as they need to step away soon!
The problem you've linked is that you want to create PaymentIntents without an amount?
Just the Problem with the elements and the paymentintent
what problem? sorry 😅
Just want to make sure I'm on the same page (since this is a long running thread, its hard to get a pulse on what current state is)
I want to create a custom checkout where no modify of the price is possible. 😊
The code to create a PaymentIntent should be on your server-side and if you also handle the pricing on your server-side then I don't think anyone can change the amount via client-side
You can maintain your own database for the products (or pull the information from Stripe using our APIs) and ask your users to pick what they want to buy.
Once they make their choices (assuming you're tracking those products somehow ie. using cart), you'll send those product IDs back to your server and retrieve information about the products (from your own database or Stripe)
And before you create a payment intent, you'll want to calculate the total.