#jamesr9118
1 messages · Page 1 of 1 (latest)
hi! it depends on the exact area. Prices represent the item/product/service you're selling, as a structured object with extra data and information, which allows for richer checkout experiences and easier reporting. Some APIs require you to pass a Price(like creating a Subscription), for some they require them but you can create the Price "ad-hoc" at the time of calling the API(like Checkout), and some APIs are more basic(like creating a raw PaymentIntent) and don't accept Prices at all.
in general we recommend using Prices everywhere it's possible to do so
You mean Price ID as generated by stripe?
the price_xxxx string that is the ID of a Price object(https://stripe.com/docs/api/prices/object#price_object-id), yes
Yes I recognise that, have created a product in the dashboard. but I prefer the stripe ui in my app.
$paymentIntent = $stripe->paymentIntents->create([
'amount' => 2000,
'currency' => 'sgd',
'automatic_payment_methods' => ['enabled' => true], // for sdg includes PayNow
// 'payment_method_types' => ['card'], // has limited payment options
]);
yeah unfortunately as I said, raw PaymentIntents don't accept Prices
only things like Checkout/Subscriptions/Invoices do
This work in my embedded stripe elements
if you're using a raw PaymentIntent + Elements you have to manually pass the amount and currency(you could read those from your Price object and pass them through if you want)
Yes, or I could do that with my own database and shopping cart and pass the final amount at checkout, right?
yep, you could
What is the disadvantage? Billing would be cryptic?
mainly it's just that the reporting experience on Stripe doesn't "know" what customers are actually buying
since all we know are the raw amounts
Can I add more product data in this $stripe->paymentIntents->create() method in addition to just amount?
no
Hmm ...
you can add metadata if you want, but I don't think Stripe will use that for anything, but it can make your own reporting easier if you pull data from the API later
really I don't know much about the details of how the reports or any of that stuff works, we don't focus on that type of question on Discord
also, I have to run but my colleague @glass palm will take over
thank you.
$paymentIntent = $stripe->paymentIntents->create([
'amount' => 2000,
'currency' => 'sgd',
'automatic_payment_methods' => ['enabled' => true], // for sdg includes PayNow
// 'payment_method_types' => ['card'], // has limited payment options
]);
Hi! I'm taking over from my colleague. Please, give me a moment to catch up.
in this code, can I use 'price' => 'price_xxxxx'?