gform_square_authorization_only

gform_square_authorization_only

DescriptionUsageParametersExamples1. Apply to all product and service feeds2. Apply to a specific feedPlacementSinceSource Code

Description
The gform_square_authorization_only filter allows authorization only transactions by preventing the capture request from being made after the entry has been saved.
Note: Payments that are only authorized and not captured via your Square dashboard within 6 days will automatically expire.
Usage
The hook which would run for all Square product and service feeds can be used like so:
1add_filter( 'gform_square_authorization_only', 'your_function_name', 10, 5 );

Parameters

$authorization_only bool
Defaults to false, return true to prevent payment being captured.

$feed Feed Object
The feed object currently being processed.

$submission_data Submission Data
The customer and transaction data.

$form Form Object
The form object currently being processed.

$entry Entry Object
The entry object currently being processed.

Examples
1. Apply to all product and service feeds
1add_filter( 'gform_square_authorization_only', '__return_true' );
2. Apply to a specific feed
The following example shows how you can delay the subscription cancellation for a specific feed by checking the feed name.
123456789add_filter( 'gform_square_authorization_only', 'square_authorization_only', 10, 2 );function square_authorization_only( $authorization_only, $feed ) {    $feed_name  = rgars( $feed, 'meta/feedName' );    if ( $feed_name == 'your feed name here' ) {        return true;    }     return $authorization_only;}
Placement
Your code snippet should be placed in the functions.php file of your active theme.
Since
This hook was added in Square version 1.0.
Source Code
1$authorization_only = apply_filters( 'gform_square_authorization_only', false, $feed, $submission_data, $form, $entry );
This hook is located in GF_Square::get_capture_method() in class-gf-square.php.

發表回覆

您的郵箱地址不會被公開。 必填項已用 * 標註