Introduction
The Feed Meta object for the Stripe Add-On is an associative array containing the properties which determine what type of transaction should occur and what values are sent to Stripe.
$feed['meta'] = array(
'feedName' => 'Your Feed Name',
'transactionType' => 'product',
'paymentAmount' => 'form_total',
'receipt_field' => '3',
'feed_condition_conditional_logic' => true,
'feed_condition_conditional_logic_object' => array(
'conditionalLogic' => array(),
),
);
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
- feedName string
The feed name which appears on the add-ons feeds tab.
-
transactionType string
The type of transaction which should occur when the feed is processed. Possible values: product or subscription.
-
metaData array
An indexed array of custom meta information. Stripe allows a maximum of 20 custom keys to be sent. Each custom meta array contains the following properties.
array(
'key' => 'gf_custom',
'value' => '1.3',
'custom_key' => 'product_quantity',
);
- key string
Value should be gf_custom. Instructs the dynamic_field_map setting to use the custom_key input.
- value string
The ID of the field containing the value to be sent for the specified custom_key. The mapped data will be truncated to 500 characters per requirements by Stripe. - custom_key string
The custom key you want to use when sending the custom metadata to Stripe. Must be 40 characters or less.
- feed_condition_conditional_logic boolean
Is the feed condition (conditional logic) setting enabled. Default is false. - feed_condition_conditional_logic_object array
An associative array containing the conditional logic rules. See the Conditional Logic Object for more details.
Product Transaction Properties
The following properties are only applicable when the transactionType is set to product.
- paymentAmount string
What to use for the payment amount. Possible values: form_total or a product field ID.
receipt_field stringThe ID of the field containing the email Stripe should use when sending their receipt.
Subscription Transaction Properties
The following properties are only applicable when the transactionType is set to subscription.
- recurringAmount string
What to use for the recurring amount. Possible values: form_total or a product field ID
billingCycle_length integerHow often should the recurring payment occur. Maximum values: 1 year or 12 weeks or 12 months.
billingCycle_unit stringHow often should the recurring payment occur. Possible values: week, month or year.
setupFee_enabled booleanShould a setup fee be charged? Default is false.
setupFee_product stringThe ID of the product field containing the amount the user should be charged for the setup fee.
trial_enabled booleanShould the recurring charge occur immediately or after a trial period? Default false.
trialPeriod integerThe number of days the trial period should last.
customerInformation_email stringThe ID of the field containing the customer email.
customerInformation_description stringThe ID of the field containing the customer description.