1

I have created a custom Payment Gateway for a special EFT system we have setup. The Bank Account and Routing Number are supposed to get encrypted then sent to a Salesforce via the WooCommerce webhooks to be processed.

Unfortunately, I cannot figure out how to add the Bank Number and Routing Number as line-items to the Order Webhook. I have been able to add them to the product line of a webhook, but that is not helpful, because it makes the webhook messy when every product has the bank number and routing number in the array. I feel like I've tried about every hook and filter, and I've tried to look in the hooks and filters of some other payment gateways and i have not been able to figure it out.

Any clues on how I can hook a field in a payment gateway to the Order webhooks?

closed as off-topic by TheDeadMedic, Howdy_McGee, Pieter Goosen, cybmeta, kaiser Feb 6 '16 at 10:57

This question appears to be off-topic. The users who voted to close gave this specific reason:

If this question can be reworded to fit the rules in the help center, please edit the question.

3

Thanks, will do next time. I figured this one out:

function my_custom_wc_api_order_response( $order_data, $order, $fields ) {
  $customer_info = get_post_meta( $order->id, '_customer_info', true );

  $order_data['payment_details']['customer_info'] = $customer_info;

  // Apply filters if necessary
  if ( $fields ) {
    $order_data = WC()->api->WC_API_Customers->filter_response_fields( $order_data, $order, $fields );
  }

  return $order_data;
}

add_filter( 'woocommerce_api_order_response', 'my_custom_wc_api_order_response', 10, 3 );

Not the answer you're looking for? Browse other questions tagged or ask your own question.