https://github.com/discue/paddle-integration-mongodb
Paddle payments integration for mongodb database
https://github.com/discue/paddle-integration-mongodb
discue mongodb paddle payments saas
Last synced: 24 days ago
JSON representation
Paddle payments integration for mongodb database
- Host: GitHub
- URL: https://github.com/discue/paddle-integration-mongodb
- Owner: discue
- License: mit
- Created: 2023-05-27T18:17:00.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2025-06-01T14:07:33.000Z (about 1 month ago)
- Last Synced: 2025-06-01T23:18:17.053Z (about 1 month ago)
- Topics: discue, mongodb, paddle, payments, saas
- Language: JavaScript
- Homepage:
- Size: 4.1 MB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://github.com/discue/paddle-integration-mongodb/releases/)
[](https://www.npmjs.com/package/@discue/paddle-integration-mongodb)
[](https://www.npmjs.com/package/@discue/paddle-integration-mongodb)
[](https://www.npmjs.com/package/@discue/paddle-integration-mongodb)
[](https://www.npmjs.com/package/@discue/paddle-integration-mongodb)
[](/CONTRIBUTING.md "Go to contributions doc")
[](https://nodejs.org "Go to Node.js homepage")# paddle-integration-mongodb
[paddle.com](https://www.paddle.com/) payments integration for [MongoDB](https://www.mongodb.com/).
This module provides
- a body parser function
- a middleware function to receive and store [Paddle Webhooks](https://developer.paddle.com/getting-started/ef9af9f700849-working-with-paddle-webhooks)
- access to the Paddle API.It does **not**
- validate webhook content. Use and register [paddle-webhook-validator](https://github.com/discue/paddle-webhook-validator) in your application to validate webhooks before storing them.## Installation
```bash
npm install @discue/paddle-integration-mongodb
```## Components
- Webhooks Body Parser
- Webhooks Middleware
- Subscription Info
- Subscription Hydration
- Subscriptions API### Preparing a New Subscription
For the webhooks integration to work and to be able to correlate incoming hooks with the correct subscription, a placeholder needs to be created **before the checkout** and - afterward - a specific value must be passed to the [Checkout API](https://developer.paddle.com/guides/ZG9jOjI1MzU0MDQz-pass-parameters-to-the-checkout) via the `passthrough` parameter. This value will be returned by the `addSubscriptionPlaceholder` method.```js
import { SubscriptionHooks, subscriptionStorage } from '@discue/paddle-integration-mongodb'
import client from './my-mongodb-client.js' // <-- to be provided by your applicationconst storage = subscriptionStorage({ client })
const subscriptions = new SubscriptionHooks({ storage })module.exports = async (req, res, next) => {
// requires application to read api_client information
// based on incoming information like a JWT or a cookie
const { id } = readApiClient(req)// create subscription placeholder
const { passthrough } = await subscriptions.addSubscriptionPlaceholder([id])
// return the passthrough to the frontend app
res.status(200).send(JSON.stringify({ passthrough }))
}
```## Run E2E Tests
To run tests, run the following command
```bash
./test-e2e.sh
```## License
[MIT](https://choosealicense.com/licenses/mit/)