WC_Gateway_Paypal_IPN_Handler::save_paypal_meta_data
Save important data from the IPN to the order.
Method of the class: WC_Gateway_Paypal_IPN_Handler{}
No Hooks.
Returns
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() WC Gateway Paypal IPN Handler::save paypal meta data code WC 10.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( PayPalConstants::PAYPAL_ORDER_META_STATUS, wc_clean( $posted['payment_status'] ) );
}
$order->save();
}