Giter Club home page Giter Club logo

paddle-sdk's Introduction

Paddle.com Node.js SDK

Github Actions NPM version

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

Installation

Install the SDK module using npm:

$ npm install paddle-sdk

or using yarn:

$ yarn add paddle-sdk

Usage

import { PaddleSDK } from 'paddle-sdk';

async function run() {
	const client = new PaddleSDK(
		'your-vendor-id-here',
		'your-unique-api-key-here'
	);

	const products = await client.getProducts();
	console.log(products);

	const plans = await client.getProductPlans(123);
	console.log(plans);
}

run();

For CommonJS:

const { PaddleSDK } = require('paddle-sdk');

Documentation

Read the documentation.

Change log

The change log can be found here: CHANGELOG.md.

Authors and license

Author: Valentin Agachi.

MIT License, see the included License.md file.

paddle-sdk's People

Contributors

avaly avatar dependabot[bot] avatar gusruss89 avatar jiihu avatar luke-rogers avatar mariusbongarts avatar merott avatar nadilas avatar nickhingston avatar nya1 avatar oronoa avatar philippbosch avatar renovate[bot] avatar rtkirill avatar sjorobekov avatar vespasianvs avatar willbill360 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

paddle-sdk's Issues

Missing refund function

Correct me if I am wrong but I didn't see a refund function in the library implementing this endpoint.

I think it can be a fairly simple refundPayment({orderId, reason, amount}) kind of function. Let me know if you want me to open a PR for it.

New Version of Paddle API not supported?

Dear @avaly , am I seeing this right that Paddle has a new API which is not compatible with this SDK or am I missing something?

It appears to me that they changed a lot this year (frontend & backend api and sdk) and thus this needs a major overhaul?

If this is the case, do you plan on updating the SDK to the new API?

Cheers,
Chris

fix annoy build warnings in vue project with webpack

I think you should upgrade dependencies 'got' and 'keyv' to latest one.

WARNING in ../node_modules/paddle-sdk/node_modules/got/source/request-as-event-emitter.js 72:18-25
Critical dependency: require function is used in a way in which dependencies cannot be statically extracted
@ ../node_modules/paddle-sdk/node_modules/got/source/as-stream.js
@ ../node_modules/paddle-sdk/node_modules/got/source/create.js
@ ../node_modules/paddle-sdk/node_modules/got/source/index.js
@ ../node_modules/paddle-sdk/sdk.js
@ ../node_modules/babel-loader/lib!../node_modules/vue-loader/lib??vue-loader-options!./components/PopupPage.vue?vue&type=script&lang=js&
@ ./components/PopupPage.vue?vue&type=script&lang=js&
@ ./components/PopupPage.vue
@ ./popup.js

WARNING in ../node_modules/keyv/src/index.js 18:14-40
Critical dependency: the request of a dependency is an expression
@ ../node_modules/paddle-sdk/node_modules/cacheable-request/src/index.js
@ ../node_modules/paddle-sdk/node_modules/got/source/request-as-event-emitter.js
@ ../node_modules/paddle-sdk/node_modules/got/source/as-stream.js
@ ../node_modules/paddle-sdk/node_modules/got/source/create.js
@ ../node_modules/paddle-sdk/node_modules/got/source/index.js
@ ../node_modules/paddle-sdk/sdk.js
@ ../node_modules/babel-loader/lib!../node_modules/vue-loader/lib??vue-loader-options!./components/PopupPage.vue?vue&type=script&lang=js&
@ ./components/PopupPage.vue?vue&type=script&lang=js&
@ ./components/PopupPage.vue
@ ./popup.js

Incorrect type definition for param `sandbox`

Hi! ๐Ÿ‘‹

Firstly, thanks for your work on this project! ๐Ÿ™‚

Today I used patch-package to patch [email protected] for the project I'm working on.

Looks like the type for sandbox was incorrect (should be boolean instead of string). I was using sandbox: 'false' which was incorrect because Boolean(false) === true

Here is the diff that solved my problem:

diff --git a/node_modules/paddle-sdk/sdk.d.ts b/node_modules/paddle-sdk/sdk.d.ts
index e8fd3d7..edd2865 100644
--- a/node_modules/paddle-sdk/sdk.d.ts
+++ b/node_modules/paddle-sdk/sdk.d.ts
@@ -7,7 +7,7 @@ declare class PaddleSDK {
      * @param {string} apiKey - The API key for a Paddle account
      * @param {string} [publicKey] - The public key for a Paddle account used to verify webhooks, only required for `verifyWebhookData`
      * @param {object} [options]
-     * @param {string} [options.sandbox=false] - Whether to use the sandbox server URL
+     * @param {boolean} [options.sandbox=false] - Whether to use the sandbox server URL
      * @param {string} [options.server=vendors.paddle.com/api/2.0] - The server URL prefix for all requests
      *
      * @example
@@ -15,7 +15,7 @@ declare class PaddleSDK {
      * const client = new PaddleSDK('your-vendor-id', 'your-unique-api-key', 'your-public-key');
      */
     constructor(vendorID: string, apiKey: string, publicKey?: string, options?: {
-        sandbox?: string;
+        sandbox?: boolean;
         server?: string;
     });
     vendorID: string;

This issue body was partially generated by patch-package.

Feature request: update a subscription

Hello,

From your documentation, it seems that the Update Subscription functionality of Paddle's API is not implemented.

Asking here in case it is implemented, just not documented.

If for some reason you can not implement it, let me know and I'll make a merge request for it.

Cheers

Update subscription price

What do you think about adding feature for updating subscription price?

This is how it could be:

 /**
   * Update subscription price
   *
   * @method
   * @param {number} subscriptionID
   * @param {number} price
   * @param {string} currency
   * @param {boolean} immediately
   * @returns {Promise}
   * @fulfill {object} - The result of the operation
   *
   * @example
   * const result = await client.updateSubscriptionPrice(123, 44, 'USD');
   */
  updateSubscriptionPrice (subscriptionID, price, currency, immediately = true) {
    return this._request('/subscription/users/update', {
      body: {
        subscription_id: subscriptionID,
	bill_immediately: immediately,
	prorate: immediately,
      	quantity: 1,
      	recurring_price: price,
      	currency
      }
    });
  }

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Rate-Limited

These updates are currently rate-limited. Click on a checkbox below to force their creation now.

  • chore: Replace standard-version with commit-and-tag-version 9.5.0
  • chore: Upgrade ts-node to v10.9.2
  • chore: Upgrade eslint to v8.57.0
  • chore: Upgrade eslint-config-prettier to v8.10.0
  • chore: Upgrade lint-staged to v13.3.0
  • chore: Upgrade nock to v11.9.1
  • chore: Upgrade ts-jest to v29.1.3
  • chore: Upgrade typedoc to v0.25.13
  • chore: Upgrade typescript to v5.4.5
  • chore: Upgrade typescript-eslint monorepo to v5.62.0 (@typescript-eslint/eslint-plugin, @typescript-eslint/parser)
  • chore: Upgrade @types/node to v20
  • chore: Upgrade actions/cache action to v4
  • chore: Upgrade actions/checkout action to v4
  • chore: Upgrade actions/deploy-pages action to v4
  • chore: Upgrade actions/setup-node action to v4
  • chore: Upgrade actions/upload-pages-artifact action to v3
  • chore: Upgrade eslint to v9
  • chore: Upgrade eslint-config-prettier to v9
  • chore: Upgrade husky to v9
  • chore: Upgrade lint-staged to v15
  • chore: Upgrade nock to v13
  • chore: Upgrade typescript-eslint monorepo to v7 (major) (@typescript-eslint/eslint-plugin, @typescript-eslint/parser)
  • ๐Ÿ” Create all rate-limited PRs at once ๐Ÿ”

Pending Status Checks

These updates await pending status checks. To force their creation now, click the checkbox below.

  • chore: Upgrade @types/node to v14.18.63
  • chore: Upgrade actions/deploy-pages action to v2.0.5
  • chore: Upgrade actions/upload-pages-artifact action to v1.0.10
  • chore: Upgrade jest monorepo (@types/jest, jest)
  • chore: Upgrade prettier to v2.8.8
  • chore: Upgrade actions/cache action to v3.3.3
  • chore: Upgrade actions/checkout action to v3.6.0
  • chore: Upgrade actions/setup-node action to v3.8.2
  • chore: Upgrade axios to v1.7.2
  • chore: Upgrade prettier to v3

Detected dependencies

github-actions
.github/workflows/docs.yaml
  • actions/checkout v3.3.0
  • actions/setup-node v3.6.0
  • actions/cache v3.2.4
  • actions/upload-pages-artifact v1.0.8
  • actions/deploy-pages v2.0.0
.github/workflows/tests.yaml
  • actions/checkout v3.3.0
  • actions/setup-node v3.6.0
  • actions/cache v3.2.4
npm
package.json
  • axios 1.6.0
  • @types/jest 29.5.0
  • @types/node 14.18.36
  • @typescript-eslint/eslint-plugin 5.56.0
  • @typescript-eslint/parser 5.56.0
  • eslint 8.36.0
  • eslint-config-prettier 8.8.0
  • husky 8.0.3
  • jest 29.5.0
  • lint-staged 13.2.0
  • nock 11.7.0
  • prettier 2.8.7
  • standard-version 9.5.0
  • ts-jest 29.0.5
  • ts-node 10.9.1
  • typedoc 0.23.28
  • typescript 5.0.2
  • validate-commit-msg 2.14.0
  • node >=14.17.0

  • Check this box to trigger a request for Renovate to run again on this repository

Is support for CommonJS dropped since v4?

I just upgraded to the latest version and got this error:

Error [ERR_REQUIRE_ESM]: require() of ES Module /app/node_modules/.pnpm/[email protected]/node_modules/paddle-sdk/esm/sdk.js from /app/dist/utilities/paddle.js not supported.

I am not asking for a fix, just checking what the intention of the major upgrade is, since the change log doesn't acknowledge dropping of CJS support.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.