NETbilling developer reference

The filter for changing the parameters NETbilling for WooCommerce sends to NETbilling.

Beka Rice Avatar

Written by

Last updated


NETbilling for WooCommerce has one filter for developers: it changes the parameters the plugin sends to NETbilling’s API. Add the code below to a code snippets plugin or your child theme’s functions.php. For setting up the plugin itself, see Get started with NETbilling.

Filter request parameters

wc_netbilling_request_parameters filters the parameters of every request the plugin sends to NETbilling’s API, just before it’s sent.

ArgumentTypeDescription
$parametersarrayThe request parameters, such as account_id, site_tag, amount and the billing details.
$orderWC_OrderThe order being paid.

Return the parameters array. API requests are every payment on the NETbilling API – Credit Card gateway, plus saved card payments, subscription renewals and pre-order charges on either gateway. Payments a customer makes on the NETbilling Direct Post – Credit Card payment form go from their browser to NETbilling, so this filter doesn’t affect them.

Send a Dynamic IP Security Code

NETbilling checks that API requests come from a trusted server IP address, and recommends trusted static IP addresses in nearly all cases. If your server’s IP address changes, or you can’t know it in advance, NETbilling can accept a Dynamic IP Security Code instead.

  1. In your NETbilling account, go to Account Setup » Account Management » Access Security and generate a Dynamic IP Security Code.
  2. Add this snippet, replacing YOUR_DYNAMIC_IP_SECURITY_CODE with your code:
function wc_netbilling_request_parameters_dynip_sec_code( $parameters ) {

	// Replace with the Dynamic IP Security Code from Account Setup > Account Management > Access Security in your NETbilling account.
	$parameters['dynip_sec_code'] = 'YOUR_DYNAMIC_IP_SECURITY_CODE';

	return $parameters;
}
add_filter( 'wc_netbilling_request_parameters', 'wc_netbilling_request_parameters_dynip_sec_code' );

Treat the code like a password. Keep it out of screenshots, support tickets, forum posts and public code repositories, and generate a new one in NETbilling if it’s ever shared. If you can, store it in wp-config.php as a constant and reference the constant in the snippet instead of pasting the code into it.

Keep learning