Introduction
The Feed Meta Object for the Square Add-On is an associative array with properties determining how the add-on should process the form submission.
$feed['meta'] = array(
'feedName' => 'Square Feed Example',
'transactionType' => 'product',
'paymentAmount' => '',
'authorizeOnly' => '0',
'billingCycle_length' => '',
'billingCycle_unit' => '',
'recurringTimes' => '',
'setupFee_enabled' => false,
'setupFee' => '',
'feed_condition_conditional_logic' => false,
'feed_condition_conditional_logic_object' => array(
'conditionalLogic' => array(
'actionType' => '',
'logicType' => '',
'rules' => array(
array(
'fieldId' => '',
'operator' => '',
'value' => '',
),
),
),
),
'subscription_name' => '',
'billingInformation_email' => '',
'billingInformation_first_name' => '',
'billingInformation_last_name' => '',
'billingInformation_address_line1'=> '',
'billingInformation_address_line2'=> '',
'billingInformation_address_city' => '',
'billingInformation_address_state'=> '',
'billingInformation_address_zip' => '',
'billingInformation_address_country' => '',
);
Usage
We recommend accessing the $feed meta using the rgar() or rgars() functions, e.g.:
$conditional_logic_enabled = rgars( $feed, 'meta/feedCondition' );
if ( $conditional_logic_enabled ) {
// Conditional logic is enabled for this feed.
$logic_rules = rgars( $feed, 'meta/feed_condition_conditional_logic_object/conditionalLogic/rules' );
foreach ( $logic_rules as $rule ) {
// Process each conditional logic rule.
$field_id = rgar( $rule, 'fieldId' );
$operator = rgar( $rule, 'operator' );
$value = rgar( $rule, 'value' );
// Example: Use $field_id, $operator, and $value in your logic.
}
}
Properties
Property | Type | Description |
---|---|---|
feedName | string | A unique name for the feed. |
transactionType | string | The type of transaction: ‘product’ or ‘subscription’. |
paymentAmount | string | Specifies the amount to charge for the transaction. |
authorizeOnly | boolean | Indicates whether to authorize the payment only (true) or capture it immediately (false). |
billingCycle_length | string | Specifies the length of the billing cycle for subscriptions. |
billingCycle_unit | string | Specifies the unit of time for the billing cycle: ‘week’, ‘month’, or ‘year’. |
recurringTimes | string | The number of billing cycles for a subscription (or leave empty for ongoing). |
setupFee_enabled | boolean | Enables a one-time setup fee for subscriptions. |
setupFee | string | Specifies the setup fee amount. |
feed_condition_conditional_logic | boolean | Enables conditional logic to determine if the feed should run. |
feed_condition_conditional_logic_object | array | Stores the conditional logic rules, including the field ID, operator, and value. |
subscription_name | string | A custom name for the subscription. |
billingInformation_email | string | The customer’s email address. |
billingInformation_first_name | string | The customer’s first name. |
billingInformation_last_name | string | The customer’s last name. |
billingInformation_address_line1 | string | The first line of the customer’s billing address. |
billingInformation_address_line2 | string | The second line of the customer’s billing address (optional). |
billingInformation_address_city | string | The city of the customer’s billing address. |
billingInformation_address_state | string | The state or region of the customer’s billing address. |
billingInformation_address_zip | string | The ZIP/postal code of the customer’s billing address. |
billingInformation_address_country | string | The country of the customer’s billing address. |