#MMunir-payment-metadata
1 messages · Page 1 of 1 (latest)
You're looking at two different objects there. In the first screenshot you're looking at the info on the Checkout Session, but in the second you're looking at the Payment Intent. Metadata isn't expected to transfer from one object to another.
If you want the metadata to be on the Payment Intent then it needs to be passed into the payment_intent_data.metadata parameter:
https://stripe.com/docs/api/checkout/sessions/create#create_checkout_session-payment_intent_data-metadata
any solution because in this case i have to check every time to the first screenshot section for details about booking
how do we do that like the article you sent what to do after that
How are you creating these checkout sessions currently?
$session = \Stripe\Checkout\Session::create([
'success_url' => 'http://localhost:4242/?success=true',
'cancel_url' => 'http://localhost:4242/?cancel=true',
'mode' => 'payment',
'payment_method_types' => $payment_method_types[$params->currency],
'metadata' => [
'date' => $params->datepicker,
'no of adults' => $params->adults,
'no of children' => $params->children,
'package' => $params->occupancy,
'atv' => $params->atv,
'cause' => $params->cause,
'currency' => $params->currency,
],
'submit_type' => 'donate',
'line_items' => [[
'price_data' => [
'currency' => $params->currency,
'product' => $products[$params->occupancy],
'unit_amount' => $params->amount,
],
'quantity' => 1,
]]
]);
in server side i have this where i collect data from front end and use it as prams in meta section
So instead of putting that information into metadata (this is the metadata for the Checkout Session object), you'd put it into the metadata field within the payment_intent_data array.
Alternatively, you could include the metadata in both places.
metadata field within the payment_intent_data array. where can i put that like in server side which section
any video of developer or something for reference
You would put it in this request
I don't think we have any videos of this specifically. You'd use the object structure shown in our API docs to next metadata inside of the payment_intent_data parameter.
$session = \Stripe\Checkout\Session::create([
'success_url' => 'http://localhost:4242/?success=true',
'cancel_url' => 'http://localhost:4242/?cancel=true',
'mode' => 'payment',
'payment_method_types' => $payment_method_types[$params->currency],
'payment_intent_data.metadata => [
'date' => $params->datepicker,
'no of adults' => $params->adults,
'no of children' => $params->children,
'package' => $params->occupancy,
'atv' => $params->atv,
'cause' => $params->cause,
'currency' => $params->currency,
],
'submit_type' => 'donate',
'line_items' => [[
'price_data' => [
'currency' => $params->currency,
'product' => $products[$params->occupancy],
'unit_amount' => $params->amount,
],
'quantity' => 1,
]]
]);
something like this
Don't think so, it'd look more like the way price_data does inside of line_items, something like this (my php is a bit rusty so this may not be exactly right)
'success_url' => 'http://localhost:4242/?success=true',
'cancel_url' => 'http://localhost:4242/?cancel=true',
'mode' => 'payment',
'payment_method_types' => $payment_method_types[$params->currency],
'payment_intent_data' => [[
'metadata' => [
'date' => $params->datepicker,
'no of adults' => $params->adults,
'no of children' => $params->children,
'package' => $params->occupancy,
'atv' => $params->atv,
'cause' => $params->cause,
'currency' => $params->currency,
]]],
'submit_type' => 'donate',
'line_items' => [[
'price_data' => [
'currency' => $params->currency,
'product' => $products[$params->occupancy],
'unit_amount' => $params->amount,
],
'quantity' => 1,
]]
]);```
thanks no issue for the rusty got the concept thanks