shopify-lambdas

1.0.0 • Public • Published

Shopify Lambdas

You're in the right place if you're working on a Shopify app and have one of these requirements:

  1. 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.
  2. I want to transform Stamped Reviews into Yotpo Rewards
  3. and more?

Local development

Shopify development store: https://lambdas-development-store.myshopify.com/ (this can be accessed from within the SeaMonster Studios partner portal)

  1. 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.
  2. run yarn dev

Production Deployment

Running yarn deploy does 2 things:

  1. Deploys the lambdas in this project to serverless
  2. 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

  1. Access to create private apps w/in the Shopify store
  2. 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.

  1. From within the store, go to Apps > ReCharge > Integrations > API tokens > Create an API token
  2. Fill out the Details, provide neccessary permissions, click Save
  3. 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

  1. 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
  1. 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

Readme

Keywords

none

Package Sidebar

Install

npm i shopify-lambdas

Weekly Downloads

0

Version

1.0.0

License

none

Unpacked Size

71.2 kB

Total Files

31

Last publish

Collaborators

  • logandeancall