Square Feed Meta

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

PropertyTypeDescription
feedNamestringA unique name for the feed.
transactionTypestringThe type of transaction: ‘product’ or ‘subscription’.
paymentAmountstringSpecifies the amount to charge for the transaction.
authorizeOnlybooleanIndicates whether to authorize the payment only (true) or capture it immediately (false).
billingCycle_lengthstringSpecifies the length of the billing cycle for subscriptions.
billingCycle_unitstringSpecifies the unit of time for the billing cycle: ‘week’, ‘month’, or ‘year’.
recurringTimesstringThe number of billing cycles for a subscription (or leave empty for ongoing).
setupFee_enabledbooleanEnables a one-time setup fee for subscriptions.
setupFeestringSpecifies the setup fee amount.
feed_condition_conditional_logicbooleanEnables conditional logic to determine if the feed should run.
feed_condition_conditional_logic_objectarrayStores the conditional logic rules, including the field ID, operator, and value.
subscription_namestringA custom name for the subscription.
billingInformation_emailstringThe customer’s email address.
billingInformation_first_namestringThe customer’s first name.
billingInformation_last_namestringThe customer’s last name.
billingInformation_address_line1stringThe first line of the customer’s billing address.
billingInformation_address_line2stringThe second line of the customer’s billing address (optional).
billingInformation_address_citystringThe city of the customer’s billing address.
billingInformation_address_statestringThe state or region of the customer’s billing address.
billingInformation_address_zipstringThe ZIP/postal code of the customer’s billing address.
billingInformation_address_countrystringThe country of the customer’s billing address.