How to gather active sub_tokens for customers?

Hey guys,

Earlier this year, we built some custom code that checked the Foxy API for "active" subscriptions for a customer, so we could tag our currently subscribed customers in our email marketing platform. (See discussion here.)

Now, we want to gather all active sub_token_url's for a customer.

But our sub_token_url is modified by our SSO auto-login setup. So instead of the regular sub_token_url which looks like this:
https://secure.botanicalcraft.com/cart?sub_token=c51e5e0135f72dbc97c9144ee6a9e70674471eceb3f241107fc6006666f94d2a
... we've modified it so customers can automatically login, so now it looks like this:
https://scripts.botanicalcraft.com/fc/foxycart-sso-endpoint.php?foxy_sub_token=c51e5e0135f72dbc97c9144ee6a9e70674471eceb3f241107fc6006666f94d2a

Questions:

1) To gather all the active sub_tokens for a customer, would we be filtering subscriptions in the Foxy API based on the customer (id ?) and grabbing all sub_token_url's for active subscriptions? (Can we get the sub_token alone from the Foxy API ?)

2) And then for our custom SSO auto-login URL, I assume we can just transform the sub_token by prepending it with https://scripts.botanicalcraft.com/fc/foxycart-sso-endpoint.php?foxy_sub_token= ?

Thanks in advance.
Comments
  • fc_adamfc_adam FoxyCart Team
    @Epotratz,

    That's exactly right. You'd loop through the returned subscriptions from the API to get the sub_token attribute for each one, and then you can modify it within your script to be formatted however you need.
Sign In or Register to comment.