Socket
Socket
Sign inDemoInstall

@paypal/payouts-sdk

Package Overview
Dependencies
1
Maintainers
30
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.0 to 1.1.0

CHANGELOG.md

2

lib/core/paypal_http_client.js

@@ -28,3 +28,3 @@ 'use strict';

req.headers["sdk_name"] = "Payouts SDK";
req.headers["sdk_version"] = "1.0.0";
req.headers["sdk_version"] = "1.1.0";
req.headers["sdk_tech_stack"] = "NodeJS " + process.version;

@@ -31,0 +31,0 @@ req.headers["api_integration_type"] = "PAYPALSDK";

{
"name": "@paypal/payouts-sdk",
"version": "1.0.0",
"version": "1.1.0",
"description": "NodeJS SDK for PayPal Payouts APIs",

@@ -14,2 +14,6 @@ "keywords": [

"main": "index",
"files": [
"lib",
"index.js"
],
"directories": {

@@ -16,0 +20,0 @@ "lib": "./lib"

@@ -40,3 +40,3 @@ # PayPal Payouts API SDK for NodeJS

"items": [{
"note": "Your 5$ Payout!",
"note": "Your 1$ Payout!",
"amount": {

@@ -49,3 +49,3 @@ "currency": "USD",

}, {
"note": "Your 5$ Payout!",
"note": "Your 1$ Payout!",
"amount": {

@@ -58,3 +58,3 @@ "currency": "USD",

}, {
"note": "Your 5$ Payout!",
"note": "Your 1$ Payout!",
"amount": {

@@ -67,3 +67,3 @@ "currency": "USD",

}, {
"note": "Your 5$ Payout!",
"note": "Your 1$ Payout!",
"amount": {

@@ -76,3 +76,3 @@ "currency": "USD",

}, {
"note": "Your 5$ Payout!",
"note": "Your 1$ Payout!",
"amount": {

@@ -97,3 +97,3 @@ "currency": "USD",

// If call returns body in response, you can get the deserialized version from the result attribute of the response.
console.log(`Payouts Create Response: ${JSON.stringify(response.result)}`);
console.log(`Payouts Create Response: ${JSON.stringify(response.result)}`);
}

@@ -103,2 +103,62 @@ createPayouts();

### Handle API Failure
This will create a Payout with validation failure to showcase how to parse the failed response entity. Refer samples for more scenarios
#### Code to Execute:
```javascript
const paypal = require('@paypal/payouts-sdk');
// Creating an environment
let clientId = "<<PAYPAL-CLIENT-ID>>";
let clientSecret = "<<PAYPAL-CLIENT-SECRET>>";
let environment = new paypal.core.SandboxEnvironment(clientId, clientSecret);
let client = new paypal.core.PayPalHttpClient(environment);
let requestBody = {
"sender_batch_header": {
"recipient_type": "EMAIL",
"email_message": "SDK payouts test txn",
"note": "Enjoy your Payout!!",
"sender_batch_id": "Test_sdk_fail",
"email_subject": "This is a test transaction from SDK"
},
"items": [{
"note": "Your 1$ Payout!",
"amount": {
"currency": "USD",
"value": "1.00"
},
"receiver": "payout-sdk-1@paypal.com",
"sender_item_id": "Test_txn_1"
}]
}
// Construct a request object and set desired parameters
// Here, PayoutsPostRequest() creates a POST request to /v1/payments/payouts
let request = new paypal.payouts.PayoutsPostRequest();
request.requestBody(requestBody);
// Call API with your client and get a response for your call
let createPayouts = async function(){
try {
let response = await client.execute(request);
console.log(`Response: ${JSON.stringify(response)}`);
// If call returns body in response, you can get the deserialized version from the result attribute of the response.
console.log(`Payouts Create Response: ${JSON.stringify(response.result)}`);
catch (e) {
if (e.statusCode) {
//Handle server side/API failure response
console.log("Status code: ", e.statusCode);
// Parse failure response to get the reason for failure
const error = JSON.parse(e.message)
console.log("Failure response: ", error)
console.log("Headers: ", e.headers)
} else {
//Hanlde client side failure
console.log(e)
}
}
}
createPayouts();
```
## Retrieve a Payout Batch

@@ -109,3 +169,3 @@ Pass the batchId from the previous sample to retrieve Payouts batch details

let getPayouts = async function(batchId) {
request = new paypal.payouts.PayoutsGetRequest(batch);
request = new paypal.payouts.PayoutsGetRequest(batchId);
request.page(1);

@@ -112,0 +172,0 @@ request.pageSize(10);

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc