1.1.4 ā€¢ Published 5 years ago

@particular./sync-stripe-to-moltin v1.1.4

Weekly downloads
-
License
MIT
Repository
github
Last release
5 years ago

@particular./sync-stripe-to-moltin

npm version semantic-release code style: prettier CircleCI

Update Moltin order payment status when refunded in Stripe

Asynchronous microservice that is triggered by Stripe webhooks to update Order data inside of moltin.

Built with Micro! šŸ¤©

šŸ›  Setup

Both a moltin and Stripe account are needed for this to function.

Create a .env at the project root with the following credentials:

MOLTIN_CLIENT_ID=
MOLTIN_CLIENT_SECRET=
STRIPE_SECRET_KEY=
STRIPE_WEBHOOK_SECRET=

Find your MOLTIN_CLIENT_ID and MOLTIN_CLIENT_SECRET inside of your moltin Dashboard's API keys.

Find your STRIPE_WEBHOOK_SECRET inside of your deployed endpoint within Stripe's Webhook Settings area.

Find your STRIPE_SECRET_KEY within Stripe's API Settings.

šŸ“¦ Package

Run the following command to build the app

yarn install

Start the development server

yarn dev

The server will typically start on PORT 3000, if not, make a note for the next step.

Start ngrok (change ngrok port below from 3000 if yarn dev deployed locally on different port above)

ngrok http 3000

Make a note of the https ngrok URL provided.

ā›½ļø Usage

Next head over to the Stripe Webhook Settings area, add a new webhook with the following details:

URL to be calledWebhook versionFilter event
ngrok URL above2018-05-21 (Default)'Select types to send' > charge.refunded

āš ļø Each time a charge is refunded this function will be called, but it will only call moltin to update order if 'fully refunded' in Stripe (TODO: if Moltin add support for order.payment = partial_refund then can update to handle).

šŸš€ Deploy

You can easily deploy this function to now.

Contact Adam Grohs @ Particular. for any questions.