The Foxy forums are on the move!

We're in the process of moving our forums over to a new system, and so these forums are now read-only.
If you have a question about your store in the meantime, please don't hesitate to reach out to us via email.

Needing help/direction in understanding how to send out emails to subscribers for various scenarios

We've got a Foxycart project we're working on that requires send out email notifications for the following scenarios:

* Credit Card expiration notice: your card is about to expire
* Your Subscription End-Date is Approaching -- Please Re-Subscribe (non-recurring billing subscribers):
* Your Subscription Has Ended - Thank You for Being a Subscriber
** 1) If a credit card expires and the subscription end-date is reached
** 2) If subscribers do not re-subscribe and the subscription end-date is reached (non-recurring billing subscribers)
* Your Password Has Been Changed

The client mentioned they contacted support for support and got this response:
As for notices for subscriptions and credit cards that are about to expire, there is currently no native way to send these messages to customers. But you can receive notices (even for cancellations) by using the subscription XML datafeed. For this to be effective, you would need to add some custom server-side code on your end that would act as mailers, etc. You can automate it on your end to send out a notice to subscribers whenever you receive the subscription datafeed for their specific subscriptions.

https://wiki.foxycart.com/integration/subscription_datafeed
Apart from the information provided above, do you have any further guidance? We assumed this functionality does not exist in the Foxyshop plugin we're using on the client's WP site so we tried to run a CRON job to pull this data using the Foxycart subscription xml datafeed.

What we did yesterday was to pull all the active subscriptions but the problem is that the results are paginated (meaning all the data is not dumped at one time but in segments), so we still need to figure out how to grab all other subscription's information.

We can check the end date and send out "Your Subscription End-Date is Approaching" as well as "Your Subscription Has Ended - Thank You for Being a Subscriber". The challenge though is that in order to do a credit card check, the credit card nor customer info is included therefore we need to reconnect to fc to get the info. On 1k results, for example, we will have to connect to foxycart for every single record to grab customer details and then check the cc expiration which will probably result in a time out or error.

We just need to figure out if there any other effective ways to grab all subscriptions with custom details.

Thanks!
Tagged:
Comments
  • fc_adamfc_adam FoxyCart Team
    @flinx777,

    For expiring credit cards - we would definitely recommend the subscription datafeed as noted in that quote. Where as the transaction datafeed is sent after each successful transaction, the subscription datafeed is sent each day as required - and includes information on any customers that have soon to expire payment information, as well as subscriptions that are past due, were cancelled on that day, or have an end date set that is approaching.

    Using that endpoint will allow you to receive that information for the subscriptions that it apply to - rather than you having to paginate through all the results of your store subscriptions, and then sending off a secondary request to get the details of each subscription.

    Does that help clarify things?
  • @fc_adam

    Thanks for the follow up. We have some questions to get a little more clarification:

    * Where is the transaction datafeed sent after each successful transaction?
    * Is that the same url datafeed endpoint set in the store admin?
    * Is the subscription datafeed sent each day? Are they looping through all records? When is fc specifically running the datafeed again on an existing transaction record...when the cc expired or the sub has ended?

    And to confirm you mentioned that on this datafeed the xml result includes information on any customers that has:

    * cc information that is about to expire
    * as well as subscriptions that are past due
    * were cancelled on that day
    * or has an end date set that is approaching?

    is that the same xml datafeed result from normal purchase/subscription transaction?
  • fc_adamfc_adam FoxyCart Team
    @flinx777,

    Sure thing.
    * Where is the transaction datafeed sent after each successful transaction?
    * Is that the same url datafeed endpoint set in the store admin?
    The transaction datafeed and the subscription datafeed are both sent to the same endpoint, which is the one set in the advanced settings of your FoxyCart store. They're contained within differently named XML nodes, FoxyData for the transaction datafeed and FoxySubscriptionData for the subscription datafeed.
    * Is the subscription datafeed sent each day? Are they looping through all records? When is fc specifically running the datafeed again on an existing transaction record...when the cc expired or the sub has ended?
    The subscription datafeed is sent each day when it has information to communicate. If you have no subs that are ending or past due, and no customers have expiring card details, it's not sent that day. It will check against all subscriptions in your store.
    is that the same xml datafeed result from normal purchase/subscription transaction?
    The content of the transaction datafeed is different than the contents of the subscription datafeed. You can see what the transaction datafeed looks like here, and the subscription datafeed here.

    The transaction datafeed is sent once per successful transaction (unless you manually refeed it through the admin or via the API), and contains information just about that individual transaction. A transaction could be a one-off purchase or a subscription renewal.

    The subscription datafeed is sent once per day and is not tied to any single transaction or customer. It's an overview of subscriptions of note for your store. To get further information about each subscription or customer it mentions, you'd need to perform an API request to fetch that information.
  • Hey fc_adam,

    Thanks for the response. We took the information you provided and began creating our own custom code. We do have a few questions:

    You mentioned that foxycart is using the same datafeed endpoint for every transaction and for every event happening on past transactions. However for past transactions we don't know the condition foxycart is using to rerun the datafeed for certain transaction like the following:

    1. Cc is about to expire
    2. Subscription is about to end
    3. Subscription has ended

    So for our own custom code, which I tested by manually running a script which has a static feed.xml, I added conditions like
    1. CC is about to expire
    - I grabbed the year and month and checked if it's less than a month from expiration to current month, then send email.
    2. Subscription is about to end
    - Im checking this 1 week prior to subscription end date, so if subscription is about to end within this week, datafeed will meet this condition for every time fc reruns the datafeed over a week until the subscription has ended.
    3. Subscription has ended
    - I added a condition on the same datafeed, that if subscription end date is less than or equal to current date, then send notification email.

    Those are the conditions that I came up with, which is working by manual testing. So What I need to know what are the conditions FC set to these scenarios so we can act on them accordingly.
  • fc_adamfc_adam FoxyCart Team
    @flinx777,

    The subscription datafeed includes two main nodes - the subscriptions node and the payment_methods_soon_to_expire node.

    The subscriptions node can include three different types of subscriptions. Subs that are past due (which you can tell as they will have a positive past due amount), subscriptions that have an end date set (where the end date does not equal "0000-00-00", and subscriptions that have ended today (where the end date is equal to todays date).

    For soon to expire credit cards, they're included in the payment_methods_soon_to_expire node and are payment methods that are set to expire within the next month.

    Just to clarify, the subscription datafeed doesn't have the same structure as the normal transaction datafeed. You can see what the sub datafeed looks like here: http://wiki.foxycart.com/static/redirect/subscription_datafeed
Sign In or Register to comment.