The Subscription XML Datafeed
The subscription datafeed does not send you a list of your subscriptions. Please see the import notes below as to what is contained in the subscription datafeed. If you want to be notified every time a subscription runs, please use the regular transaction datafeed.
The FoxyCart subscription XML datafeed runs once a day, and sends data to the same location configured for your regular data feed. It contains:
- transaction information for subscriptions that are either past due,
- subscriptions that were canceled (on the day of the datafeed),
- subscriptions that have a subscription end date set, and
- customer information for customers whose payment methods are about to expire.
The transaction details included in the XML are obtained from the last successful transaction. This is not the datafeed that tracks new or recurring subscription transactions that process normally. That data is sent as the transactions occur in the transaction XML datafeed.
The subscription datafeed will not send if it's empty. So if none of the criteria above are met, the datafeed won't send that day.
A few things worth noting:
- The subscription XML datafeed comes with a
POST
name
ofFoxySubscriptionData
. This is different than the transaction XML datafeed, which has aPOST
name
ofFoxyData
. - The subscription XML datafeeds are set to run once a day, about 19:00 GMT (12:00 noon PST). The exact time you receive your subscription XML datafeed depends on a variety of factors, but if you want to request it to be sent on-demand you can do so with the API.
- Subscriptions themselves are set to run about 12:00 noon GMT (05:00 PST). As with the subscription XML datafeed, the exact time depends on a variety of factors including store version.
- Customers will be included in the
payment_methods_soon_to_expire
node if their credit card expiration month is the current month, or the next month. So if the expiration month is 05, the customer will be included if the current month is 04 or 05. - If your endpoint returns any HTTP status code other than a
200
, it will be logged in your store's error log.
For a working example script for how you can use this feed, check the integrations page for a Subscription Datafeed integration example.
Example Subscription XML Datafeed
For reference, the date that this datafeed would have been sent is 2009-03-04, which means that the first subscription listed is one that has been set to cancel that day.
<?xml version='1.0' encoding='UTF-8' standalone='yes'?> <foxysubscriptiondata> <subscriptions> <subscription> <subscription_id>200</subscription_id> <next_transaction_date>2009-03-24</next_transaction_date> <end_date>2009-03-04</end_date> <past_due_amount>0.00</past_due_amount> <frequency>1m</frequency> <error_message></error_message> <sub_token_url>https://example.foxycart.com/cart?sub_token=9c7ac0cadc73f93e126b6d97893cad3f</sub_token_url> <first_failed_transaction_date></first_failed_transaction_date> <store_id>1</store_id> <customer_id>44</customer_id> <transaction_id>2397</transaction_id> <transaction_date>2009-02-24 23:00:33</transaction_date> <order_total>10.00</order_total> <customer_first_name>John</customer_first_name> <customer_last_name>Doe</customer_last_name> <customer_address1>1234 Any Street</customer_address1> <customer_address2></customer_address2> <customer_city>Any City</customer_city> <customer_state>TN</customer_state> <customer_postal_code>12345</customer_postal_code> <customer_country>US</customer_country> <customer_phone></customer_phone> <customer_email>email@example.com</customer_email> <customer_ip>123.123.123.123</customer_ip> <receipt_url>https://example.foxycart.com/receipt?id=fe376559e8f76a2fafa8c707c73cda2a</receipt_url> <transaction_details> <transaction_detail> <product_name>monthly subscription</product_name> <product_price>10.00</product_price> <product_quantity>1</product_quantity> <product_weight>0.000</product_weight> <product_code></product_code> <category_description>Default for all products</category_description> <category_code>DEFAULT</category_code> <product_delivery_type>notshipped</product_delivery_type> <product_options> </product_options> </transaction_detail> </transaction_details> </subscription> <subscription> <subscription_id>196</subscription_id> <next_transaction_date>2009-03-25</next_transaction_date> <end_date>0000-00-00</end_date> <past_due_amount>50.00</past_due_amount> <frequency>1m</frequency> <error_message>Error: There was an error processing your payment: Credit card number is required. (Response Reason Code: 33)</error_message> <sub_token_url>https://example.foxycart.com/cart?sub_token=3076ca2af366d8a2647b60484a9fbefc</sub_token_url> <first_failed_transaction_date>2009-03-24</first_failed_transaction_date> <store_id>1</store_id> <customer_id>60</customer_id> <transaction_id>2380</transaction_id> <transaction_date>2009-02-24 21:06:31</transaction_date> <order_total>25.00</order_total> <customer_first_name>Test</customer_first_name> <customer_last_name>Test</customer_last_name> <customer_address1>12345 any city</customer_address1> <customer_address2></customer_address2> <customer_city>Any City</customer_city> <customer_state>TN</customer_state> <customer_postal_code>12345</customer_postal_code> <customer_country>US</customer_country> <customer_phone></customer_phone> <customer_email>email2@example.com</customer_email> <customer_ip>123.123.123.123</customer_ip> <receipt_url>https://example.foxycart.com/receipt?id=962aafde40dbc187abbd420e13548529</receipt_url> <transaction_details> <transaction_detail> <product_name>monthly product</product_name> <product_price>25.00</product_price> <product_quantity>1</product_quantity> <product_weight>0.000</product_weight> <product_code>610</product_code> <category_description>Default for all products</category_description> <category_code>DEFAULT</category_code> <product_delivery_type>notshipped</product_delivery_type> <product_options> </product_options> </transaction_detail> </transaction_details> </subscription> </subscriptions> <payment_methods_soon_to_expire> <customer> <customer_id>4</customer_id> <customer_first_name>Test</customer_first_name> <customer_last_name>Test</customer_last_name> <customer_email>test.test@example.com</customer_email> <cc_exp_month>02</cc_exp_month> <cc_exp_year>2009</cc_exp_year> </customer> <customer> <customer_id>10</customer_id> <customer_first_name>Test2</customer_first_name> <customer_last_name>Test2</customer_last_name> <customer_email>test2.test2@example.com</customer_email> <cc_exp_month>02</cc_exp_month> <cc_exp_year>2009</cc_exp_year> </customer> </payment_methods_soon_to_expire> </foxysubscriptiondata>