Description
Allow authorization-only transactions by preventing the capture request from being made after the entry has been saved.
Usage
The following would apply to all forms:
add_filter( 'gform_ppcp_authorization_only', 'your_function_name', 10, 2 );
To target a specific form, append the form ID to the hook name. (format: gform_ppcp_authorization_only_FORMID)
add_filter( 'gform_ppcp_authorization_only_123', 'your_function_name', 10, 2 );
To target a specific form’s feed, append the form ID and feed ID to the hook name. (format: gform_ppcp_authorization_only_FORMID_FEEDID)
add_filter( 'gform_ppcp_authorization_only_123_1', 'your_function_name', 10, 2 );
Parameters
- $authorization_only bool
Defaults to the value saved in the feed meta. Returntrue
to prevent payment from being captured. - $feed Feed Object
The Feed object.
Examples
Prevent the payment from being captured.
add_filter( 'gform_ppcp_authorization_only', '__return_true', 10, 2 );
Placement
This code can be used in the functions.php file of the active theme, a custom functions plugin, a custom add-on, or with a code snippets plugin.
See also the PHP section in this article: Where Do I Put This Code?
Source Code
This filter is located in GF_PPCP::register_init_scripts() in class-gf-ppcp.php.