#bokgold-checkout-metadata
1 messages ยท Page 1 of 1 (latest)
Hey @smoky falcon let's talk here
sorry, I deleted your messages but the thing that creates the thread didn't work
$result = \Stripe\Checkout\Session::create([
'payment_method_types' => ['card'],
'line_items' => [[
'price_data' => [
'currency' => strtolower($pay['currency']),
'product_data' => [
'name' => $pay['name'],
'description' => $pay['product'],
],
'unit_amount' => $pay['amount'],
],
'quantity' => 1,
]],
'mode' => 'payment',
'client_reference_id' => SERVICE,
'success_url' => $url,
'cancel_url' => LIVE_URL.'/accounts',
'customer_email'=>$pay['email'],
'payment_intent_data'=>['description' => $pay['product'],'metadata' => ['user_id'=>$pay['user_id']]],
]);
So step 1, what do you call "show on the statement"? What's a statement?
What shows up on "payments" dashboard
I don't know what that means either sorry, please be more specific.
Okay so that's the description in that case. So it'd be 'payment_intent_data'=>['description' => $pay['product'],'metadata'
that first param
does not work
'payment_intent_data'=>[
'description' => 'is koopajah correct?',
'metadata' => [
'user_id'=>$pay['user_id'],
]
],
try that ^
I'll test in parallel
yep just tested and it works.
My guess is that your $pay['product'] was an empty string/undefined. But with my example it will show
OK - that worked - I must have not saved before testing that option
What about the customer email?
Altho owner email should be ok - since I preload that
Can you clarify your exact question? What did you look at, what's not working
I don't know yet, that's a picture with no context. Can you please provide detailed information for me to look at this?
Exact Checkout Session id and PaymentIntent id especially
can you view this https://dashboard.stripe.com/test/payments/pi_3MEuWrE77ALf5wkc13i4kFLf
that PaymentIntent has no Customer associated with it. It's a one-time/ad-hoc payment, so there's no customer information associated with it in this case
I don't know much about the big yellow banner here, my team doesn't really touch the Dashboard so I can't speak to what that does in Live mode/production unfortunately
OK .. that is confusing .. given checkout has a FIELD called "customer_email"
yeah that's fair
Anyhow I placed email in metadata
๐
LASTLY .. I saw various "version" related comments .. how do I know what VERSION I am on ??
It depends on a few things. You can see the default API version for your account here: https://dashboard.stripe.com/test/developers (bottom left in the API version section)
But your code/integration can use a different API version so that's also up to your own code and it's always best for the code to ask for the exact version you want instead of relying on the account's default
looking at the logs you shared, you are on the latest API version right now 2022-11-15
You are running the current version of the API, 2022-11-15. ...
Is that good ? Seems very recent
that's the most recent yes!
OK great
https://stripe.com/docs/upgrades#api-versions lists all our API versions and yours is the most recent that we released last month
How does that relate to my vendor/stripe version - which was installed 7/2022
for my server / php
it doesn't. Our PHP library supports any
any API version
So really your code is likely not doing what we call "version pinning" and just using whatever is the default on your account.
It's dangerous because in a year we might release a breaking change, and your code works fine still, but then you click the button to change the default API version without realizing it could break your code
so what we recommend is to "pin your API version" explicitly in the code as documented in https://stripe.com/docs/api/versioning instead
Exactly !!
that way if someone on your team thinks "oh a new version let me get that one" and clicks on that button, your code still works because you tell our API "hey I'm using version X for this request please"
and then later when you/your devs are ready, they can change your code to pin to a more recent version
Hold on - I dont see how to "pin" the version from that link - I got caught out by this before
"api_key" => "sk_test_your_key",
"stripe_version" => "2022-11-15"
]);```
that's what I see on that doc I shared
this what you mean?
you just leaked your API key, please roll it asap: https://stripe.com/docs/keys#rolling-keys
but yes
that creates a Stripe Client in your code pinned to that specific version and then your code uses that specific client with the right version
OK - will check that - thanks again for your help - you guys must be busy - cos Stripe Docs are terrible ๐ ๐ ๐
Hmmm I mean I understand the frustration but you started by saying nothing worked when really it did just work :p
One last thing
\Stripe\Stripe::setApiKey($secret_key);
\Stripe\Stripe::setClientId($client_id);
How does one set version using this method to init
I highly recommend moving away from this old approach entirely. Read https://github.com/stripe/stripe-php/wiki/Migration-to-StripeClient-and-services-in-7.33.0
but you can do // Set a global API version \Stripe\Stripe::setApiVersion('2022-08-01'); instead (mentioned in that doc)
Honestly I don't like this method either - but somehow I got started on it ๐
yeah but migrating is fairly straightforward so I'd recommend making the switch now
I will change to this $stripe = new \Stripe\StripeClient(STRIPE_SECRET); later
Also I couldn't find this simple migration in your DOCS
And yes trying to match the old syntax to new examples is almost impossible ๐
each library has its own wiki specific to the library and its migration over time