Support

Home Forums Event Espresso Premium Getting event espresso data as metadata in stripe

Getting event espresso data as metadata in stripe

Posted: May 6, 2021 at 8:24 am


Embercombe

May 6, 2021 at 8:24 am

Is there a way to get fields/tags from event espresso passed to stripe as metadata. We need a way of categorizing events to be passed from stripe to quickbooks, we are using a third party tool called synder to pass data from stripe to quickbooks, where it needs to be categorized for reporting. the only way we can see to do this is if we can get something meaningful from event espresso into the metadata field in stripe.


Tony

  • Support Staff

May 6, 2021 at 1:28 pm

Hi there,

I assume you are using the Stripe Element integration within the Stripe payment method rather than the legacy Stripe checkout?

If so, there’s a filter you can use to add metadata:

FHEE__EEG_Stripe_Onsite__doDirectPaymentWithPaymentIntents__payment_intent_data

You can then use that to add metadata into the intent, see:

See: https://stripe.com/docs/payments/payment-intents#storing-information-in-metadata

Is that what you are looking for?


Embercombe

May 7, 2021 at 7:27 am

Hi Tony, yes thats what Im looking for, I followed an example given by EE on gist and modified the description in stripe. Im not sure how to do that for metadata as its an associative array.

        $desc .= ' | event code: ' . get_post_meta($event->id(), 'event_code', true);
        $stripe_data['description'] = $desc;


Tony

  • Support Staff

May 7, 2021 at 10:10 am

You’re not sure how to add the metadata element into the array or how to add the associative array into metadata?

Either way, the example from the Stripe docs I linked to above should help, so they show this:


\Stripe\PaymentIntent::create([
  'amount' => 1099,
  'currency' => 'usd',
  'payment_method_types' => ['card'],
  'metadata' => [
    'order_id' => '6735',
  ],
]);

Meaning metadata is just another element within the array and its value is an associative array in key => value.

So on the above hook something like:

$stripe_data['metadata'] = array(
    'meta_data_field_1' => 'value 1',
    'meta_data_field_2' => 'value 2',
    'meta_data_field_3' => 'value 3'
);

Obviously you’ll use your own metadata keys and I don’t know where you are pulling the values from, but that should be all you need to add metadata.

The support post ‘Getting event espresso data as metadata in stripe’ is closed to new replies.

Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.

Event Espresso