Skip to content

Latest commit

 

History

History
278 lines (215 loc) · 8.85 KB

Documentation.md

File metadata and controls

278 lines (215 loc) · 8.85 KB

Paddle.com Node.js SDK Documentation

Welcome to the Paddle.com Node.js SDK documentation.

PaddleSDK

Kind: global class

new PaddleSDK(vendorID, apiKey, [publicKey], [options])

Param Type Default Description
vendorID string The vendor ID for a Paddle account
apiKey string The API key for a Paddle account
[publicKey] string The public key for a Paddle account used to verify webhooks, only required for verifyWebhookData
[options] object
[options.server] string "vendors.paddle.com/api/2.0" The server URL prefix for all requests

Example

const client = new PaddleSDK('your-vendor-id', 'your-unique-api-key');
const client = new PaddleSDK('your-vendor-id', 'your-unique-api-key', 'your-public-key');

client.getProducts() ⇒ Promise

Get the current list of products

Kind: instance method of PaddleSDK
Fulfil: object - The products list
Example

const products = await client.getProducts();

client.getProductCoupons(productID) ⇒ Promise

Get the current list of coupons for a product

Kind: instance method of PaddleSDK
Fulfil: object - The coupons list

Param Type
productID number

Example

const coupons = await client.getProductCoupons(123);

client.getProductPlans(productID) ⇒ Promise

Get the current list of plans for a subscription

Kind: instance method of PaddleSDK
Fulfil: object - The plans list

Param Type
productID number

Example

const plans = await client.getProductPlans(123);

client.getPlanUsers(planID) ⇒ Promise

Get the current list of users for a subscription plan

Kind: instance method of PaddleSDK
Fulfil: object - The users list

Param Type
planID number

Example

const users = await client.getPlanUsers(123);

client.getPlanPayments(planID) ⇒ Promise

Get the list of payments for a subscription plan

Kind: instance method of PaddleSDK
Fulfil: object - The payments list

Param Type
planID number

Example

const payments = await client.getPlanPayments(123);

client.getWebhooksHistory() ⇒ Promise

Get the list of webhooks history

Kind: instance method of PaddleSDK
Fulfil: object - The webhooks history list
Example

const webhooksHistory = await client.getWebhooksHistory();

client.getUserTransactions(userID) ⇒ Promise

Get the list of transations for a user

Kind: instance method of PaddleSDK
Fulfil: object - The transations list

Param Type
userID number

Example

const userTransactions = await client.getUserTransactions(123);

client.getSubscriptionTransactions(subscriptionID) ⇒ Promise

Get the list of transations for a subscription

Kind: instance method of PaddleSDK
Fulfil: object - The transations list

Param Type
subscriptionID number

Example

const subscriptionTransactions = await client.getSubscriptionTransactions(123);

client.getOrderTransactions(orderID) ⇒ Promise

Get the list of transations for an order

Kind: instance method of PaddleSDK
Fulfil: object - The transations list

Param Type
orderID number

Example

const orderTransactions = await client.getOrderTransactions(123);

client.getCheckoutTransactions(checkoutID) ⇒ Promise

Get the list of transations for a checkout

Kind: instance method of PaddleSDK
Fulfil: object - The transations list

Param Type
checkoutID number

Example

const checkoutTransactions = await client.getCheckoutTransactions(123);

client.verifyWebhookData(postData) ⇒ boolean

Verify a webhook alert data using signature and a public key to validate that it was indeed sent from Paddle.

For more details: https://paddle.com/docs/reference-verifying-webhooks

Kind: instance method of PaddleSDK

Param Type Description
postData Object The object with all the parameters sent to the webhook

Example

const client = new PaddleSDK('your-vendor-id', 'your-unique-api-key', 'your-public-key');

// inside an Express handler which uses express.bodyParser middleware
const isVerified = client.verifyWebhookData(req.body);

client.updateSubscriptionPlan(subscriptionID, planID, prorate) ⇒ Promise

Update (upgrade/downgrade) the plan of a subscription

Kind: instance method of PaddleSDK
Fulfill: object - The result of the operation

Param Type Default
subscriptionID number
planID number
prorate boolean false

Example

const result = await client.updateSubscriptionPlan(123);

client.cancelSubscription(subscriptionID) ⇒ Promise

Cancels an active subscription

Kind: instance method of PaddleSDK
Fulfil: object - The result of the operation

Param Type
subscriptionID number

Example

const result = await client.cancelSubscription(123);

client.generatePayLink(body) ⇒ Promise

Generate a custom pay link

Kind: instance method of PaddleSDK
Fulfil: object - The new pay link url

Param Type
body object

Example

const custom = await client.generatePayLink({
 "title" : "my custom checkout",
 "custom_message" : "some custom message"
	"prices": [
		"USD:19.99",
		"EUR:15.99"
	 ]
	});

<<<<<<< HEAD Documentation generated on Thu, 10 Oct 2019 06:11:32 GMT

Documentation generated on Tue, 12 May 2020 09:35:32 GMT

67415f1a8957fb46e6f51aa55a473040e8d310ba