Skip to content

Instantly share code, notes, and snippets.

@vanbo
Created August 9, 2019 09:15
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vanbo/127ede97f1a3c2552c2f54cf5b283872 to your computer and use it in GitHub Desktop.
Save vanbo/127ede97f1a3c2552c2f54cf5b283872 to your computer and use it in GitHub Desktop.
WooCommerce Paysafe Hosted API Response Actions
/**
* Response actions
*
* do_action( 'wc_paysafe_payment_response_processed', $order, $response );
* do_action( 'wc_paysafe_redirect_hosted_response_processed', $response, $this, $order );
* do_action( 'wc_paysafe_redirect_hosted_declined_response_processed', $response, $this, $order );
* do_action( 'wc_paysafe_redirect_hosted_cancelled_response_processed', $response, $this, $order );
* do_action( 'wc_paysafe_redirect_hosted_errored_response_processed', $response, $this, $order );
* do_action( 'wc_paysafe_redirect_hosted_pending_response_processed', $response, $this, $order );
* do_action( 'wc_paysafe_redirect_hosted_settlement_response_processed', $response, $this, $order );
*/
add_action( 'wc_paysafe_redirect_hosted_successful_response_processed', 'prefix_redirect_hosted_successful_response', 10, 3 );
/**
* @param object $response
* @param \WcPaysafe\Gateways\Redirect\Hosted\Response_Hosted|\WcPaysafe\Gateways\Redirect\Hosted\Response_Hosted_Addons $processor
* @param \WC_Order $order
*/
function prefix_redirect_hosted_successful_response( $response, $processor, $order ) {
/**
* The $response object can be viewed in: https://developer.paysafe.com/en/hosted/api#/reference/orders/process-an-order
*/
// Some data that can be accessed
$transaction_status = $response->transaction->status;
$confirmation_number = $response->transaction->confirmationNumber;
$card_brand = $response->transaction->card->brand;
$card_last_digits = $response->transaction->card->lastDigits;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment