@ko-fi/next
TypeScript icon, indicating that this package has built-in type declarations

1.0.2 • Public • Published

Ko-fi webhook handler for Next.js.

For more information visit https://ko-fi.com/manage/webhooks


Installation

npm

npm install @ko-fi/next

yarn

yarn add @ko-fi/next

Example

View example implementation here;

Create API Route, e.g pages/api/webhook.js

import { kofi } from '@ko-fi/next';

export default kofi(app, {
    onData: (data, req) => {
        console.log('onData called');
    },
    onCommission: (data, req) => {
        console.log('onCommission called');
    },
    onDonation: (data, req) => {
        console.log('onDonation called');
    },
    onShopOrder: (data, req) => {
        console.log('onShopOrder called');
    },
    onSubscription: (data, req) => {
        console.log('onSubscription called');
    },
    onError: (err, req) => {
        console.error('onError called');
    },
    verificationToken: 'token',
});

Readme

Keywords

Package Sidebar

Install

npm i @ko-fi/next

Weekly Downloads

0

Version

1.0.2

License

ISC

Unpacked Size

5.34 kB

Total Files

4

Last publish

Collaborators

  • oneso