Class: Stigg::Resources::V1::Customers::PaymentMethod
- Inherits:
-
Object
- Object
- Stigg::Resources::V1::Customers::PaymentMethod
- Defined in:
- lib/stigg/resources/v1/customers/payment_method.rb
Overview
Operations related to customers
Instance Method Summary collapse
-
#attach(id, integration_id:, payment_method_id:, vendor_identifier:, billing_currency: nil, request_options: {}) ⇒ Stigg::Models::V1::CustomerResponse
Attaches a payment method to a customer for billing.
-
#detach(id, request_options: {}) ⇒ Stigg::Models::V1::CustomerResponse
Removes the payment method from a customer.
-
#initialize(client:) ⇒ PaymentMethod
constructor
private
A new instance of PaymentMethod.
Constructor Details
#initialize(client:) ⇒ PaymentMethod
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of PaymentMethod.
64 65 66 |
# File 'lib/stigg/resources/v1/customers/payment_method.rb', line 64 def initialize(client:) @client = client end |
Instance Method Details
#attach(id, integration_id:, payment_method_id:, vendor_identifier:, billing_currency: nil, request_options: {}) ⇒ Stigg::Models::V1::CustomerResponse
Attaches a payment method to a customer for billing. Required for paid subscriptions when integrated with a billing provider.
29 30 31 32 33 34 35 36 37 38 |
# File 'lib/stigg/resources/v1/customers/payment_method.rb', line 29 def attach(id, params) parsed, = Stigg::V1::Customers::PaymentMethodAttachParams.dump_request(params) @client.request( method: :post, path: ["api/v1/customers/%1$s/payment-method", id], body: parsed, model: Stigg::V1::CustomerResponse, options: ) end |
#detach(id, request_options: {}) ⇒ Stigg::Models::V1::CustomerResponse
Removes the payment method from a customer. Ensure active paid subscriptions have an alternative payment method.
52 53 54 55 56 57 58 59 |
# File 'lib/stigg/resources/v1/customers/payment_method.rb', line 52 def detach(id, params = {}) @client.request( method: :delete, path: ["api/v1/customers/%1$s/payment-method", id], model: Stigg::V1::CustomerResponse, options: params[:request_options] ) end |