#bokgold-checkout-metadata

1 messages ยท Page 1 of 1 (latest)

feral wraith
#

Hey @smoky falcon let's talk here

#

sorry, I deleted your messages but the thing that creates the thread didn't work

smoky falcon
#

$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']]],
]);
feral wraith
#

So step 1, what do you call "show on the statement"? What's a statement?

smoky falcon
#

What shows up on "payments" dashboard

feral wraith
#

I don't know what that means either sorry, please be more specific.

smoky falcon
#

I want "Manual Payment" descriptor

feral wraith
#

Okay so that's the description in that case. So it'd be 'payment_intent_data'=>['description' => $pay['product'],'metadata'

#

that first param

smoky falcon
#

does not work

feral wraith
#
'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

smoky falcon
#

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

feral wraith
#

Can you clarify your exact question? What did you look at, what's not working

smoky falcon
#

customer email is provided

#

is it because of test mode?

feral wraith
#

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

smoky falcon
feral wraith
#

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

smoky falcon
#

OK .. that is confusing .. given checkout has a FIELD called "customer_email"

feral wraith
#

yeah that's fair

smoky falcon
#

Anyhow I placed email in metadata

feral wraith
#

๐Ÿ‘

smoky falcon
#

LASTLY .. I saw various "version" related comments .. how do I know what VERSION I am on ??

feral wraith
#

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

smoky falcon
#

You are running the current version of the API, 2022-11-15. ...

#

Is that good ? Seems very recent

feral wraith
#

that's the most recent yes!

smoky falcon
#

OK great

feral wraith
smoky falcon
#

How does that relate to my vendor/stripe version - which was installed 7/2022

#

for my server / php

feral wraith
#

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

smoky falcon
#

Exactly !!

feral wraith
#

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

smoky falcon
#

Hold on - I dont see how to "pin" the version from that link - I got caught out by this before

feral wraith
#
  "api_key" => "sk_test_your_key",
  "stripe_version" => "2022-11-15"
]);```
#

that's what I see on that doc I shared

smoky falcon
#

this what you mean?

feral wraith
#

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

smoky falcon
#

OK - will check that - thanks again for your help - you guys must be busy - cos Stripe Docs are terrible ๐Ÿ˜† ๐Ÿ˜† ๐Ÿ˜†

feral wraith
#

Hmmm I mean I understand the frustration but you started by saying nothing worked when really it did just work :p

smoky falcon
#

One last thing

#

\Stripe\Stripe::setApiKey($secret_key);
\Stripe\Stripe::setClientId($client_id);

#

How does one set version using this method to init

feral wraith
#

but you can do // Set a global API version \Stripe\Stripe::setApiVersion('2022-08-01'); instead (mentioned in that doc)

smoky falcon
#

Honestly I don't like this method either - but somehow I got started on it ๐Ÿ˜†

feral wraith
#

yeah but migrating is fairly straightforward so I'd recommend making the switch now

smoky falcon
#

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 ๐Ÿ˜‚

feral wraith
#

each library has its own wiki specific to the library and its migration over time

smoky falcon
#

Sure thing - but still - your docs do a very poor job of tying things together

#

I will look to upgrade in future tho

#

Thanks again and have a good day ๐Ÿ‘