View Single Post
Old 05-22-2015, 11:24 PM
enot's Avatar
enot enot is offline
Join Date: Oct 2014
Posts: 499

Originally Posted by Jeff Palumbo1 View Post
Hi ECWID Team,

I recently posted about being able to sell a Digital Comic in both PDF format (link to download) and a Sync to a Digital Library. The PDF download link will be easy thanks to your walk-through! However, how about syncing to a Digital Library? Allow me to walk you through the process:

1. A customer would go to our store, find the issue he/she wants to purchase and add it to cart.
2. They checkout and make the purchase
3. Instead of an email coming with a link to download the PDF, we want to sync that content to their personal library on our servers so they can view it or download if they wish from our app. So, once they load their app, the titles/issues they have purchased show up there for reading.

How would I set that up? Please note, I still want to offer the PDF as an option but some people want it on their app instead.

Before you answer, thank you for the wonderful service so far. You really are making it easy to create a store.

Hello Jeff,

Thank you for your kind words and for detailed explanation!

Unfortunately, in this case it won't be as easy, but still possible.
Since we'll have to pass information to your app for syncing, something should work as a bridge between Ecwid and the app, so certain amount of custom programming will be involved to create this bridge (almost any of web-programming languages like PHP, Perl, Python, Ruby, etc. will do).

I can suggest the following approach:

Step 1: each product should get a copy, with different description (so a customer will know what he's getting) and without a file uploaded, so your customers don't get both .pdf and updated library for a single item (and so step 4 would be significantly easier).

Step 2: once a customer places an order, our Instant Order Notifications API can be utilised to send a callback bringing the script to life.
Also, it provides "Order ID" value, which we'll need in step 3. Here's info on our ION API:

Step 3: at this point we should check, if a particular newly-placed order contains any of the products that should require syncing with the library.
So, we could utilise Order API to call for a list of products purchased in the order with a particular order ID. Here's info on it:

At this point the Ecwid-related part is almost over, so I'm just making guesses at possible solution - you may as well make it work differently, and still get excellent results.

Step 4: If none of product ID's from the order match the ones from the list-of-product-ID's-that-should-be-synced (I believe such list will be needed too), script can stop working here.
In case some of them do -> step 5.

Step 5: This part is a mystery to me as unfortunately I'm not familiar with your app's API or principles of working, so I'll describe it in general.
But I believe that product ID's, acquired in step 3 and confirmed (as the ones that require syncing) in step 4, should be converted into something your app would understand, and sent to it.

Hope this helps!