Skip to content

feat: add account, settings and API root endpoints - #272

Open
kierantaylorpaddle wants to merge 1 commit into
mainfrom
fix/api-spec-alignment
Open

kierantaylorpaddle wants to merge 1 commit into
mainfrom
fix/api-spec-alignment

Conversation

@kierantaylorpaddle

Copy link
Copy Markdown
Contributor

Why

The Paddle API now lets you read and change account settings, but the Node SDK had no way to call those endpoints. This PR adds them, so the SDK now covers every endpoint in the public OpenAPI spec. Method names match the PHP and Python SDKs.

What changed

  • New paddle.account with get() and update().
  • New paddle.settings with a get and an update method for each of the 9 settings endpoints, such as getTaxSettings() and updateCheckoutRecovery().
  • New paddle.apiRoot.get(), which returns the API version and the caller's auth type, account and permissions.
  • New BalanceMovementType for payout reconciliation report filter values.
  • Client.patch takes an optional preserveKeys setting, which sends the request body without snake_case conversion.

For the reviewer

  • Why preserveKeys exists. The currency conversions body is keyed by currency code. Our snake_case conversion turns USD into usd, and the API rejects that with a 400 (invalid propertyName 'usd'). Only updateCurrencyConversions uses it, and a test checks the JSON sent.
  • Clearing the checkout URL. updateCheckoutUrl accepts null to clear the URL, as the public spec says. The PHP SDK 1.20.0 changelog says the API no longer accepts null. Needs an API team call: if PHP is right, defaultUrl should be a required string.

Testing

  • Unit tests for all 21 new methods. The settings tests mock fetch, so they check the URL, method and JSON body sent.
  • Ran all 20 calls against a sandbox account: every get, then each settings update with its current value. All passed and nothing changed. account.update() and clearing the checkout URL weren't run.
  • Unit tests, lint, prettier and type checks pass.

🤖 Generated with Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant