# @particular./sync-stripe-to-moltin

> Please contact Particular. via info@uniquelyparticular.com for any questions

Latest version **1.1.4** (published 2019-05-29) · MIT license · 0 weekly downloads

## Install

```sh
npm install @particular./sync-stripe-to-moltin
pnpm add @particular./sync-stripe-to-moltin
yarn add @particular./sync-stripe-to-moltin
bun add @particular./sync-stripe-to-moltin
```

## Health

**Score 30/100 (F)** — status: abandoned.

Positive: no vulnerabilities; high maintenance score.

Warnings: low downloads; no types; no esm support.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 1.1.4 |
| Published | 2019-05-29 |
| First published | 2019-03-19 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 4 |
| Unpacked size | 287.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Adam Grohs |
| Maintainers | agrohs |
| Keywords | stripe, moltin, webhooks, microservices, payment, ecommerce, integration, particular, particular. |

## Links

- npm: https://www.npmjs.com/package/@particular./sync-stripe-to-moltin
- Repository: https://github.com/uniquelyparticular/sync-stripe-to-moltin
- Homepage: https://github.com/uniquelyparticular/sync-stripe-to-moltin#readme
- Issues: https://github.com/uniquelyparticular/sync-stripe-to-moltin/issues
- npm.io page: https://npm.io/package/@particular./sync-stripe-to-moltin

## Dependencies (4)

- [micro](https://npm.io/package/micro.md) 9.3.4
- [stripe](https://npm.io/package/stripe.md) 7.1.0
- [micro-cors](https://npm.io/package/micro-cors.md) 0.1.1
- [@moltin/sdk](https://npm.io/package/@moltin/sdk.md) 3.21.0

## Alternatives

- [jsforce](https://npm.io/package/jsforce.md) — 851.2K weekly downloads
- [react-native-qrcode-svg](https://npm.io/package/react-native-qrcode-svg.md) — 693.5K weekly downloads
- [@salesforce/plugin-data](https://npm.io/package/@salesforce/plugin-data.md) — 394.9K weekly downloads
- [@backstage/plugin-search-common](https://npm.io/package/@backstage/plugin-search-common.md) — 308.5K weekly downloads
- [@chain-registry/types](https://npm.io/package/@chain-registry/types.md) — 38.4K weekly downloads

## Recent versions

- 1.1.4 (latest) — 2019-05-29
- 1.1.3 — 2019-05-27
- 1.1.2 — 2019-05-15
- 1.1.1 — 2019-04-15
- 1.1.0 — 2019-04-13
- 1.0.0 — 2019-03-19

## README

# @particular./sync-stripe-to-moltin

[![npm version](https://img.shields.io/npm/v/@particular./sync-stripe-to-moltin.svg)](https://www.npmjs.com/package/@particular./sync-stripe-to-moltin) [![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release) [![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg)](https://github.com/prettier/prettier) [![CircleCI](https://img.shields.io/circleci/project/github/uniquelyparticular/sync-stripe-to-moltin.svg?label=circleci)](https://circleci.com/gh/uniquelyparticular/sync-stripe-to-moltin)

> Update Moltin order payment status when refunded in Stripe

Asynchronous microservice that is triggered by [Stripe](https://stripe.com) webhooks to update Order data inside of [moltin](https://moltin.com).

Built with [Micro](https://github.com/zeit/micro)! 🤩

## 🛠 Setup

Both a [moltin](https://moltin.com) _and_ [Stripe](https://stripe.com) account are needed for this to function.

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

```dosini
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](https://dashboard.moltin.com)'s API keys.

Find your `STRIPE_WEBHOOK_SECRET` inside of your deployed endpoint within Stripe's [Webhook Settings](https://dashboard.stripe.com/account/webhooks) area.

Find your `STRIPE_SECRET_KEY` within Stripe's [API Settings](https://dashboard.stripe.com/account/apikeys).

## 📦 Package

Run the following command to build the app

```bash
yarn install
```

Start the development server

```bash
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)

```bash
ngrok http 3000
```

Make a note of the https `ngrok URL` provided.

## ⛽️ Usage

Next head over to the Stripe [Webhook Settings](https://dashboard.stripe.com/account/webhooks) area, add a new webhook with the following details:

| URL to be called    | Webhook version        | Filter event                               |
| ------------------- | ---------------------- | ------------------------------------------ |
| _`ngrok URL` above_ | `2018-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](https://now.sh).

_Contact [Adam Grohs](https://www.linkedin.com/in/adamgrohs/) @ [Particular.](https://uniquelyparticular.com) for any questions._

---
_Source: https://npm.io/package/@particular./sync-stripe-to-moltin · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
