Created
          August 9, 2019 09:15 
        
      - 
      
 - 
        
Save vanbo/127ede97f1a3c2552c2f54cf5b283872 to your computer and use it in GitHub Desktop.  
    WooCommerce Paysafe Hosted API Response Actions
  
        
  
    
      This file contains hidden or 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
    
  
  
    
  | /** | |
| * 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