Skip to content
Advertisement

Stripe checkout: description in dashboard instead of pi

Can anyone help me? I migrate form v2 to v3 checkout.

how can I send my custom description order in stripe dashboard description column? now I get only the payment id pi_1IrhQALKfdoxxl3X07seJ5anto

with old API by description I would do:

$charge = StripeCharge::create(array(
    "amount" => $_POST['amount'],
    "currency" => "EUR",
    "description" => "Order #".$_POST["order"],
    "source" => $token,
));

with the new API :

    $stripe->checkout->sessions->create([
  'success_url' => 'https://example.com/success',
  'cancel_url' => 'https://example.com/cancel',
  'payment_method_types' => ['card'],
  'line_items' => [
    [
      'price' => 'price_H5ggYwtDq4fbrJ',
      'quantity' => 2,
    ],
  ],
  'mode' => 'payment',
]);

Thank you

Advertisement

Answer

according to the stripe documentation : https://stripe.com/docs/api/checkout/sessions/create#create_checkout_session-payment_intent_data-description

$stripe->checkout->sessions->create([
  'success_url' => 'https://example.com/success',
  'cancel_url' => 'https://example.com/cancel',
  'payment_method_types' => ['card'],
  'line_items' => [
    [
      'price' => 'price_H5ggYwtDq4fbrJ',
      'quantity' => 2,
    ],
  ],
  'mode' => 'payment',
  'payment_intent_data' => [
    'description' => "Order #".$_POST["order"]
  ]
]);
User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement