Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ralphilius/askrift
Webhooks library for popular subscription services
https://github.com/ralphilius/askrift
Last synced: 2 days ago
JSON representation
Webhooks library for popular subscription services
- Host: GitHub
- URL: https://github.com/ralphilius/askrift
- Owner: ralphilius
- License: mit
- Created: 2021-09-10T15:49:09.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2023-12-15T05:18:43.000Z (11 months ago)
- Last Synced: 2024-04-20T19:37:28.429Z (7 months ago)
- Language: TypeScript
- Homepage:
- Size: 78.1 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
A small utilities library to make it easier to handle webhooks from popular subscription services
**Áskrift** means subscription in Icelandic
```bash
npm install @ralphilius/askrift # or yarn add @ralphilius/askrift
```### Use on your server
Example using Vercel/NextJS serverless function
```js
import Askrift from '@ralphilius/askrift'module.exports = (req, res) => {
const askrift = Askrift.initialize("paddle", req.body);
if(askrift.validRequest()){
if(askrift.validPayload()){
askrift.onSubscriptionCreated().then(subscription => {
// Handle subscription_created event
})
// Handle other events
} else {
// Invalid body, possibly leak of webhooks URL?
res.status(403).end();
}
} else {
res.status(400).end();
}
}```
### Supported Services
- Paddle
- Stripe (Coming soon)
- Gumroad (Coming soon)