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, x_account_id: nil, x_environment_id: nil, request_options: {}) ⇒ Stigg::Models::V1::CustomerResponse
Some parameter documentations has been truncated, see Models::V1::Customers::PaymentMethodAttachParams for more details.
-
#detach(id, x_account_id: nil, x_environment_id: nil, request_options: {}) ⇒ Stigg::Models::V1::CustomerResponse
Some parameter documentations has been truncated, see Models::V1::Customers::PaymentMethodDetachParams for more details.
-
#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.
85 86 87 |
# File 'lib/stigg/resources/v1/customers/payment_method.rb', line 85 def initialize(client:) @client = client end |
Instance Method Details
#attach(id, integration_id:, payment_method_id:, vendor_identifier:, billing_currency: nil, x_account_id: nil, x_environment_id: nil, request_options: {}) ⇒ Stigg::Models::V1::CustomerResponse
Some parameter documentations has been truncated, see Models::V1::Customers::PaymentMethodAttachParams for more details.
Attaches a payment method to a customer for billing. Required for paid subscriptions when integrated with a billing provider.
36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/stigg/resources/v1/customers/payment_method.rb', line 36 def attach(id, params) parsed, = Stigg::V1::Customers::PaymentMethodAttachParams.dump_request(params) header_params = {x_account_id: "x-account-id", x_environment_id: "x-environment-id"} @client.request( method: :post, path: ["api/v1/customers/%1$s/payment-method", id], headers: parsed.slice(*header_params.keys).transform_keys(header_params), body: parsed.except(*header_params.keys), model: Stigg::V1::CustomerResponse, options: ) end |
#detach(id, x_account_id: nil, x_environment_id: nil, request_options: {}) ⇒ Stigg::Models::V1::CustomerResponse
Some parameter documentations has been truncated, see Models::V1::Customers::PaymentMethodDetachParams for more details.
Removes the payment method from a customer. Ensure active paid subscriptions have an alternative payment method.
68 69 70 71 72 73 74 75 76 77 78 79 80 |
# File 'lib/stigg/resources/v1/customers/payment_method.rb', line 68 def detach(id, params = {}) parsed, = Stigg::V1::Customers::PaymentMethodDetachParams.dump_request(params) @client.request( method: :delete, path: ["api/v1/customers/%1$s/payment-method", id], headers: parsed.transform_keys( x_account_id: "x-account-id", x_environment_id: "x-environment-id" ), model: Stigg::V1::CustomerResponse, options: ) end |