npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

paykickstart-validator

v1.0.1

Published

A package that validates incoming IPN notifications from PayKickstart

Downloads

4

Readme

npm version

PayKickstart Validator

A package that validates incoming IPN notifications from PayKickstart.

PayKickstart (or PK for short) sends out IPN notifications that need to be verified. The verification process seems to be simple but because PK folks are using PHP, it has a bunch of weird corner-cases that are not obvious at first. I have created this module after internally using the same validator function for a long time and it seems to be working well in my case at least. If you see any issues, please let me know.

Usage

const PKValidator = require('paykickstart-validator')

// OR if you are using the new ES6 module syntax,
// import validateIPN from 'paykickstart-validator'

const isRequestValid = PKValidator.validateIPN(ipnData, secretKey)

API

function validateIPN(ipnData: IPNRequestBody, secretKey: string): boolean;

Params:

ipnData:

Data in the form of regular JS object coming in from paykickstart. Looks like this (Taken from IPN Notifications Reference):

[
    'event'                             => 'subscription-payment',
    'mode'                              => 'live',
    'payment_processor'                 => 'stripe',
    'is_rebill'                         => 1,
    'amount'                            => 9.99,
    'buyer_ip'                          => '196.215.215.215',
    'buyer_first_name'                  => 'John',
    'buyer_last_name'                   => 'Doe',
    'buyer_email'                       => '[email protected]',
    'vendor_first_name'                 => 'Digital',
    'vendor_last_name'                  => 'Kickstart',
    'vendor_email'                      => '[email protected]',
    'billing_address_1'                 => '',
    'billing_address_2'                 => '',
    'billing_city'                      => '',
    'billing_state'                     => '',
    'billing_zip'                       => '',
    'billing_country'                   => '',
    'shipping_address_1'                => '',
    'shipping_address_2'                => '',
    'shipping_city'                     => '',
    'shipping_state'                    => '',
    'shipping_zip'                      => '',
    'shipping_country'                  => '',
    'transaction_id'                    => 'PK-TN0LN11111',
    'invoice_id'                        => 'PK-PZ1WK61111',
    'tracking_id'                       => 111,
    'transaction_time'                  => 1469014598,
    'product_id'                        => 1111,
    'product_name'                      => 'SEO',
    'campaign_id'                       => 222,
    'campaign_name'                     => 'SEO',
    'affiliate_first_name'              => 'Bob',
    'affiliate_last_name'               => 'Joe',
    'affiliate_email'                   => '[email protected]',
    'affiliate_commission_amount'       => 4.99,
    'affiliate_commission_percent'      => 20,
    'ref_affiliate_first_name'          => null,
    'ref_affiliate_last_name'           => null,
    'ref_affiliate_email'               => null,
    'ref_affiliate_commission_amount'   => null,
    'ref_affiliate_commission_percent'  => null,
    'buyer_tax_number'                  => null,
    'buyer_tax_name'                    => null,
    'tax_transaction_id'                => null,
    'tax_amount'                        => null,
    'tax_percent'                       => null,
    'coupon_code'                       => '',
    'coupon_type'                       => '',
    'coupon_rate'                       => '',
    'custom_var1'                       => 123,
    'custom_var2'                       => '[email protected]',
    'licenses'                          => ['HPLD-XSQW-KDW3-8HTD', 'AWDF-XADWR-HYTF-4T7B'],
    'verification_code'                 => 'e2288202ad23b877c3498a6db6214b5a417b75a4'
]

secretKey

Secret key for the PK campaign. You can find it in the campaign settings page.

Tests

I test this package on a bunch of real-world cases but I don't want to release that test data to the public. If you have some IPN notifications from PK that you won't mind being shared here, please open an issue.

License