For AI agents and LLMs: a structured documentation index is available at /llms.txt. Every page has a Markdown sibling — append .md to any URL.

Skip to content
Docs

Pay gem (Ruby on Rails)

Community-maintained Ruby on Rails gem that provides an abstraction over Paddle Billing alongside other payment processors.

AI summary

Use the community-maintained Pay gem to integrate Paddle Billing with a Ruby on Rails app behind a single API that also abstracts Stripe, Braintree, and Lemon Squeezy. Pay is maintained by the pay-rails community, not by Paddle.

  • • Add gem "pay", "~> 11.5" and gem "paddle", "~> 2.9" to your Gemfile; requires Ruby and Rails 7.0 or later, then run the Pay installation guide to generate migrations and configure your User model.
  • • Configure four PADDLE_BILLING_* env vars (environment, api_key, client_token, signing_secret) — environment defaults to production if unset.
  • • Set the processor with user.set_payment_processor :paddle_billing; subscription records are created automatically when Paddle sends subscription.created webhooks.

Pay is a community-maintained payments engine for Ruby on Rails 6.0 and later. It abstracts over Paddle Billing, Stripe, Braintree, and Lemon Squeezy with a single API for customers, subscriptions, charges, and webhooks.

Requirements

  • Ruby.
  • Rails 7.0 or later.

Install

Add Pay to your Gemfile:

ruby
gem "pay", "~> 11.5"
gem "paddle", "~> 2.9"

Run bundle install and follow the installation guide to generate migrations and configure your User model.

Configure

Pay reads Paddle credentials from environment variables, or the equivalent Rails credentials:

VariablePurpose
PADDLE_BILLING_ENVIRONMENTsandbox or production. Defaults to production.
PADDLE_BILLING_API_KEYAPI key from Paddle > Developer tools > Authentication.
PADDLE_BILLING_CLIENT_TOKENClient-side token for Paddle.js, created in the same place.
PADDLE_BILLING_SIGNING_SECRETNotification destination secret key, used to verify webhook signatures.

Quick example

Create a Paddle customer for a Pay-enabled model:

ruby
user.set_payment_processor :paddle_billing
user.payment_processor.api_record

Subscriptions are created using webhooks. When Paddle sends a subscription.created notification, Pay creates the subscription record automatically. See the subscriptions guide for more.

Was this page helpful?