Simple Goods + Zapier & MySQL
This is a guest post by Michael Herman, co-founder of Real Python.
Simple Goods is on a mission to change how buyers pay for goods. Their services allow a seller to sell anything, anywhere, without a shopping cart. On the other side of the equation, a buyer does not have to deal with entering unnecessary info in order to buy a product. As an avid user of Simple Goods from the selling end, Zapier’s powerful integrations provide the added support I need to fully track customers and sales from beginning to end.
Note: you can also check out the video version of this post on YouTube.
Although Simple Goods does not have a public API yet, they do support webhooks (instant payment notifications) which currently are available with the Grow plan.
After each successful transaction, a notification is sent, providing the following data via a JSON payload:
Let’s look at how to integrate Simple Goods and Zapier to POST new data to MySQL every time a new transaction occurs from Simple Goods.
Create a new Zap to integrate a webhook with MySQL:
Once you click Continue, you will be presented with the webhook URL. Copy this URL.
Next login to your Simple Goods account and go to Settings. Then paste your Zapier webhook URL into the Webhook URL input. Save your changes.
Note: Webhooks / Instant Payment Notifications require a subscription to the Grow plan.
Back on Zapier, setup your MySQL database and select a table. Make sure your table is already created before you select the database. If you wanted to capture the buyerEmail, purchaseDate, price, total, and productName fields, your CREATE TABLE statement would look like this:
Now select both the database you wish to use as well as the table.
Before you can map the keys from the JSON payload to the fields in the table, you need to push a sale through so that Zapier can see the data it has to work with. I would suggest using the 'Send Test' button next the Webhook URL field.
After you push a sale through, you can map the keys to the fields:
Finally, enable the zap to make it live. Then push through another dummy transaction from Simple Goods to ensure that the integration works:
Boom! Now you can easily track sales. I use this very integration to manage user registration and authentication.
This is just one integration. There’s so many more services that Zapier is connected with that you could use with Simple Goods such as Salesforce, Google Spreadsheets, MailChimp, and so forth. Be sure to share any integrations you come up with in the comments below. Cheers!