#SupraLP

1 messages · Page 1 of 1 (latest)

hardy lindenBOT
mental crater
fathom lotus
#

there is only a solution with the price key but i just want like 20 CHF not to create a Product in the dashboard

mental crater
#

the price_data parameter doesn't require you to input a Price id

fathom lotus
#

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

mental crater
#

that's not possible. The closest you can get to something like that is to use the price_data parameter

fathom lotus
#

can you give me an example for the usage for price_data

mental crater
#

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'
                                          ]);

                                          ]);
fathom lotus
#

i'm gonna try it. can you keep the thread open?