#Bando
1 messages ยท Page 1 of 1 (latest)
Yeah you would need to pass price_data instead of price: https://stripe.com/docs/api/checkout/sessions/create#create_checkout_session-line_items-price_data
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
And mode would need to be payment: https://stripe.com/docs/api/checkout/sessions/create#create_checkout_session-mode
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
If i pass price_data it wont create a fresh price under the product each time will it?
It will just be used for that individual session?
Says **Data used to generate a new Price object inline. ** so i assume it means the price will be permanently generated instead of used once.
๐ stepping in as codename_duchess needs to step away
np
It does create a new Price, but that Price will be archived
Ah ok, so if I were to do this like 40-50 times its just better to create a permanent Price ?
Up to you really
But yeah if you already know ahead of the Checkout Session a set amount for your Products then having a set Price makes more sense imo
Either way works just fine however
awesome ty, just to confirm it would look like this? I'm using PHP
$stripesession = $stripe->checkout->sessions->create(['success_url' => $successurl,'cancel_url' => $cancelurl,'line_items' => [['price_data' => ['currency'=> 'usd','product'=>'prod_N7AwEq49xMdmFX','unit_amount'=>'25000'],'quantity' => 1,],],'mode' => 'payment','metadata' => ['purpose'=> 'purchase', 'type'=> $setuppurpose],'expires_at' => time() + 3600]);```
Really hard to read that unformatted. Looks good as far as I can tell. Would always recommend just testing it as the best way to check!
Ah ok no worries I appreciate ur help