#FacuTerrens

1 messages · Page 1 of 1 (latest)

sleek mothBOT
rotund yew
#

Hello

arctic bluff
#

Hi!

rotund yew
#

Let's use this thread

#

Going to move your messages into the thread

#
$checkout_session = \Stripe\Checkout\Session::create([
  'line_items' => [[
    # Provide the exact Price ID (e.g. pr_1234) of the product you want to sell
    'price' => 'price_1MP5AKCelbZ8ISVz6FrO5c5D',
    'quantity' => 1,
  ]],
  'mode' => 'payment',
  'success_url' => $YOUR_DOMAIN . '?success=true',
  'cancel_url' => $YOUR_DOMAIN . '?canceled=true',
]);
This works```
#
  'line_items' => [[
    # Provide the exact Price ID (e.g. pr_1234) of the product you want to sell
    'price' => $id_stipe,
    'quantity' => 1,
  ]],
  'mode' => 'payment',
  'success_url' => $YOUR_DOMAIN . '?success=true',
  'cancel_url' => $YOUR_DOMAIN . '?canceled=true',
]);
but this no```
arctic bluff
#

thanks

rotund yew
#

What error are you seeing?

#

Have you logged out $id_stipe?

#

And are you sure that isn't a typo and should be $id_stripe?

arctic bluff
#

When I replace the value of price that is between '', by the variable $id_stripe, I get an error

rotund yew
#

Yep so sounds like an issue with that variable

#

How are you intializing the variable?

arctic bluff
#

$id_stripe = $_GET['id_stripe'];

#

I send it from here: header('Location: ../admin/stripe-check.php?id_stripe='.$id_stripe);

rotund yew
#

Okay so you likely aren't actually getting the Price there

#

You need to add a log to check on that variable after you initialize it

arctic bluff
#

And how do you do that?

rotund yew
#

Well there are various ways, sometimes I use something like error_log in PHP but this is something that you as a developer need to handle. I can't walk you through writing logs.

arctic bluff
#

For example, it works for me here, here I create the products and services

#

but here no

rotund yew
arctic bluff
#

It is already fixed, the error was that it was as 'payment' and I had to put it as 'subscription'

#

thanks!

rotund yew
#

Glad you figured it out!