Shopify App Development

From Shopify Wiki

Revision as of 06:55, 18 February 2012 by Wik (Talk | contribs)
Jump to: navigation, search

Contents

Get started learning how to build, promote, and sell Shopify apps.

Shopify apps increase sales, automate chores, and make customers happier by integrating Shopify stores with services like Twitter, Freshbooks, recommendation engines, or other kinds of new functionality.

By developing your app and publishing it in the Shopify App Store you make it easy for all 15 000+ of Shopify merchants to install and pay for your services on a monthly recurring basis.

Curious what to make? Merchants ask for all sorts of stuff that they're more than willing to pay for. Check out this wishlist on the wiki and this thread in the forums.

Want to stay on top of new developments? Follow @shopifyapi on Twitter.

What should I make?

Merchants ask for all sorts of stuff that they're more than willing to pay for. Check out the wishlist on the wiki for a curated list of features and services that you can write an app to deliver.

What is an app?

A Shopify app uses the Shopify API to access a shop’s data and automate almost any action you can take from their admin panel. For example, you could build an app that looks at all of a shop's orders and visualizes them on a map of the world using the Order API and Google Maps. Or you could make an instant sale app that changes a product's price for 3 hours, sends SMS messages to a lucky group of customers about the reduced prices, and automatically bump the prices back up after the 3 hours are over by using the Product and Product Variant APIs.

When a shop installs your app, all they’re really doing is giving your app permission to access their shop’s data via the API.

After the shop merchant agrees to giving your app permission to access their data, Shopify redirects the merchant to a URL you specify. After that, the rest is up to you.

In its most basic form, an app is just an API key that has permission to access certain shops' data. That's it – there’s no binary package being uploaded anywhere or special certification programs you need to jump through.

Both web and desktop apps can be easily made.

Development Lifecycle

It's easy to get up and running within a few minutes. Here's a high-level explanation of how to get from 0 to in the App Store.

  1. Create a partner account
  2. Create a test shop
  3. Play around with the API
  4. Create an app & install it
    1. Use a supported API adapter or roll your own authentication
    2. Read up on our tutorials, examples and documentation
  5. Set up billing
  6. Beta test with merchants & friends in the Shopify Forums
  7. Submit your app for publishing in the App Store
  8. Gear up your marketing/promo engines
  9. Launch & start taking money

Getting started

To start development, you need a Shopify Partner account. Sign up here and create a free account.

Once you’ve got an account set up, hit the App tab and create a test shop for yourself. Poke around your shop and familiarize yourself with your new store and what it can and can't do. Use this test shop later to test out your app.

Image:Create_a_test_shop.png

Note that you don’t need a paid Shopify account to do any of this.

Play around with the API

After you've got the hang of the Shopify admin, start playing with the Shopify API is to create a private app for your test shop. Visit this URL and create a private app:

https://YOUR-TEST-SHOP.myshopify.com/admin/api

Once you've created a private app, test out a few API calls. Try fetching your test shop's orders by visiting a URL like

http://API-KEY:PASSWORD@YOUR-TEST-SHOP.myshopify.com/admin/orders.xml

An example of what that URL could look like is http://7ea7a2ff231f9f7d4ee696837482e55f:95c5e8091839609c864128d2a8197b9a@iliketurtles.myshopify.com/admin/orders.xml

This private app is locked to your particular test shop and won't work for any other by skipping a few authentication steps.

Create an app & install it

Now that you've played around with the API, visit your Partner dashboard's App tab again and create an app. For now, set it to use a web redirect, and if you have a local development environment, set the Callback URL to be http://localhost:3000 or whereever you have a web server running that lets you watch its access logs.

Once you've got an API key and your app's shared secret, you're ready to install your app in your test shop.

Install your application in any shop (like your a test shop) by visiting the following URL:

http://YOUR-TEST-SHOP.myshopify.com/admin/api/auth?api_key=YOUR-APP-API-KEY

Once you've agreed to give the app access to your test shop, Shopify redirects to the Callback URL you've set for your app. If you've got this pointed to a running webserver, watch its access logs and you can see how Shopify appends a token and other useful things to the request URL. This is part of the authentication process.

Use a supported API adapter or roll your own authentication

If you're using Ruby or PHP, Shopify has supported adapters that make working with the API easier, along with handling authentication.

“I’m a Rails developer”

The easiest and fastest way to get up and running is by using the open source shopify_app generator gem and deploying to Heroku. Check out our tutorial covering how to do it all from scratch. You’ll be ready to sell your application on the App Store in minutes.

Rails Shopify App Examples

We’ve open-sourced PixelPrinter, one of our own apps in the App Store. Check it out in our GitHub account.

Debugging

Running into trouble debugging your app? See our tutorial on using the console in development.

“I’m a Ruby developer”

ShopifyAPI is a official lightweight gem for accessing the Shopify admin REST web services.

See also 3rd parties contributions:

  • omniauth-shopify is a strategy for authenticating to Shopify API using OmniAuth.

“I’m a PHP developer”

Grab a copy of Sandeep’s awesome PHP adapter for the Shopify API: https://github.com/sandeepshetty/shopify.php (requires PHP 5.3 and above)

Colin's PHP adapter for the Shopify API: https://github.com/cmcdonaldca/ohShopify.php It's based on Sandeep's version but is object-oriented and works with PHP 4 and above.

It’ll let you skip having to write all the authentication scheme stuff and jump in to playing with the API right away.

Prefer an adapter built on ZendFramework 2? Matt Peterson has put together his own PHP adapter that you can find on GitHub as well: http://github.com/mathewpeterson/PHP-Shopify-API

“I’m a Python developer”

A Python adapter also exists. Check out Using the shopify python api to understand how everything documented in the API Reference can be done using the Python adaptor.

To use it with the Django web framework, you can start with the Shopify Django App Example, or use it as a reference implementation. The instructions for the project include steps for deploying the application on Google App Engine, in fact you can see the example online. It can still be run as a regular Django application, so feel free to use other hosting options.

“I’m a Node developer”

A Node.js adapter using our new JSON API is on the way, but it isn't ready for prime-time just yet. We'll announce the release over on our Twitter account: @shopifyapi

Meanwhile you can grab adapters implemented by 3rd parties:

  • [1] by Nicholas
  • [2] by Yevgeniy

"I'm a Java/Android developer"

A Java adapter also exists. The library handles all the authentication and provides tools to make performing API calls in Java rather simple.

Check out the Products List Demo to get an idea of how to use this library.

“I want to roll my own authentication”

The authentication scheme for Shopify is really straightforward and well documented. Check it out in detail here: http://api.shopify.com/authentication.html

Set up billing

In order to be paid for your service, you need to set up a billing mechanism - just being in the app store does not guarantee payment.

We highly recommend using the Shopify Billing API as it lets merchants skip having to fork over a credit card number and simply adds your charges to their next Shopify invoice. When Shopify is paid, we pay you. Pretty straightforward. Take a look at the Application Billing page for more information.

The Billing API lets you set up recurring charges and/or one-time charges on a per-shop basis, so it's easy to create multiple price plans or tiers, or implement whatever billing model you have in mind.

Read up on a detailed explanation of the billing system here: http://api.shopify.com/billing.html

The two APIs you'll be particularly interested in are:

Your app is free to use other payment systems, but apps that use ours are preferred when it comes to promoting apps in newsletters, blogs, our Twitter account, and other promotions.

Beta test with merchants & friends in the Shopify Forums

When you feel like your app is ready and well tested, it's time to start beta testing.

Recruit willing participants into a beta by announcing your brand new app in the Shopify Forums, in particular the General and Apps categories.

Be kind to your beta program participants and set your billing charges to be test=true so that they're not actually charged.

Let your beta program participants install the app by giving them this URL:

http://YOUR-TEST-SHOP.myshopify.com/admin/api/auth?api_key=YOUR-APP-API-KEY

Once you've worked out all the showstopper bugs and your beta users are happy with the user experience, get ready to submit your app to the App Store.

Submit your app for publishing in the App Store

All right! You've come a long way and your app is looking hot to trot.

Prepare for publishing your app in the App Store by running through our list of Do's and Don'ts of publishing your app

Double checking this list will expedite your app's approval through the publishing process. It really boils down to:

  1. No bugs
  2. Each screen tells an obvious story that relates to how the shop is going to increase sales or reduce costs: “this is what’s happening”; “you need to do this”
  3. Any onboarding/account creation process is as automatic as possible. Use the shop.xml call to grab the information you need
  4. Your app store listing says what the app is and accurately states how much it costs

Again: make sure your app works before submitting it. As soon as the app approval team hits a bug, we have to stop and tell you about it before continuing.

Gear up your marketing/promo engines

Make sure to give apps@shopify.com a shout to let us know that your app is arriving so we can give a shout out to the right channels. We'll help announce your app over @Shopify's Twitter stream, and if it's a good fit, we'll set up a blog post.

Launch & start taking money

Go big with your launch! Make sure you're advertising and posting where merchants are going to notice you. Email each of your installers and ask them what they think - especially those folks who uninstalled the app.

No matter what, make sure you register an app/uninstall webhook to be pinged when this happens. Build a list of those merchants who uninstalled over a week, and reach out to them to find out where your app fell short.

You should also be getting the merchants who have your app installed after 25 days (or whatever makes sense for you) to give your app a review on the app store. Reviews are killer for increasing your install rate. Read more about how to do this in How to get 4 to 5 Stars on the Apple App Store