#rob.g
1 messages · Page 1 of 1 (latest)
Currently you specify the amount directly when creating the payment intent:
https://stripe.com/docs/api/payment_intents/create#create_payment_intent-amount
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
You wouldn't use the price ID with that today (though we're working on supporting this)
So there's no way to create a client_secret for the Elements form that's bound to a product with a one-time fee?
Hmm i'm not too sure what you mean or what you're trying to do
client_secrets are tied to a single payment/setup intent for client side use
They are not re-usable across many customers
What are you trying to accomplish as an end goal?
Not trying to reuse them across customers. Sorry if I'm doing a poor job of explaining
I made a product, which has a priceId associated with it. It's a one-time payment (not recurring)
On my app, I'm using the Stripe Elements form to take card info, etc. from the customer and charge them
The Stripe Elements form requires a client_secret to be initialized– so that it knows what it's charging for and how much to charge, I guess?
I can find examples of Stripe Elements for subscriptions, and for individual paymentIntents on the stripe website. But there are no examples (that I can find) for a product that's not a subscription
Yep, so you'll need to create that payment intent server side and send the client_secret to your front end
You don't need a product for payment intents, you just supply the amount and currency (same amount that would be on a one-time price, eg)
Exactly, but then it's not associated to the product at all. I can't see that customer X bought product Y, just that customer X paid $5. I guess it just felt like it should be possible to use Stripe Elements with a one-time product but it sounds like you're saying that just isn't possible.
I appreciate the help by the way! Not trying to be difficult. Just making sure I get it
Gotcha, totally understandable
We're working on making this better, but today what i'd suggest is putting that price/product or any other reference you need for your systems in the payment intent metadata
metadata[product]=prod_123 or metadata[prod_name]=cool widget or both, etc, as you see fit
You can them read this in your systems to make the necessary mappings
NP!