#B33fb0n3

1 messages · Page 1 of 1 (latest)

thin cobaltBOT
waxen geyser
#

Hello! We don't typically reopen closed threads. Can you summarize your new question here?

glacial nexus
#

Hi, hanzo descripted, That I should fetch the prices from my backend from my backend. My mission is to Build an online Shop with a Custom checkout. The Problem was, that if I Just create the paymentintent, the Client can modify it (because For a paymentintent creation you Provide Just the amount and no price ids). So we thought about invoices. But That way is very inefficent, because you Need to create For each lineitem a invoiceitem and this For every order. We checked, what Solution you can offer and (please read the First sentence in this Message again)

waxen geyser
glacial nexus
#

Yeah, but there‘s the Problem, That I cannot customize it. I like the Stripe checkout and it does was I want and offer many options. The Problem is, That it’s Stripe, and Not my Website. The customer may be confused or even Break up the whole process. So I want to do a Custom checkout

waxen geyser
#

Okay, in that case you're going to need to build the functionality you want on your own site.

glacial nexus
#

Yes, but I Need to charge my customer somehow 😅

waxen geyser
#

You would use a Payment Intent for that.

#

But you would need to handle the cart and line item logic on your end.

#

You can't use Stripe Products and Prices with a Payment Intent.

#

On your end you would allow your customer to add things to your cart, and then during the checkout process you would create a Payment Intent for the total amount you want to charge them.

glacial nexus
#

I know. Please Check out my First Message:

The Problem was, that if I Just create the paymentintent, the Client can modify it (because For a paymentintent creation you Provide Just the amount and no price ids).

The logic for cart and lineitems is already build

#

I thought about resolving the Problem by creating a checkout Session with the lineitems, expand the paymentintent and than work with the payment intent. Does this work?

waxen geyser
#

No, that won't work.

#

I don't understand what you mean by "the Client can modify it"?

glacial nexus
waxen geyser
#

The only way you can modify a Payment Intent's amount and other properties is with your secret API key, which is not something the client has.

#

A Checkout Session won't create a Payment Intent until the URL is visited, for one thing. For another, the Payment Intent associated with a Checkout Session is only designed to be confirmed with Checkout.

glacial nexus
glacial nexus
waxen geyser
#

You would only create the Payment Intent when you know the full amount you want to charge.

#

Payment Intents are low-level objects designed to charge someone for a specified amount. They don't have any concept of line items or quantities or things like that.

#

You would keep track of line items and quantities on your end.

glacial nexus
waxen geyser
#

I'm not sure what you mean by "free floating"?

glacial nexus
#

For me, if an Object is „free floating“ it works everywhere the Same. If it will be create by a checkout session or by me, it will work in Both cases the Same

waxen geyser
#

Sorry, I'm not following. Let's back up a bit. What is blocking you and how can I help further?

glacial nexus
#

Sure, I thought about creating the paymentintent via a checkout session. For the checkout Session I can provide priceIds and I also have the paymentintent, when I expand the paymentintent. So I can use it to collect payment Details via the payment elements

waxen geyser
#

I do not believe that will work. Even if it does work today, there's no guarantee it will work tomorrow. I do not recommend that approach.

glacial nexus
#

What way I should Go Else:
We had, what does Not work For me:

  1. Invoices (inefficent)
  2. Checkout (Not Custom)
  3. Paymentintent (modifiable by customer in my Case)
  4. Checkout with paymentintent expand (Not recommended)
  5. ???
sonic robin
#

Hi there 👋 taking over for @waxen geyser

Give me a few minutes to get caught up.

glacial nexus
#

Ah sure 👍

sonic robin
#

I'm not sure I fully understand your most recent question. Why would you create a Payment Intent with Checkout? Why can't you use Payment Intents as is if you're creating a custom checkout workflow?

sonic robin
#

I feel like it would make more sense to tackle the problem of how your customers are able to modify your Payment Intent, rather than trying to build a hacky thing that's going to make the workflow even more prone to breakage.

I can't really think of a different option other than scrapping your current checkout flow and using the Payment Element instead (which I assume you do not want to do)

glacial nexus
#

The payment Elements would be Perfect, But to initiate the payment Elemente, I Need to have a paymentintent.

Currently I cannot ask my own database from the backend For clean amounts from products. If I ask Stripe (their backend) I can only do this very inefficent, to get clean amounts

sonic robin
#

I don't understand what you're saying. Terms like "clean amounts" and "products" are ambiguous. I'm also not sure what you mean by:

"If I ask Stripe (their backend) I can only do this very inefficent,".

You're assuming that I have context about your integration, but I'm afraid I don't, so you need to be explicit and define your terms, otherwise we're going to end up going around in circles.

glacial nexus
#

Ok, I‘ll explain it a bit…

#

Give me some minutes please…

glacial nexus
# sonic robin I don't understand what you're saying. Terms like "clean amounts" and "products"...

The payment Elements would be Perfect, But to initiate the payment Elemente, I Need to have a paymentintent.

I think this one is clear. Payment Elements need paymentintent to be able to get filled with payment Details by the Customer

Currently I cannot ask my own database from the backend

For clean amounts from products.

My backend has a database. In this database there are entries (products). These products have some details. Like a title, one or More categories and so on. A product also have a priceID. The user cant modify this priceID, cause if he change, the priceID will be Invalid and the checkout cannot be completed.

What do I mean by „clean prices“?
A clean price is For me a readable price. A priceID like „price_1737488374“ is not readable For me as human to see Which Price I will pay. So a „clean price“ is for me For example „100“ for 100 Cents or 1 Euro.

If I ask Stripe (their backend) I can only do this very inefficent, to get clean amounts

Now you know what I ment by this. I can receive a price by Stripe to get More Data about the Price and with this the „clean Price.“

It’s inefficent, because Stripe only offers

  1. a list from ALL prices OR
  2. a specifiy object.
    But not a mix from Both (ask for a List of specific PriceIds)
sonic robin
#

Ah, okay. Now I understand. This is a pretty uncommon situation where the back-end is not talking to the database, so I can see why the workarounds are kind of hacky. Can you set metadata on the Price ID when it is created and then just use the Search API to get just that one Price?

https://stripe.com/docs/api/prices/search

glacial nexus
#

In what kind of direction have you thought? 🙂

sonic robin
#

I guess I'm unsure of what to advise, since it seems like you have all the possible options already in front of you. If you cannot access your database in this workflow, then you're unfortunately going to have to use methods that are less efficient.

glacial nexus
#

Hm ok. Do you have an api, thats serves like the order api?

sonic robin
#

What do you mean?

glacial nexus
sonic robin
#

That's in beta and shouldn't be used for this flow as far as I can tell

glacial nexus
#

Yeah, I am in the Beta, but it will Not be supported in the Future

sonic robin
#

Right, exactly. Also, I'm not sure if it would solve any of your problems.

glacial nexus
#

Hm ok. Do you have an api, thats serves like the order api?

sonic robin
#

Again, I don't know what you mean. What do you mean by "serves"? What specific functionality are you looking for?

glacial nexus
#

I am looking For the functionality the orders api offers

sonic robin
#

Which functionality?

glacial nexus
#

The functionality, That the order api offers:
Accept PriceIds, convert it into clean prices and make a perfectly paymentintent (and also walkthouht the standard steps from an order)

wise anvil
#

The Orders API is deprecated, as you've noted, and there is not currently another API with equivalent functionality

glacial nexus
#

Oh ok. Does a beta to one exists, That can offer the functionality?

wise anvil
#

Not currently, no. You can build similar functionality by passing a cart of price/product ids to your server and building a payment intent with the correct total.

#

Alternatively, you can explore whether Checkout might fit your use case if you want to have taxes calculated for you, and offer promotion codes, shipping rates etc

glacial nexus
#

Hm ok. Than I will Just try the unrecommended way (create checkout Session, explode the paymentintent and Work with it)

wise anvil
#

IIRC you can't confirm the payment intent managed by Checkout manually, so I don't think that's going to work as you're expecting

glacial nexus
#

I cant confirm it? Can I confirm the checkout Session?

wise anvil
#

You can by redirecting to the Checkout url and completing payment there. you can't do it manually, no.

glacial nexus
#

Oh I thought my Problem solved 😭😭

wise anvil
#

You could use one-off Invoices for this, to make use of the line_items, for example -- the payment intents created within invoices can be confirmed directly. We don't recommend this, but it's possible.

glacial nexus
#

I don’t understand what you mean. Do you have docs about it?

wise anvil
#

I get that you like working with the Orders API beta, and I hope we can offer functionality like that again in future, but right now that doesn't exist. I would recommend using Checkout if you want all that functionality without the custom build, but that's up to you.

wise anvil
glacial nexus
glacial nexus
wise anvil
#

yes sorry, invoice items lead to line items.

wise anvil
glacial nexus
#

Why For the Orders api?

wise anvil
#

I can't speak to why but the impact is that its not going to be moving forward

glacial nexus
#

Ok. How do I resolve the Problem?

wise anvil
#

By building out the flow yourself using payment intents, or using Checkout or potentially this other invoice option