fn_pay_confirm_complete

Check if order is complete after payment (notify url), used by the successlink.

Description

(string) fn_pay_confirm_complete( $gateway ); 

Returns (string)

- returns the url the redirect page

Parameters (1)

0. $gateway
The gateway.

Usage

  1. if ( !function_exists( 'fn_pay_confirm_complete' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'woocommerce-payment-gateway-for-saferpay/fn-saferpay.php'; 
  3.  
  4. // The gateway. 
  5. $gateway = null; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = fn_pay_confirm_complete($gateway); 
  9.  

Defined (1)

The function is defined in the following location(s).

/fn-saferpay.php  
  1. function fn_pay_confirm_complete($gateway) 
  2.  
  3. global $woocommerce; 
  4.  
  5. // Check if order is payed for and display the thank you page. 
  6. if (!empty($_GET)) 
  7. parse_str($_SERVER['QUERY_STRING'], $output); 
  8.  
  9. $xml = simplexml_load_string($output['DATA']); 
  10.  
  11. if($xml) 
  12. $id = fn_simplexml_attribute($xml, 'ID'); 
  13. $amount = fn_simplexml_attribute($xml, 'AMOUNT'); 
  14.  
  15. // Get the order from the server 
  16. $orderid_with_prefix = fn_simplexml_attribute($xml, 'ORDERID'); 
  17.  
  18. // Get the order id without prefix 
  19. $orderid = str_replace($gateway->order_id_prefix, '', $orderid_with_prefix); 
  20.  
  21.  
  22.  
  23. if($orderid != "") 
  24. $order = new WC_Order($orderid);  
  25.  
  26. if($order->status == 'completed' || $order->status == 'processing') 
  27. // Display the Thank you page 
  28. $pid = woocommerce_get_page_id('thanks'); 
  29. return get_permalink($pid);  
  30.  
  31.  
  32.  
  33.  
  34.  
  35. // Payment could not be verfied 
  36. $pid = get_option( 'saferpay_page_id', 0); 
  37. return get_permalink($pid) . "?o=" . $order->id;  
  38.  
  39.