stripe-ruby/lib/stripe/resources/payment_method_domain.rb
2024-03-07 23:11:29 +00:00

80 lines
3.3 KiB
Ruby

# File generated from our OpenAPI spec
# frozen_string_literal: true
module Stripe
# A payment method domain represents a web domain that you have registered with Stripe.
# Stripe Elements use registered payment method domains to control where certain payment methods are shown.
#
# Related guides: [Payment method domains](https://stripe.com/docs/payments/payment-methods/pmd-registration).
class PaymentMethodDomain < APIResource
extend Stripe::APIOperations::Create
extend Stripe::APIOperations::List
include Stripe::APIOperations::Save
OBJECT_NAME = "payment_method_domain"
def self.object_name
"payment_method_domain"
end
# Creates a payment method domain.
def self.create(params = {}, opts = {})
request_stripe_object(
method: :post,
path: "/v1/payment_method_domains",
params: params,
opts: opts
)
end
# Lists the details of existing payment method domains.
def self.list(filters = {}, opts = {})
request_stripe_object(
method: :get,
path: "/v1/payment_method_domains",
params: filters,
opts: opts
)
end
# Updates an existing payment method domain.
def self.update(id, params = {}, opts = {})
request_stripe_object(
method: :post,
path: format("/v1/payment_method_domains/%<id>s", { id: CGI.escape(id) }),
params: params,
opts: opts
)
end
# Some payment methods such as Apple Pay require additional steps to verify a domain. If the requirements weren't satisfied when the domain was created, the payment method will be inactive on the domain.
# The payment method doesn't appear in Elements for this domain until it is active.
#
# To activate a payment method on an existing payment method domain, complete the required validation steps specific to the payment method, and then validate the payment method domain with this endpoint.
#
# Related guides: [Payment method domains](https://stripe.com/docs/payments/payment-methods/pmd-registration).
def validate(params = {}, opts = {})
request_stripe_object(
method: :post,
path: format("/v1/payment_method_domains/%<payment_method_domain>s/validate", { payment_method_domain: CGI.escape(self["id"]) }),
params: params,
opts: opts
)
end
# Some payment methods such as Apple Pay require additional steps to verify a domain. If the requirements weren't satisfied when the domain was created, the payment method will be inactive on the domain.
# The payment method doesn't appear in Elements for this domain until it is active.
#
# To activate a payment method on an existing payment method domain, complete the required validation steps specific to the payment method, and then validate the payment method domain with this endpoint.
#
# Related guides: [Payment method domains](https://stripe.com/docs/payments/payment-methods/pmd-registration).
def self.validate(payment_method_domain, params = {}, opts = {})
request_stripe_object(
method: :post,
path: format("/v1/payment_method_domains/%<payment_method_domain>s/validate", { payment_method_domain: CGI.escape(payment_method_domain) }),
params: params,
opts: opts
)
end
end
end