stripe-ruby/lib/stripe/resources/payment_method_configuration.rb
2024-02-06 10:19:06 -08:00

57 lines
2.6 KiB
Ruby

# File generated from our OpenAPI spec
# frozen_string_literal: true
module Stripe
# PaymentMethodConfigurations control which payment methods are displayed to your customers when you don't explicitly specify payment method types. You can have multiple configurations with different sets of payment methods for different scenarios.
#
# There are two types of PaymentMethodConfigurations. Which is used depends on the [charge type](https://stripe.com/docs/connect/charges):
#
# **Direct** configurations apply to payments created on your account, including Connect destination charges, Connect separate charges and transfers, and payments not involving Connect.
#
# **Child** configurations apply to payments created on your connected accounts using direct charges, and charges with the on_behalf_of parameter.
#
# Child configurations have a `parent` that sets default values and controls which settings connected accounts may override. You can specify a parent ID at payment time, and Stripe will automatically resolve the connected account's associated child configuration. Parent configurations are [managed in the dashboard](https://dashboard.stripe.com/settings/payment_methods/connected_accounts) and are not available in this API.
#
# Related guides:
# - [Payment Method Configurations API](https://stripe.com/docs/connect/payment-method-configurations)
# - [Multiple configurations on dynamic payment methods](https://stripe.com/docs/payments/multiple-payment-method-configs)
# - [Multiple configurations for your Connect accounts](https://stripe.com/docs/connect/multiple-payment-method-configurations)
class PaymentMethodConfiguration < APIResource
extend Stripe::APIOperations::Create
extend Stripe::APIOperations::List
include Stripe::APIOperations::Save
OBJECT_NAME = "payment_method_configuration"
# Creates a payment method configuration
def self.create(params = {}, opts = {})
request_stripe_object(
method: :post,
path: "/v1/payment_method_configurations",
params: params,
opts: opts
)
end
# List payment method configurations
def self.list(filters = {}, opts = {})
request_stripe_object(
method: :get,
path: "/v1/payment_method_configurations",
params: filters,
opts: opts
)
end
# Update payment method configuration
def self.update(id, params = {}, opts = {})
request_stripe_object(
method: :post,
path: format("/v1/payment_method_configurations/%<id>s", { id: CGI.escape(id) }),
params: params,
opts: opts
)
end
end
end