Getting Started with paddle

library(paddleR)

Overview

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.

Setting the API Mode

PaddleR supports two environments:

By 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:

get_paddle_mode()  # Returns "live" or "sandbox"
get_paddle_url()   # Returns full API base URL

Setting Your API Key

To authenticate with the Paddle API, you must set your API key(s) as environment variables. You have two options:

Option 1: Single Key (Live OR Sandbox)

Sys.setenv(PADDLE_KEY = "your-live-or-sandbox-key")

Example: Initialize and Fetch Data

# Set mode to sandbox for testing
set_paddle_mode("sandbox")

# List products, subscriptions, or customers
products <- paddle_list_products()
subscriptions <- paddle_list_subscriptions()

Package Initialization Logic

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:

Next Steps

Now that you have paddleR set up, you can start building your Paddle integration:

Need Help?