Search

Categories

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Send mail to the author(s) E-mail

# Friday, 30 September 2011
( HighRise | MadMimi | MailChimp | Recurly | SaaS | Shopify | VidPub )

 

  • Sell stuff
  • Manage customers (CRM)
  • Email notifications
  • Reporting

Shopify

hosted storefront.

30 days free.

theme for store

Order mgt, customer mgt

app – Chimpified… adds into mailchimp.

- create new app

- templates use liquid language.

image

this is a product page and is hosted at shopify

image

so is this cart page.

image

Writing Integration Code

give our app the ability to receive pings that shopify will send back eg json

default IIS locally.. port 80 to test.  hmm can’t debug.  use logger.

image

setting up shopify to call back ie have asked shopify to send json post whenever a new order is received.

then can then send test notification from shopify back to local server.

Don’t have orders table.. but use the json sent back by shopify as a guide.

Order Items the same

 

Testing

Just doing a live test against the port.


namespace VidPub.Tests.Functionals {
    [TestFixture]
    public class ShopifyTests {
        Orders _orders;
        OrderItems _items;
        public ShopifyTests() {
            _orders = new Orders();
            _items = new OrderItems();

        }
        string GetJson() {
            var jsonFile = @"C:\dev\VidPub\Source\VidPub.Web\App_Data\ShopifyPing.js";
            var result = "";
            using (var stream = new StreamReader(jsonFile)) {
                result = stream.ReadToEnd();
            }
            return result;
        }
        void Ping(string url, string data) {
            HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
            request.Method = "POST";
            request.ContentType = "application/json";

            //add the form data
            byte[] byteArray = Encoding.UTF8.GetBytes(data);
            request.ContentLength = byteArray.Length;

            using (var stream = request.GetRequestStream()) {
                // Write the data to the request stream.
                stream.Write(byteArray, 0, byteArray.Length);
            }

            var response = (HttpWebResponse)request.GetResponse();
            string result = "";

            using (Stream stream = response.GetResponseStream()) {
                StreamReader sr = new StreamReader(stream);
                result = sr.ReadToEnd();
                sr.Close();
            }
        }
        [SetUp]
        public void Init() {

            _items.Delete();
            _orders.Delete();
        }
        [Test]
        public void receiver_should_save_one_order() {
            var url = "http://localhost:50363/shopify/receiver";
            Ping(url, GetJson());
            Assert.AreEqual(1, _orders.All().Count());
        }
        [Test]
        public void receiver_should_save_two_order_items() {
            var url = "http://localhost:50363/shopify/receiver";
            Ping(url, GetJson());
            Assert.AreEqual(2, _items.All().Count());
        }
    }
}

asdf

        //need to have an action for Shopify pings
        public ActionResult Receiver() {
            //this is a ping from Shopify, record the order
            //var order = this.SqueezeJSON();

            //returns a string
            var json = this.ReadJson();
            var order = System.Web.Helpers.Json.Decode(json);

            Logger.LogInfo(order.order_number.ToString());

            //this is ugly
            //an anonymous object
            var newOrder = new {
                OrderNumber = order.order_number,
                ShopifyID = order.id,
                ShopifyName = order.name
                //lots more items to left right.
            };

            dynamic savedOrder = _orders.Insert(newOrder);

            //line items
            //need to put in the correct newOrder.ID
            foreach (var item in order.line_items) {
                var newItem = new {
                       OrderID = savedOrder.ID,
                       Name = item.Name
                       //etc..
                };
                _items.Insert(newItem);
            }

            return Content("OK");
        }

Shopify does it all for us, and sends back the data.

Membership and Billing

subscriptions?

Just run a credit charge once a month and quit whining!

  • retain users credit cards..ahhh!
  • the thing that runs charges.. tracks
  • a scheduler
  • dunning capability.. what happens when payments fail
  • upgrades and downgrades

hard to do right.

Chargify – expensive

Recurly – Recurring Billing

  • Simple monthly ($30pm)
  • Platinum which allows for downloads ($50pm)

image

1 time setup fee, trial periods

image

full blown checkout page. can dns with cname so people think are still on tekpub.

image

can also handle one-off charges

image

user has access to their own invoices.

MadMimi – Emailling

image

can edit the emails straight in madmimi

Rob has written a MadMimi wrapper which is on https://github.com/robconery/MadMimiMailer

Nice and async.

Welcome

Invoice

easily send in invoice# etc..

OpenID

number 1 support calls.

HighRise – CRM (37 signals)

whenever he sends an email out via madmimi, it is bcc’d to highrise

Can see all emails inside highrise

MailChimp – Build Emailling

True high powered email campaigns this is better.

Mailchimp to import from highrise

Can do big push promotional push.

 

HighRise API

Rob wrote a wrapper. 

Using XML for transport.

 

Hmm but would be nice to observe, or hook in, so that when a users details change it automagically updates CRM. 

So can use Massive hooks, inserted updated and deleted.  Overrides

HighRise – custom fields.

Review SaaS

help us now – yes

  • ecommerce (Shopify)
  • subscription billing (Recurly)
  • mailers (MadMimi and MailChimp)
  • templated mailing
  • mass mailing
  • CRM (HighRise)

1 year – absoltely..

CRM – sales guy has a CRM tool

Can enter productions, enter discount codes, do mailouts that look great

Data

Do I need to keep orders in own db… or trust shopify?  replication of data is bad.

Great to have these services, so he can focus on the core of the business which is creating videos.

| | #