Skip to content

Configuration

ESouza edited this page Mar 24, 2026 · 1 revision

Configuration

Basic Configuration

PushPay.configure do |config|
  config.client_id        = ENV['PUSHPAY_CLIENT_ID']
  config.client_secret    = ENV['PUSHPAY_CLIENT_SECRET']
  config.merchant_key     = ENV['PUSHPAY_MERCHANT_KEY']
  config.organization_key = ENV['PUSHPAY_ORGANIZATION_KEY']
end

Configuration Options

Option Required Default Description
client_id Yes nil OAuth client ID provided by PushPay
client_secret Yes nil OAuth client secret provided by PushPay
merchant_key No* nil Merchant key for scoped API calls
organization_key No* nil Organization key for org-scoped API calls
base_url No https://api.pushpay.io API base URL
auth_url No https://auth.pushpay.com/pushpay/oauth/token OAuth token endpoint
timeout No 30 HTTP request timeout in seconds
scopes No ["read"] OAuth scopes to request

*merchant_key and organization_key are required for merchant/org-scoped endpoints but not for global endpoints like Merchant.in_scope.

Scopes

PushPay requires at least one scope in the OAuth token request. The default is ["read"]. Available scopes include:

Scope Description
read Read-only access
list_my_merchants List accessible merchants
merchant:view_payments View payment data
merchant:view_recurring_payments View recurring payment data
merchant:view_community_members View community members
merchant:manage_community_members Manage community members
merchant:manage_webhooks Manage webhook subscriptions
organization:manage_funds Create, update, delete funds
create_anticipated_payment Create anticipated payments

Configure scopes based on what your application needs:

PushPay.configure do |config|
  config.client_id     = 'your_client_id'
  config.client_secret = 'your_secret'
  config.scopes = %w[
    read
    list_my_merchants
    merchant:view_payments
    merchant:view_recurring_payments
  ]
end

Sandbox Mode

Call sandbox! to switch to the PushPay sandbox environment:

PushPay.configure do |config|
  config.client_id     = 'your_sandbox_client_id'
  config.client_secret = 'your_sandbox_secret'
  config.sandbox!
end

This changes:

  • base_url to https://sandbox-api.pushpay.io
  • auth_url to https://auth.pushpay.com/pushpay-sandbox/oauth/token

Resetting Configuration

To reset all configuration and clear the cached client:

PushPay.reset!

This is useful in test environments or when switching between configurations.

Validation

Check if configuration is valid before making API calls:

PushPay.configuration.valid?
# => true

PushPay.configuration.missing_credentials
# => [] (empty if all required credentials are set)

Clone this wiki locally