Welcome to the Paddle.com Node.js SDK documentation.
Kind: global class
- PaddleSDK
- new PaddleSDK(vendorID, apiKey, [publicKey], [options])
- .getProducts() ⇒
Promise
- .getProductCoupons(productID) ⇒
Promise
- .getProductPlans(productID) ⇒
Promise
- .getPlanUsers(planID) ⇒
Promise
- .getPlanPayments(planID) ⇒
Promise
- .getWebhooksHistory() ⇒
Promise
- .getUserTransactions(userID) ⇒
Promise
- .getSubscriptionTransactions(subscriptionID) ⇒
Promise
- .getOrderTransactions(orderID) ⇒
Promise
- .getCheckoutTransactions(checkoutID) ⇒
Promise
- .verifyWebhookData(postData) ⇒
boolean
- .updateSubscriptionPlan(subscriptionID, planID, prorate) ⇒
Promise
- .cancelSubscription(subscriptionID) ⇒
Promise
- .generatePayLink(body) ⇒
Promise
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');
Get the current list of products
Kind: instance method of PaddleSDK
Fulfil: object
- The products list
Example
const products = await client.getProducts();
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);
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);
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);
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);
Get the list of webhooks history
Kind: instance method of PaddleSDK
Fulfil: object
- The webhooks history list
Example
const webhooksHistory = await client.getWebhooksHistory();
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);
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);
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);
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);
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);
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);
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);
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"
]
});
Documentation generated on Tue, 12 May 2020 09:35:32 GMT
67415f1a8957fb46e6f51aa55a473040e8d310ba