WC_Gateway_Paypal_IPN_Handler::save_paypal_meta_data()protectedWC 1.0

Save important data from the IPN to the order.

Method of the class: WC_Gateway_Paypal_IPN_Handler{}

No Hooks.

Return

null. Nothing (null).

Usage

// protected - for code of main (parent) or child class
$result = $this->save_paypal_meta_data( $order, $posted );
$order(WC_Order) (required)
Order object.
$posted(array) (required)
Posted data.

WC_Gateway_Paypal_IPN_Handler::save_paypal_meta_data() code WC 8.7.0

protected function save_paypal_meta_data( $order, $posted ) {
	if ( ! empty( $posted['payment_type'] ) ) {
		$order->update_meta_data( 'Payment type', wc_clean( $posted['payment_type'] ) );
	}
	if ( ! empty( $posted['txn_id'] ) ) {
		$order->set_transaction_id( wc_clean( $posted['txn_id'] ) );
	}
	if ( ! empty( $posted['payment_status'] ) ) {
		$order->update_meta_data( '_paypal_status', wc_clean( $posted['payment_status'] ) );
	}
	$order->save();
}