Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Gum's avatar
Level 2

3rd party (stripe) metadata best practice

Is there a best practice of storing metadata in 3rd party systems?

When we create a payment we use stripe metadata to reference a record in our system.

StripePaymentIntent::create([
  'amount' => 200,
  'metadata' => [
    'our_app' => '{'invoice_id': 'invoice_123'}'
  ]
]);

Because we use stripe connect this will be visible and editable in the user's platform. I feel like this is too open.

The only other way I could think to do this was base64 encoding which would give us something like:

StripePaymentIntent::create([
  'amount' => 200,
  'metadata' => [
    'our_app' => 'eydpbnZvaWNlX2lkJzogJ2ludm9pY2VfMTIzJ30='
  ]
]);

Is there a better/best way to do this?

0 likes
0 replies

Please or to participate in this conversation.