#MMunir-payment-metadata

1 messages · Page 1 of 1 (latest)

granite canopy
#

Hi there 👋 can you elaborate a bit?

gilded rune
#

as you can see i got metadata like date and all stuff

#

in this its nothing

granite canopy
#

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.

gilded rune
#

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

granite canopy
#

How are you creating these checkout sessions currently?

gilded rune
#

$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

granite canopy
#

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.

gilded rune
#

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

granite canopy
#

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.

gilded rune
#

$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

granite canopy
#

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,
    ]]
  ]);```
gilded rune
#

thanks no issue for the rusty got the concept thanks