#kqtipow-custom-metadata

1 messages · Page 1 of 1 (latest)

unkempt orchid
#

As for creating a Price, you would need to do that separate from any of the Checkout Session API calls.

languid junco
#

hmm

#

maybe I should try to fetch data

#

trying to run php file, make session and include metadata then?

unkempt orchid
#

That should work

languid junco
#

I mean something like ```const createCheckoutSession = function (stripe) {
return fetch("payment_init.php", {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({
createCheckoutSession: 1,
}),
}).then(function (result) {
return result.json();
});
};

unkempt orchid
#

If you're fetching the file that runs

$stripe->checkout->sessions->create([ 'success_url' => 'https://example.com/success', 'cancel_url' => 'https://example.com/cancel', 'line_items' => [ [ 'price' => 'price_abc123', 'quantity' => 1, ], ], 'mode' => 'payment', 'metadata' => [ 'some_key' => 'some value' ] ]);

languid junco
#

nad how will be define $stripe variable?

unkempt orchid
#

Can you explain what you're asking?

languid junco
#
require_once('vendor/autoload.php');
\Stripe\Stripe::setApiKey()```
#

maybe we will need also that?

#

ini php