Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
paypal-rest
Advanced tools
PayPal-REST is an unofficial implementation of the PayPal Rest API. This npm package is here to simplify the usage of this API.
Warning: For the moment, this package is in ALPHA, so it contains very few of the PayPal API functionalities, and has not yet been fully designed for professional use. You are therefore taking a risk by installing and using this package. Avoid using it in production!
You have to use your favorite package manager like npm, pnpm or yarn to install paypal-rest
.
npm i paypal-rest@latest
pnpm add paypal-rest@latest
yarn add paypal-rest@latest
import { config, auth } from 'paypal-rest';
config({
client_id: '', // your PayPal CLIENT_ID
client_secret: '', // your PayPal SECRET
mode: 'sandbox', // 'sandbox' | 'live' ; default: sandbox
auto_renew: false // Let or not the package reconnect you
});
await auth().catch(console.error);
You can get your CLIENT_ID and your CLIENT_SECRET by following these task on the PayPal Docs:
Create, list, get details and update products!
import { product, ProductBuilder } from 'paypal-rest';
const newProduct = await product.create(
new ProductBuilder()
.setName('paypal-rest')
.setType('DIGITAL')
.setDescription('Buy me a coffee')
.setHomeUrl('https://paypal.me/pioupia')
);
const listProduct = await product.list();
const paypalRestProduct = await product.get(listProduct.products?.[0].id!);
await paypalRestProduct
.setDescription("Yes, I'll")
.update();
import { order, ItemsBuilder, PurchaseUnitBuilder, CurrencyCodes } from 'paypal-rest';
// Create an item
const item = new ItemsBuilder()
.setName('coffee')
.setQuantity(1)
.setUnitAmount({
currency_code: CurrencyCodes.UnitedStatesDollar, // or, you can just type 'USD'
value: 1
});
// Create a purchase unit
const purchaseUnit = new PurchaseUnitBuilder()
.setCurrency('USD')
.setPrice(1)
.setDescription("A coffee")
.addItems(item);
// Create the order
const res = await order.create({
purchase_units: [purchaseUnit]
}).catch(console.error);
// And then, when you have to capture this order:
await order.capture(res.id);
FAQs
SDK for REST PayPal API
The npm package paypal-rest receives a total of 2 weekly downloads. As such, paypal-rest popularity was classified as not popular.
We found that paypal-rest demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.