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 - npm Package Compare versions

Comparing version 0.0.83 to 0.0.84

7

lib/glue/index.js

@@ -16,4 +16,7 @@ "use strict";

});
const routes = process.env.PAYPAL_REST_ROUTES ?
process.env.PAYPAL_REST_ROUTES.split(",") :
Array.from(exports.hapiPayPal.routes.keys());
exports.hapiPayPalOptions = {
routes: Array.from(exports.hapiPayPal.routes.keys()),
routes,
sdk: {

@@ -37,3 +40,3 @@ client_id: process.env.PAYPAL_CLIENT_ID,

register: exports.hapiPayPal.register,
select: ["public"],
select: [process.env.PAYPAL_HAPI_CONNECTION || "public"],
};

@@ -40,0 +43,0 @@ exports.hapiPayPalGlueRegistration = {

{
"name": "hapi-paypal",
"version": "0.0.83",
"version": "0.0.84",
"description": "A hapi plugin to interface with PayPal Rest API's and webhooks.",

@@ -33,5 +33,7 @@ "license": "MIT",

"reinstall": "rimraf node_modules yarn.lock && yarn install",
"start": "ts-node -r dotenv/config example/server.ts"
"start:dev": "cross-env NODE_ENV=development ts-node -r dot-env-json/lib/config example/server.ts"
},
"dependencies": {
"cross-env": "^5.0.5",
"dot-env-json": "^0.0.2",
"joi": "^11.1.1",

@@ -43,3 +45,2 @@ "paypal-rest-api": "^0.0.51",

"@types/blue-tape": "^0.1.31",
"@types/dotenv": "^4.0.0",
"@types/hapi": "^16.1.7",

@@ -46,0 +47,0 @@ "@types/joi": "^10.4.0",

@@ -6,60 +6,10 @@ [![Build Status](https://travis-ci.org/trainerbill/hapi-paypal.svg?branch=master)](https://travis-ci.org/trainerbill/hapi-paypal)

[![devDependency Status](https://david-dm.org/trainerbill/hapi-paypal/dev-status.svg)](https://david-dm.org/trainerbill/hapi-paypal#info=devDependencies)
# hapi-paypal
Hapi Plugin for PayPal REST API's
## hapi-paypal
Hapi Plugin for PayPal REST API's. This plugin provides two sets of functionality to easily integrate with paypal
# Usage
* Restful Routing
* Webhook Handling
```
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',
},
};
## Restful Routing
Restful Routing creates hapi routes that execute the corresponding paypal rest api call.
const hapiPaypal = {
options: hapiPayPalOptions,
register: new HapiPayPal(),
};
server.register(hapiPaypal);
```

Sorry, the diff of this file is not supported yet

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