Skip to content

Webhooks library for popular subscription services

License

Notifications You must be signed in to change notification settings

ralphilius/askrift

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

A small utilities library to make it easier to handle webhooks from popular subscription services

Áskrift means subscription in Icelandic

npm install @ralphilius/askrift # or yarn add @ralphilius/askrift

Use on your server

Example using Vercel/NextJS serverless function

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)

About

Webhooks library for popular subscription services

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published