• I can capture (or) output what api sent to me such as transaction id, amount, etc.

    but i can’t change order status Pending Payment to Processing.

    Here my code.

    <?php
    if ( in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) )
    {
    	function wingpay_callback()
    	{
    		if(isset($_GET['wingpay_callback']))
    		{
    			global $woocommerce;
    			@ob_clean();			
    
    			$gateways = $woocommerce->payment_gateways->payment_gateways();
    
    			if (!isset($gateways['wc_paymentwing']))
    			{
    				error_log('Wing plugin not enabled in woocommerce');
    				return;
    			}
    			$wing = $gateways['wc_paymentwing'];
    
    			$data = file_get_contents("php://input");
    			$json=json_decode($data,true);
    
    			if($json['tstatus'] == '200'){
    
    				$tid = $json['tid'];
    				$account = $json['account'];
    				$amount = $json['amount'];
    				$token = $json['token'];
    
    				$order = new WC_Order($order_id);
    
    				//echo $tid . '<br/>';
    
    				$order -> add_order_note(__('Wing - Payment status is processing<br/>Transaction ID from Wing:', 'wc_paymentwing').' '.$tid);
    				$order -> update_status('processing');			
    
    			//echo "success";
    			} else echo "fail";
    		}
    	}
    	add_action('init', 'wingpay_callback');
    }

    Please advice for me!

    https://wordpress.org/plugins/woocommerce/

The topic ‘Order Status not Changing’ is closed to new replies.