#SupraLP
1 messages · Page 1 of 1 (latest)
hello! you can use these parameters : 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.
there is only a solution with the price key but i just want like 20 CHF not to create a Product in the dashboard
the price_data parameter doesn't require you to input a Price id
my code is like this
$stripe->checkout->sessions->create([
'success_url' => 'https://example.com/success',
'cancel_url' => 'https://example.com/cancel',
'line_items' => [
[
'price' => 'price_H5ggYwtDq4fbrJ',
'quantity' => 2,
],
],
'mode' => 'payment',
]);
and i wanted instead of 'price' => 'price_H5ggYwtDq4fbrJ', to do like 'price' => 20
that's not possible. The closest you can get to something like that is to use the price_data parameter
can you give me an example for the usage for price_data
the formatting is terrible, but probably something like this
'success_url' => 'https://example.com/success',
'cancel_url' => 'https://example.com/cancel',
'line_items' => [
[
'price_data' => [
'product_data' =>[
'name' => 'product_name'
],
'unit_amount' => 100,
'currency'=> 'eur'
],
'quantity' => 1,
],
],
'mode' => 'payment'
]);
]);
i'm gonna try it. can you keep the thread open?