This is a demo app that showcases Shopify's Billing API. It's meant to be used by Shopify partners and developers to learn how to interact with the Billing API, and to discover new billing features.
Here's what you can do in this demo:
- Create one-time charges.
- Create recurring charges.
- Create usage-based charges.
You can install the demo from here
- Go to http://billing.shopifyapps.com/
- Type in your test store's domain (E.g. your-store.myshopify.com), then click "Install".
- Click on the type of charge you want to create.
- Fill in the fields, and submit the form.
Note: Creating a recurring charge for usage charges will delete a regular recurring application charge if you have one, and vice versa.
This is built using Ruby 2.1.6, Ruby on Rails, the Shopify App gem, and the Shopify API gem. You'll need a basic Ruby on Rails development environment, and a Shopify Partner account.
The Shopify admin requires all apps to use HTTPS. This can be awkward to configure when developing your app, so we recommend using a service that will tunnel HTTPS requests from a public URL into your app such as:
The setup instructions will assume that you're using ngrok.
Here are instructions to begin developing with this demo app.
-
Login to your Shopify Partner account.
-
Go to the Apps page in your Partner admin.
-
Create a new application by clicking "Create a new app" in the top-right corner. Use the following settings when filling in the fields:
- Embedded settings: Enabled
- Application URL: If you're running this demo app on your own computer, you probably want https://your-app.ngrok.io . Otherwise, it must be the full URL to your app.
- Redirection URL: If you're running this demo app on your own computer, you probably want https://your-app.ngrok.io/auth/shopify/callback . Otherwise, it must be your app's OAuth callback URL.
- Click on "Show secret", and keep this browser tab open. You'll need the API key and secret token later.
-
Clone this Git repository, then enter its directory.
-
Run the command
bin/setup
-
In the file
.env
, replace the example values with the details from your Partner application. -
Start the web server by running
bundle exec rails server
-
In a web browser, go to the Rails server. If you're running this demo app on your own computer, the URL will probably be https://your-app.ngrok.io
Copyright (c) 2012 "Shopify inc.". See LICENSE for details.