Created
November 3, 2017 11:50
-
-
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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