#B33fb0n3

1 messages · Page 1 of 1 (latest)

exotic coralBOT
zenith tree
#

Hi there!

#

Do you mind summarizing your previous thread here?

frozen torrent
#

I can do, Yeah. But I don’t think That you will understand my Problem directly if I Just summarize

zenith tree
#

What's your question?

frozen torrent
#

Thanks. Ich checked out the api, but havent found where I can enter multiple PriceIds

zenith tree
#

Can you be more specific? Do you want multiple price ID for the same product? The same invoice? Something else?

frozen torrent
#

Yeah, one order with multiple items with one charge

zenith tree
frozen torrent
#

But there I can Just include one priceID… :/

zenith tree
#

True, but you can create multiple invoice item in a row, each with one price.

frozen torrent
#

But thats very inefficient, if I create For every Order and every priceid a invoice item… that Not Good…

zenith tree
#

Yes it means you need to do a few extra API calls, but that's how it works.

frozen torrent
#

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?

zenith tree
#

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.

frozen torrent
#

Hm thats a Problem. Does something like the Order api exists Which will Not be disabled in the Future?

zenith tree
#

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.

frozen torrent
#

What about a Custom checkout?

wintry tinsel
#

What about it?

frozen torrent
#

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

wintry tinsel
#

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

frozen torrent
#

Yeah, I thought about a direct checkout, but than the Customer need to wait… and than the Customer Go away :/

wintry tinsel
#

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.
frozen torrent
#

Yeah, but than the Customer will Break up the payment process… so directly Payments would be Vetter

wintry tinsel
#

Then perhaps invoices is not the best solution for your use case!

frozen torrent
#

Yes, thats what I ment. So, How do I resolve the Problem?

wintry tinsel
#

What is the problem? What are you trying to build?

frozen torrent
#

A Custom directly checkout with multiple items

wintry tinsel
#

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

frozen torrent
#

I am complete Free in backend and Frontend, but I don’t know, How the Concept will Look like For this Problem

wintry tinsel
#

I'm not sure what that means

frozen torrent
#

You know like a Concept, How to work with the Stripe api, to Make an online Shop with a Custom checkout possible

wintry tinsel
frozen torrent
#

Thats Not with a Custom checkout :/

wintry tinsel
#

Correct. We don't have any cart/checkout APIs, you'd need to build those yourself

frozen torrent
#

Yeah, but How do I work with the api, to have a Good concept?

wintry tinsel
#

That's a very broad question. What specifically is problematic?

frozen torrent
#

How to work with your api to make a Perfect concept to Provide a Custom checkout For an online Shop 🙂

wintry tinsel
#

Again, very broad. Are you going to build your own cart/checkout or using a third-party?

frozen torrent
#

Yes, I do

wintry tinsel
#

Yes to which?

frozen torrent
#

Oh sorry, I Build my own

wintry tinsel
#

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

frozen torrent
#

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

wintry tinsel
#

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

frozen torrent
#

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

wintry tinsel
#

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

frozen torrent
unkempt flare
frozen torrent
#

I can do this, but Themen the Customer get the Same items for a less price

unkempt flare
#

not sure what you mean or how that would happen. Might help to look at some concrete code?

frozen torrent
# unkempt flare not sure what you mean or how that would happen. Might help to look at some conc...

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

unkempt flare
#

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.

frozen torrent
#

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 😦

unkempt flare
#

then you'll just have to make multiple requests or store some of the info in your database

frozen torrent
#

Can I somehow get with one request multiple unit amounts of Stripe products?

unkempt flare
frozen torrent
#

Yeah, thats a Good Direction. Can I give in my request some Data, to get specific unitamounts?

unkempt flare
#

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!

frozen torrent
#

What Kind of testmode? For my Website?

celest delta
#

Testmode within Stripe -- you can perform all these requests and changes in testmode and see how the API will behave

frozen torrent
#

Ah yeah, I do have a testmode in Stripe. Wanna have the public key?

celest delta
#

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

frozen torrent
celest delta
#

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?

frozen torrent
#

The mentioned method:
.listPrices # get ALL prices
.listPrices(„priceId1“, „priceid2“) # return array of requested price objects

celest delta
#

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

frozen torrent
#

Ahh. Does something like the orders api exists? You can Deal with Price ids and so on….

celest delta
#

No, but can you explain what you're trying to do exactly? Maybe I can offer another suggestion.

frozen torrent
#

Sure, I‘d like to Build an online Shop with a Custom checkout

celest delta
#

OK, and where in that process are you having issues?

frozen torrent
#

At the custom checkout

celest delta
#

Ok, but that's a long process. What have you tried so far?

frozen torrent
#

I‘ve tried it, but you See, where I am now…

celest delta
#

Where are you now? What specific thing are you trying to do next and are stumped by?

frozen torrent
#

The custom checkout is my Next step

celest delta
frozen torrent
jolly cypress
#

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?

frozen torrent
#

Just the Problem with the elements and the paymentintent

jolly cypress
#

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)

frozen torrent
#

I want to create a custom checkout where no modify of the price is possible. 😊

jolly cypress
#

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.