Skip to content

Instantly share code, notes, and snippets.

@Pebblo
Created November 3, 2017 11:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Pebblo/3e9f4775c05d0ad5d2bf65f9d717b106 to your computer and use it in GitHub Desktop.
Save Pebblo/3e9f4775c05d0ad5d2bf65f9d717b106 to your computer and use it in GitHub Desktop.
Example of how to filter the Stripe payment method's $stripe_data variable to include metadata.
<?php //Please do not include the opening PHP tag if you already have one
function tw_ee_stripe_meta_data( $stripe_data, $payment, $transaction, $billing_info) {
if($transaction instanceof EE_Transaction) {
$primary_registration = $transaction->primary_registration();
if($primary_registration instanceof EE_Registration) {
$primary_attendee = $primary_registration->attendee();
if($primary_attendee instanceof EE_Attendee) {
$stripe_data['metadata'] = array(
'name' => $primary_attendee->full_name();
);
}
}
}
return $stripe_data;
}
add_filter('FHEE__EEG_Stripe_Onsite__do_direct_payment__stripe_data_array', 'tw_ee_stripe_meta_data', 10, 4);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment