Update 15-08-2018: Added more resources
Shopify today is one of the most growing platforms for building an e-commerce website. For a monthly subscription, they offer the essentials features for running an e-commerce business. They also offer an API and an app marketplace where merchants can pay for third-party apps that extend the functionality for their stores. As of the today, the marketplace isn’t saturated (like Apple’s app store) but the growth and the number of apps launched every week is pretty huge.
Now Shopify is built on top of Ruby and JavaScript afaik and those are the languages you’ll see more in their documentation and official SDKs. Although they have a nice RESTFull API, which you can use with whatever language you’re familiar with, it feels like if you’re coming from PHP land you’re out of luck. In this tutorial, I’ll help you get started with PHP and Shopify.
Why building a Shopify app in the first place?
First of all, building on top of another platform has its own pros and cons. You can leverage the platform user base growth and its marketing and discoveries channels, but you will always depend on the platform not kicking you out or making your app obsolete by integrating it as a core feature.
Now, you can make some side money with your app (or even turn it into a big biz), solve some real-world problem and interact with your users while doing it. You still need to make something people want, but you don’t have to worry too much about marketing since the platform helps you with discovery from the app listing directory.
Resources for PHP and Shopify
- API documentation
- PHP Shopify
- Use a modern framework (Symfony or laravel)
- ngrock: very useful when you’re doing local dev
- Building Shopify Apps with PHP
- The Ultimate Guide to Building a Shopify App with Laravel
oAuth
After creating your partner account and creating an app for the partners dashboard (more details)
Here is an example using Symfony. You need to configure two URLs in the Shopify Partner dashboard:
1 – index route: where you’ll create the auth request (locally you can use ngrock, make sure to use an https)
2 – redirect
Billing
Once authenticated, you should redirect the merchant to the billing screen authorization. The merchant needs to accept the billing charge and you have to use Shopify Recuring Application charge API.
Continuing from the other sample code, here is a rough example, once the merchant has been redirected to your auth_billing route.
First, we need to create the application charge and later on mark it as accepted when the merchant authorizes the application charge.
Things to be aware of
Customer support
Make sure to respond as fast as possible to customer support, be helpful and always come up with a solution or just be honest and tell your customer when you’ll figure it out.
Error Logging
Before launching, make sure to have an error logging and monitoring system in place for your app (if you’re using Symfony here is how it’s done). Log your user id with the exception, that way once you have an error you can fix it ASAP and email them once it’s done.
Marketing
Obviously, the app directory helps a lot with discovery but you also need solid sales copy on your listing page and you also need to actively market your app and treat it as a business. I’m still learning this, but I will share on this blog once I have learned more.
Consider a private beta before
This will help you build the right v1 for your audience and will make the focus on the right core features. Also, if you have people waiting for your v1 already this will motivate you to ship and launch to the app store with a solid app.
Conclusion
With the crazy growth on Shopify, its users being mostly businesses that are spending money on apps already, it’s a great opportunity to build on app and launch in their marketplace. And if you’re the most comfortable with PHP, you still can do it without having to learn a different programming language or a framework.