Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

hapi-paypal

Package Overview
Dependencies
Maintainers
1
Versions
97
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hapi-paypal

A hapi plugin to interface with PayPal Rest API's and webhooks.

  • 0.0.23
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
10
decreased by-90%
Maintainers
1
Weekly downloads
 
Created
Source

Build Status Coverage Status npm version Dependency Status devDependency Status

hapi-paypal

Hapi Plugin for PayPal REST API's

Usage

const hapiPayPalOptions = {
    routes: [
        // Enable any routes supported by the plugin:  https://github.com/trainerbill/hapi-paypal/blob/master/src/index.ts#L78
        // Handler gets called after the paypal api call.
        // Response from paypal is returned to your handler in the 3rd argument
        {
            config: {
                id: "paypal_payment_create",
            },
            handler: (request: any, reply: any, response: any) => {
                server.log(response);
                reply(response);
            },
        },
        // IF you enable webhooks you need a listener route.  Handler gets called after receiving every webhook.  We recommend saving to a database.
        {
            config: {
                id: "paypal_webhooks_listen",
            },
            handler: (request: any, reply: any, response: any) => {
                reply("GOT IT!");
            },
        },
    ],
    sdk: {
        // PayPal SDK Configuration: https://github.com/paypal/PayPal-node-SDK/blob/master/lib/configure.js
        client_id: process.env.PAYPAL_CLIENT_ID,
        client_secret: process.env.PAYPAL_CLIENT_SECRET,
        mode: "sandbox",
    },
    // Enables webhooks
    webhooks: {
        event_types: [
            {
                // Any Webhook names you want enabled: https://developer.paypal.com/docs/integration/direct/webhooks/event-names/
                name: "INVOICING.INVOICE.PAID",
            },
            {
                name: "INVOICING.INVOICE.CANCELLED",
            },
        ],
        // Host name for webhooks.  Must be SSL.
        url: "https://www.yourwebhookdomain.com',
    },
};

const hapiPaypal = {
    options: hapiPayPalOptions,
    register: new HapiPayPal(),
};

server.register(hapiPaypal);

Keywords

FAQs

Package last updated on 01 Aug 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc