Skip to content

Instantly share code, notes, and snippets.

@spencerfinnell
Created August 31, 2020 15:51
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 spencerfinnell/52188c2e94759e06547e7342ebe003aa to your computer and use it in GitHub Desktop.
Save spencerfinnell/52188c2e94759e06547e7342ebe003aa to your computer and use it in GitHub Desktop.
<?php
/**
* Retrieve payment confirmation data.
*/
add_action( 'init', function() {
$data = \SimplePay\Core\Payments\Payment_Confirmation\get_confirmation_data();
if ( ! isset( $data['customer'] ) ) {
return;
}
$payment = current( $data['paymentintents'] );
$charge = current( $payment->charges->data );
$billing = $charge->billing_details;
$name = $billing->name;
// Do something with $name...
} );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment