Class: Airwallex::Customer

Inherits:
APIResource show all
Extended by:
APIOperations::Create, APIOperations::Delete, APIOperations::List, APIOperations::Retrieve, APIOperations::Update
Includes:
APIOperations::Update
Defined in:
lib/airwallex/resources/customer.rb

Overview

Represents a customer for organizing payment methods and transactions

Customers allow you to group payment methods and track payment history for individual users or accounts.

Examples:

Create a customer

customer = Airwallex::Customer.create(
  email: "[email protected]",
  first_name: "John",
  last_name: "Doe",
  metadata: { internal_id: "user_789" }
)

List payment methods for a customer

methods = Airwallex::PaymentMethod.list(customer_id: customer.id)

Instance Attribute Summary

Attributes inherited from APIResource

#attributes, #id

Class Method Summary collapse

Instance Method Summary collapse

Methods included from APIOperations::Create

create

Methods included from APIOperations::Retrieve

retrieve

Methods included from APIOperations::List

list

Methods included from APIOperations::Update

included, save, update

Methods included from APIOperations::Delete

delete

Methods inherited from APIResource

#changed_attributes, #dirty?, #initialize, #inspect, #method_missing, #refresh, #refresh_from, resource_name, #respond_to_missing?, #to_hash, #to_json, #to_s

Constructor Details

This class inherits a constructor from Airwallex::APIResource

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Airwallex::APIResource

Class Method Details

.resource_pathString

Returns API resource path for customers.

Returns:

  • (String)

    API resource path for customers



28
29
30
# File 'lib/airwallex/resources/customer.rb', line 28

def self.resource_path
  "/api/v1/pa/customers"
end

Instance Method Details

#payment_methods(params = {}) ⇒ ListObject<PaymentMethod>

List payment methods for this customer

Parameters:

  • params (Hash) (defaults to: {})

    additional parameters

Returns:



36
37
38
# File 'lib/airwallex/resources/customer.rb', line 36

def payment_methods(params = {})
  PaymentMethod.list(params.merge(customer_id: id))
end