The paddleR
package provides a complete R interface to
the Paddle Billing API,
enabling you to manage customers, subscriptions, transactions, invoices,
and more directly from R.
Whether you’re building internal dashboards, automated billing workflows, or a SaaS application backend, paddle makes it easy to interact with Paddle’s RESTful endpoints in a consistent and validated way.
PaddleR
supports two environments:
https://api.paddle.com
) for productionhttps://sandbox-api.paddle.com
) for safe
testingBy default, the package uses live mode. You can switch modes using:
# Set sandbox mode for testing
set_paddle_mode("sandbox")
# Revert back to live mode
set_paddle_mode("live")
You can check the current mode and base URL with:
To authenticate with the Paddle API, you must set your API key(s) as environment variables. You have two options:
This allows the package to automatically choose the correct key based
on the mode selected with set_paddle_mode()
. Please make
sure your API has all the necessary permissions for the operations you
want to perform.
Internally, the package uses a hidden environment to store the current mode and URL:
.paddle_env <- new.env(parent = emptyenv())
.paddle_env$mode <- "live"
.paddle_env$base_url <- "https://api.paddle.com"
These are updated dynamically using the exported helpers:
Now that you have paddleR set up, you can start building your Paddle integration:
paddle_list_*()
functions to explore available
resources like products, subscriptions, customers, etc.paddle_create_customer()
,
paddle_update_customer()
, etc.paddle_create_subscription()
,
paddle_update_subscription()
, etc.paddle_list_transactions()
,
paddle_get_transaction()
, etc.paddle_list_invoices()
,
paddle_get_invoice()
, etc.paddle_list_discounts()
,
paddle_create_discount()
, etc.paddle_list_prices()
to explore available prices
for productspaddle_create_product()
,
paddle_update_product()
, etc.