Class: Airwallex::BillingCustomer

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

Overview

Represents a Billing customer — the entity a BillingSubscription is scoped to. Distinct from Airwallex::Customer, which belongs to Payment Acceptance (/api/v1/pa/customers), not Billing.

Examples:

Create a billing customer

# Flat payload, no wrapper key (unlike Beneficiary/ConnectedAccount).
# type is "INDIVIDUAL" or "BUSINESS". default_legal_entity_id is not a
# separate resource — it's account_details.legal_entity_id from a
# ConnectedAccount's own retrieve response (see
# ConnectedAccount#legal_entity_id).
 = Airwallex::ConnectedAccount.retrieve("acct_123")
billing_customer = Airwallex::BillingCustomer.create(
  name: "Acme Corp",
  email: "billing@acme.example",
  type: "BUSINESS",
  default_billing_currency: "AUD",
  default_legal_entity_id: .legal_entity_id,
  address: {
    street: "200 Collins Street",
    city: "Melbourne",
    state: "VIC",
    postcode: "3000",
    country_code: "AU"
  }
)

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 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 billing customers.

Returns:

  • (String)

    API resource path for billing customers



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

def self.resource_path
  "/api/v1/billing/billing_customers"
end

Instance Method Details

#bank_transfer_instructionsHash

Retrieve the bank transfer instructions for funding this customer's subscriptions (e.g. for a BT-funded instalment plan).

Returns:

  • (Hash)

    raw bank transfer instructions



44
45
46
# File 'lib/airwallex/resources/billing_customer.rb', line 44

def bank_transfer_instructions
  Airwallex.client.get("#{self.class.resource_path}/#{id}/bank_transfer_instructions")
end