Shopify Lambdas
You're in the right place if you're working on a Shopify app and have one of these requirements:
- I need to tag Shopify customers based on webhook events from Recharge. For example, tagging customers as members if they purchase a subscription product managed by recharge.
- I want to transform Stamped Reviews into Yotpo Rewards
- and more?
Local development
Shopify development store: https://lambdas-development-store.myshopify.com/ (this can be accessed from within the SeaMonster Studios partner portal)
- run
yarn dev:ngrok
in one terminal session. This allows recharge webhooks to hit our localhost lambdas for quick testing based on what actions we take in the https://lambdas-development-store.myshopify.com development store. - run
yarn dev
Production Deployment
Running yarn deploy
does 2 things:
- Deploys the lambdas in this project to serverless
- Creates webhooks with Recharge for all shops that have defined webhooks. See
Shops.res
for examples. Note that webhook creation is idempotent based on the webhook type and endpoint, so it is safe to deploy webhooks multiple times without producing duplicates on recharge.
Adding a new store
What you need before getting started
- Access to create private apps w/in the Shopify store
- Request access to Recharge to enable API Integrations. Email them at
partnersupport@rechargepayments.com
with the request and the store URL
Get ReCharge API Token
Only needed for stores using ReCharge related lambdas.
- From within the store, go to Apps > ReCharge > Integrations > API tokens > Create an API token
- Fill out the Details, provide neccessary permissions, click Save
- After saving you will be redirected back to the API tokens screen, there you will see your new API key
Permissions needed from Shopify Private App & Recharge API Token for each Lambda
- rcSubNewAddCustTag, rcSubNewAddSequentialCustTags, giveCustomerCouponFromFile
- Recharge Permissions
- Customers | Read/Write
- Subscriptions | Read
- Products | Read
- rcSubCancelRemoveCustTag, rcSubCancelSequentialRemoveCustTags
- Recharge Permissions
- Customers | Read/Write
- Subscriptions | Read
- Products | Read
Recharge API Docs
You will can access the recharge docs here, https://developer.rechargepayments.com. (password: abc123).
Removing Recharge Webhook
- First list the hooks (https://developer.rechargepayments.com/#list-webhooks). This will include id's on each object that you'll use in the next step
curl -i -H 'X-Recharge-Access-Token: <RECHARGE_API_KEY>' \
-X GET https://api.rechargeapps.com/webhooks
- Delete the hook (https://developer.rechargepayments.com/#delete-webhook)
curl -i -H 'X-Recharge-Access-Token: <RECHARGE_API_KEY>' \
-X DELETE https://api.rechargeapps.com/webhooks/<SUBSCRIPTION_ID>
a