I'm trying to use Stripe Checkout for a subscription service.
Using the PHP SDK
Session::create([
'customer' => $user->stripeCustomerId,
'payment_method_types' => ['card'],
'line_items' => [[
'price' => 'price_0MACBYAGG6RS7KP5c1fNa6v9',
'quantity' => $amount,
]],
'subscription_data' => [
'metadata' => [
'message' => $message,
],
],
'mode' => 'subscription',
'success_url' => UrlHelper::url('?session_id={CHECKOUT_SESSION_ID}'),
'cancel_url' => UrlHelper::url('?cancel=true'),
]);
but metadata is never attached as per the docs https://support.stripe.com/questions/using-metadata-with-checkout-sessions?locale=en-GB
I have a single charge option that passes:
'payment_intent_data' => [
'metadata' => [
'message' => $message,
],
],
and that attaches perfectly. What am I missing?
Turns out that I was looking in the wrong place. The meta data is not attached to each payment but on the actual subscription itself.