Module: Pago

Defined in:
lib/pago.rb,
lib/pago/http.rb,
lib/pago/model.rb,
lib/pago/serde.rb,
lib/pago/errors.rb,
lib/pago/service.rb,
lib/pago/version.rb,
lib/pago/webhooks.rb,
lib/pago/paginator.rb,
lib/pago/base_client.rb,
lib/pago/v2026_04/enums.rb,
lib/pago/v2026_04/client.rb,
lib/pago/v2026_04/errors.rb,
lib/pago/v2026_04/models.rb,
lib/pago/v2026_04/unions.rb,
lib/pago/v2026_04/webhooks.rb,
lib/pago/v2026_04/services/files.rb,
lib/pago/v2026_04/services/events.rb,
lib/pago/v2026_04/services/meters.rb,
lib/pago/v2026_04/services/oauth2.rb,
lib/pago/v2026_04/services/orders.rb,
lib/pago/v2026_04/services/members.rb,
lib/pago/v2026_04/services/metrics.rb,
lib/pago/v2026_04/services/refunds.rb,
lib/pago/v2026_04/services/benefits.rb,
lib/pago/v2026_04/services/disputes.rb,
lib/pago/v2026_04/services/payments.rb,
lib/pago/v2026_04/services/products.rb,
lib/pago/v2026_04/services/webhooks.rb,
lib/pago/v2026_04/services/checkouts.rb,
lib/pago/v2026_04/services/customers.rb,
lib/pago/v2026_04/services/discounts.rb,
lib/pago/v2026_04/services/event_types.rb,
lib/pago/v2026_04/services/license_keys.rb,
lib/pago/v2026_04/services/custom_fields.rb,
lib/pago/v2026_04/services/organizations.rb,
lib/pago/v2026_04/services/subscriptions.rb,
lib/pago/v2026_04/services/benefit_grants.rb,
lib/pago/v2026_04/services/checkout_links.rb,
lib/pago/v2026_04/services/customer_seats.rb,
lib/pago/v2026_04/services/customer_meters.rb,
lib/pago/v2026_04/services/customer_portal.rb,
lib/pago/v2026_04/services/customer_sessions.rb,
sig/pago.rbs,
sig/pago/v2026_04/generated.rbs

Overview

Pago — a billing platform for the intelligence era.

The constants below alias the latest API version, so Pago::Client always points at the newest generated client. Pin an explicit version module (e.g. Pago::V2026_04::Client) to opt out of that.

Defined Under Namespace

Modules: HTTP, Models, Serde, V2026_04, WebhookVerifier Classes: APIError, AuthenticationError, BadRequestError, BaseClient, ClientError, ConflictError, Error, GoneError, Model, NetworkError, NotFoundError, Paginator, PaymentRequiredError, PermissionDeniedError, PreconditionFailedError, RateLimitError, SerializationError, ServerError, Service, TimeoutError, UnprocessableEntityError, WebhookError, WebhookSecretError, WebhookUnknownTypeError, WebhookVerificationError

Constant Summary collapse

Client =

Returns the client of the latest API version (2026-04).

Returns:

  • (Class)

    the client of the latest API version (2026-04).

V2026_04::Client
Enums =
V2026_04::Enums
Unions =
V2026_04::Unions
Errors =
V2026_04::Errors
Webhooks =
V2026_04::Webhooks
Services =
V2026_04::Services
LATEST_API_VERSION =

Returns:

  • (String)
"2026-04"
UNSET =

Sentinel telling an attribute apart from one explicitly set to nil.

Model attributes default to UNSET; only the attributes that were given a value are serialized back to JSON, so a partial update never sends null for the fields it does not touch.

Object.new
STATUS_ERROR_CLASSES =
{
  400 => BadRequestError,
  401 => AuthenticationError,
  402 => PaymentRequiredError,
  403 => PermissionDeniedError,
  404 => NotFoundError,
  409 => ConflictError,
  410 => GoneError,
  412 => PreconditionFailedError,
  422 => UnprocessableEntityError,
  429 => RateLimitError
}.freeze
VERSION =

Returns:

  • (String)
"1.0.0"

Class Method Summary collapse

Class Method Details

.error_class_for(status_code) ⇒ Class

Returns the generic error class matching an HTTP status code.

Parameters:

  • status_code (Integer)

Returns:

  • (Class)

    the generic error class matching an HTTP status code.



78
79
80
81
82
# File 'lib/pago/errors.rb', line 78

def self.error_class_for(status_code)
  return ServerError if status_code >= 500

  STATUS_ERROR_CLASSES.fetch(status_code, ClientError)
end