Reorder methods (#1347)

This commit is contained in:
helenye-stripe 2024-03-07 15:11:29 -08:00 committed by GitHub
parent 74294666a2
commit e2893a274e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
29 changed files with 977 additions and 977 deletions

View File

@ -29,23 +29,54 @@ module Stripe
nested_resource_class_methods :login_link, operations: %i[create]
nested_resource_class_methods :person, operations: %i[create retrieve update delete list]
# Returns a list of people associated with the account's legal entity. The people are returned sorted by creation date, with the most recent people appearing first.
def persons(params = {}, opts = {})
# With [Connect](https://stripe.com/docs/connect), you can create Stripe accounts for your users.
# To do this, you'll first need to [register your platform](https://dashboard.stripe.com/account/applications/settings).
#
# If you've already collected information for your connected accounts, you [can prefill that information](https://stripe.com/docs/connect/best-practices#onboarding) when
# creating the account. Connect Onboarding won't ask for the prefilled information during account onboarding.
# You can prefill any information on the account.
def self.create(params = {}, opts = {})
request_stripe_object(method: :post, path: "/v1/accounts", params: params, opts: opts)
end
# With [Connect](https://stripe.com/docs/connect), you can delete accounts you manage.
#
# Accounts created using test-mode keys can be deleted at any time. Standard accounts created using live-mode keys cannot be deleted. Custom or Express accounts created using live-mode keys can only be deleted once all balances are zero.
#
# If you want to delete your own account, use the [account information tab in your account settings](https://dashboard.stripe.com/settings/account) instead.
def self.delete(id, params = {}, opts = {})
request_stripe_object(
method: :get,
path: format("/v1/accounts/%<account>s/persons", { account: CGI.escape(self["id"]) }),
method: :delete,
path: format("/v1/accounts/%<id>s", { id: CGI.escape(id) }),
params: params,
opts: opts
)
end
# With [Connect](https://stripe.com/docs/connect), you may flag accounts as suspicious.
# With [Connect](https://stripe.com/docs/connect), you can delete accounts you manage.
#
# Test-mode Custom and Express accounts can be rejected at any time. Accounts created using live-mode keys may only be rejected once all balances are zero.
def reject(params = {}, opts = {})
# Accounts created using test-mode keys can be deleted at any time. Standard accounts created using live-mode keys cannot be deleted. Custom or Express accounts created using live-mode keys can only be deleted once all balances are zero.
#
# If you want to delete your own account, use the [account information tab in your account settings](https://dashboard.stripe.com/settings/account) instead.
def delete(params = {}, opts = {})
request_stripe_object(
method: :post,
path: format("/v1/accounts/%<account>s/reject", { account: CGI.escape(self["id"]) }),
method: :delete,
path: format("/v1/accounts/%<account>s", { account: CGI.escape(self["id"]) }),
params: params,
opts: opts
)
end
# Returns a list of accounts connected to your platform via [Connect](https://stripe.com/docs/connect). If you're not a platform, the list is empty.
def self.list(filters = {}, opts = {})
request_stripe_object(method: :get, path: "/v1/accounts", params: filters, opts: opts)
end
# Returns a list of people associated with the account's legal entity. The people are returned sorted by creation date, with the most recent people appearing first.
def persons(params = {}, opts = {})
request_stripe_object(
method: :get,
path: format("/v1/accounts/%<account>s/persons", { account: CGI.escape(self["id"]) }),
params: params,
opts: opts
)
@ -61,6 +92,18 @@ module Stripe
)
end
# With [Connect](https://stripe.com/docs/connect), you may flag accounts as suspicious.
#
# Test-mode Custom and Express accounts can be rejected at any time. Accounts created using live-mode keys may only be rejected once all balances are zero.
def reject(params = {}, opts = {})
request_stripe_object(
method: :post,
path: format("/v1/accounts/%<account>s/reject", { account: CGI.escape(self["id"]) }),
params: params,
opts: opts
)
end
# With [Connect](https://stripe.com/docs/connect), you may flag accounts as suspicious.
#
# Test-mode Custom and Express accounts can be rejected at any time. Accounts created using live-mode keys may only be rejected once all balances are zero.
@ -73,6 +116,24 @@ module Stripe
)
end
# Updates a [connected account](https://stripe.com/docs/connect/accounts) by setting the values of the parameters passed. Any parameters not provided are
# left unchanged.
#
# For Custom accounts, you can update any information on the account. For other accounts, you can update all information until that
# account has started to go through Connect Onboarding. Once you create an [Account Link or <a href="/docs/api/account_sessions">Account Session](https://stripe.com/docs/api/account_links),
# some properties can only be changed or updated for Custom accounts.
#
# To update your own account, use the [Dashboard](https://dashboard.stripe.com/settings/account). Refer to our
# [Connect](https://stripe.com/docs/connect/updating-accounts) documentation to learn more about updating accounts.
def self.update(id, params = {}, opts = {})
request_stripe_object(
method: :post,
path: format("/v1/accounts/%<id>s", { id: CGI.escape(id) }),
params: params,
opts: opts
)
end
save_nested_resource :external_account
def resource_url
@ -196,66 +257,5 @@ module Stripe
end
update_hash
end
# With [Connect](https://stripe.com/docs/connect), you can create Stripe accounts for your users.
# To do this, you'll first need to [register your platform](https://dashboard.stripe.com/account/applications/settings).
#
# If you've already collected information for your connected accounts, you [can prefill that information](https://stripe.com/docs/connect/best-practices#onboarding) when
# creating the account. Connect Onboarding won't ask for the prefilled information during account onboarding.
# You can prefill any information on the account.
def self.create(params = {}, opts = {})
request_stripe_object(method: :post, path: "/v1/accounts", params: params, opts: opts)
end
# With [Connect](https://stripe.com/docs/connect), you can delete accounts you manage.
#
# Accounts created using test-mode keys can be deleted at any time. Standard accounts created using live-mode keys cannot be deleted. Custom or Express accounts created using live-mode keys can only be deleted once all balances are zero.
#
# If you want to delete your own account, use the [account information tab in your account settings](https://dashboard.stripe.com/settings/account) instead.
def self.delete(id, params = {}, opts = {})
request_stripe_object(
method: :delete,
path: format("/v1/accounts/%<id>s", { id: CGI.escape(id) }),
params: params,
opts: opts
)
end
# With [Connect](https://stripe.com/docs/connect), you can delete accounts you manage.
#
# Accounts created using test-mode keys can be deleted at any time. Standard accounts created using live-mode keys cannot be deleted. Custom or Express accounts created using live-mode keys can only be deleted once all balances are zero.
#
# If you want to delete your own account, use the [account information tab in your account settings](https://dashboard.stripe.com/settings/account) instead.
def delete(params = {}, opts = {})
request_stripe_object(
method: :delete,
path: format("/v1/accounts/%<account>s", { account: CGI.escape(self["id"]) }),
params: params,
opts: opts
)
end
# Returns a list of accounts connected to your platform via [Connect](https://stripe.com/docs/connect). If you're not a platform, the list is empty.
def self.list(filters = {}, opts = {})
request_stripe_object(method: :get, path: "/v1/accounts", params: filters, opts: opts)
end
# Updates a [connected account](https://stripe.com/docs/connect/accounts) by setting the values of the parameters passed. Any parameters not provided are
# left unchanged.
#
# For Custom accounts, you can update any information on the account. For other accounts, you can update all information until that
# account has started to go through Connect Onboarding. Once you create an [Account Link or <a href="/docs/api/account_sessions">Account Session](https://stripe.com/docs/api/account_links),
# some properties can only be changed or updated for Custom accounts.
#
# To update your own account, use the [Dashboard](https://dashboard.stripe.com/settings/account). Refer to our
# [Connect](https://stripe.com/docs/connect/updating-accounts) documentation to learn more about updating accounts.
def self.update(id, params = {}, opts = {})
request_stripe_object(
method: :post,
path: format("/v1/accounts/%<id>s", { id: CGI.escape(id) }),
params: params,
opts: opts
)
end
end
end

View File

@ -13,10 +13,6 @@ module Stripe
"apple_pay_domain"
end
def self.resource_url
"/v1/apple_pay/domains"
end
# Create an apple pay domain.
def self.create(params = {}, opts = {})
request_stripe_object(
@ -56,5 +52,9 @@ module Stripe
opts: opts
)
end
def self.resource_url
"/v1/apple_pay/domains"
end
end
end

View File

@ -21,6 +21,11 @@ module Stripe
"apps.secret"
end
# Create or replace a secret in the secret store.
def self.create(params = {}, opts = {})
request_stripe_object(method: :post, path: "/v1/apps/secrets", params: params, opts: opts)
end
# Deletes a secret from the secret store by name and scope.
def self.delete_where(params = {}, opts = {})
request_stripe_object(
@ -41,11 +46,6 @@ module Stripe
)
end
# Create or replace a secret in the secret store.
def self.create(params = {}, opts = {})
request_stripe_object(method: :post, path: "/v1/apps/secrets", params: params, opts: opts)
end
# List all secrets stored on the given scope.
def self.list(filters = {}, opts = {})
request_stripe_object(method: :get, path: "/v1/apps/secrets", params: filters, opts: opts)

View File

@ -26,6 +26,16 @@ module Stripe
"checkout.session"
end
# Creates a Session object.
def self.create(params = {}, opts = {})
request_stripe_object(
method: :post,
path: "/v1/checkout/sessions",
params: params,
opts: opts
)
end
# A Session can be expired when it is in one of these statuses: open
#
# After it expires, a customer can't complete a Session and customers loading the Session see a message saying the Session is expired.
@ -38,16 +48,6 @@ module Stripe
)
end
# When retrieving a Checkout Session, there is an includable line_items property containing the first handful of those items. There is also a URL where you can retrieve the full (paginated) list of line items.
def list_line_items(params = {}, opts = {})
request_stripe_object(
method: :get,
path: format("/v1/checkout/sessions/%<session>s/line_items", { session: CGI.escape(self["id"]) }),
params: params,
opts: opts
)
end
# A Session can be expired when it is in one of these statuses: open
#
# After it expires, a customer can't complete a Session and customers loading the Session see a message saying the Session is expired.
@ -60,26 +60,6 @@ module Stripe
)
end
# When retrieving a Checkout Session, there is an includable line_items property containing the first handful of those items. There is also a URL where you can retrieve the full (paginated) list of line items.
def self.list_line_items(session, params = {}, opts = {})
request_stripe_object(
method: :get,
path: format("/v1/checkout/sessions/%<session>s/line_items", { session: CGI.escape(session) }),
params: params,
opts: opts
)
end
# Creates a Session object.
def self.create(params = {}, opts = {})
request_stripe_object(
method: :post,
path: "/v1/checkout/sessions",
params: params,
opts: opts
)
end
# Returns a list of Checkout Sessions.
def self.list(filters = {}, opts = {})
request_stripe_object(
@ -89,6 +69,26 @@ module Stripe
opts: opts
)
end
# When retrieving a Checkout Session, there is an includable line_items property containing the first handful of those items. There is also a URL where you can retrieve the full (paginated) list of line items.
def list_line_items(params = {}, opts = {})
request_stripe_object(
method: :get,
path: format("/v1/checkout/sessions/%<session>s/line_items", { session: CGI.escape(self["id"]) }),
params: params,
opts: opts
)
end
# When retrieving a Checkout Session, there is an includable line_items property containing the first handful of those items. There is also a URL where you can retrieve the full (paginated) list of line items.
def self.list_line_items(session, params = {}, opts = {})
request_stripe_object(
method: :get,
path: format("/v1/checkout/sessions/%<session>s/line_items", { session: CGI.escape(session) }),
params: params,
opts: opts
)
end
end
end
end

View File

@ -15,46 +15,6 @@ module Stripe
"credit_note"
end
# Marks a credit note as void. Learn more about [voiding credit notes](https://stripe.com/docs/billing/invoices/credit-notes#voiding).
def void_credit_note(params = {}, opts = {})
request_stripe_object(
method: :post,
path: format("/v1/credit_notes/%<id>s/void", { id: CGI.escape(self["id"]) }),
params: params,
opts: opts
)
end
# When retrieving a credit note preview, you'll get a lines property containing the first handful of those items. This URL you can retrieve the full (paginated) list of line items.
def self.list_preview_line_items(params = {}, opts = {})
request_stripe_object(
method: :get,
path: "/v1/credit_notes/preview/lines",
params: params,
opts: opts
)
end
# Get a preview of a credit note without creating it.
def self.preview(params = {}, opts = {})
request_stripe_object(
method: :get,
path: "/v1/credit_notes/preview",
params: params,
opts: opts
)
end
# Marks a credit note as void. Learn more about [voiding credit notes](https://stripe.com/docs/billing/invoices/credit-notes#voiding).
def self.void_credit_note(id, params = {}, opts = {})
request_stripe_object(
method: :post,
path: format("/v1/credit_notes/%<id>s/void", { id: CGI.escape(id) }),
params: params,
opts: opts
)
end
# Issue a credit note to adjust the amount of a finalized invoice. For a status=open invoice, a credit note reduces
# its amount_due. For a status=paid invoice, a credit note does not affect its amount_due. Instead, it can result
# in any combination of the following:
@ -78,6 +38,26 @@ module Stripe
request_stripe_object(method: :get, path: "/v1/credit_notes", params: filters, opts: opts)
end
# When retrieving a credit note preview, you'll get a lines property containing the first handful of those items. This URL you can retrieve the full (paginated) list of line items.
def self.list_preview_line_items(params = {}, opts = {})
request_stripe_object(
method: :get,
path: "/v1/credit_notes/preview/lines",
params: params,
opts: opts
)
end
# Get a preview of a credit note without creating it.
def self.preview(params = {}, opts = {})
request_stripe_object(
method: :get,
path: "/v1/credit_notes/preview",
params: params,
opts: opts
)
end
# Updates an existing credit note.
def self.update(id, params = {}, opts = {})
request_stripe_object(
@ -87,5 +67,25 @@ module Stripe
opts: opts
)
end
# Marks a credit note as void. Learn more about [voiding credit notes](https://stripe.com/docs/billing/invoices/credit-notes#voiding).
def void_credit_note(params = {}, opts = {})
request_stripe_object(
method: :post,
path: format("/v1/credit_notes/%<id>s/void", { id: CGI.escape(self["id"]) }),
params: params,
opts: opts
)
end
# Marks a credit note as void. Learn more about [voiding credit notes](https://stripe.com/docs/billing/invoices/credit-notes#voiding).
def self.void_credit_note(id, params = {}, opts = {})
request_stripe_object(
method: :post,
path: format("/v1/credit_notes/%<id>s/void", { id: CGI.escape(id) }),
params: params,
opts: opts
)
end
end
end

View File

@ -23,6 +23,11 @@ module Stripe
nested_resource_class_methods :source, operations: %i[create retrieve update delete list]
nested_resource_class_methods :tax_id, operations: %i[create retrieve delete list]
# Creates a new customer object.
def self.create(params = {}, opts = {})
request_stripe_object(method: :post, path: "/v1/customers", params: params, opts: opts)
end
# Retrieve funding instructions for a customer cash balance. If funding instructions do not yet exist for the customer, new
# funding instructions will be created. If funding instructions have already been created for a given customer, the same
# funding instructions will be retrieved. In other words, we will return the same funding instructions each time.
@ -35,36 +40,6 @@ module Stripe
)
end
# Removes the currently applied discount on a customer.
def delete_discount(params = {}, opts = {})
request_stripe_object(
method: :delete,
path: format("/v1/customers/%<customer>s/discount", { customer: CGI.escape(self["id"]) }),
params: params,
opts: opts
)
end
# Returns a list of PaymentMethods for a given Customer
def list_payment_methods(params = {}, opts = {})
request_stripe_object(
method: :get,
path: format("/v1/customers/%<customer>s/payment_methods", { customer: CGI.escape(self["id"]) }),
params: params,
opts: opts
)
end
# Retrieves a PaymentMethod object for a given Customer.
def retrieve_payment_method(payment_method, params = {}, opts = {})
request_stripe_object(
method: :get,
path: format("/v1/customers/%<customer>s/payment_methods/%<payment_method>s", { customer: CGI.escape(self["id"]), payment_method: CGI.escape(payment_method) }),
params: params,
opts: opts
)
end
# Retrieve funding instructions for a customer cash balance. If funding instructions do not yet exist for the customer, new
# funding instructions will be created. If funding instructions have already been created for a given customer, the same
# funding instructions will be retrieved. In other words, we will return the same funding instructions each time.
@ -77,49 +52,6 @@ module Stripe
)
end
# Removes the currently applied discount on a customer.
def self.delete_discount(customer, params = {}, opts = {})
request_stripe_object(
method: :delete,
path: format("/v1/customers/%<customer>s/discount", { customer: CGI.escape(customer) }),
params: params,
opts: opts
)
end
# Returns a list of PaymentMethods for a given Customer
def self.list_payment_methods(customer, params = {}, opts = {})
request_stripe_object(
method: :get,
path: format("/v1/customers/%<customer>s/payment_methods", { customer: CGI.escape(customer) }),
params: params,
opts: opts
)
end
# Retrieves a PaymentMethod object for a given Customer.
def self.retrieve_payment_method(customer, payment_method, params = {}, opts = {})
request_stripe_object(
method: :get,
path: format("/v1/customers/%<customer>s/payment_methods/%<payment_method>s", { customer: CGI.escape(customer), payment_method: CGI.escape(payment_method) }),
params: params,
opts: opts
)
end
save_nested_resource :source
# The API request for deleting a card or bank account and for detaching a
# source object are the same.
class << self
alias detach_source delete_source
end
# Creates a new customer object.
def self.create(params = {}, opts = {})
request_stripe_object(method: :post, path: "/v1/customers", params: params, opts: opts)
end
# Permanently deletes a customer. It cannot be undone. Also immediately cancels any active subscriptions on the customer.
def self.delete(id, params = {}, opts = {})
request_stripe_object(
@ -140,11 +72,81 @@ module Stripe
)
end
# Removes the currently applied discount on a customer.
def delete_discount(params = {}, opts = {})
request_stripe_object(
method: :delete,
path: format("/v1/customers/%<customer>s/discount", { customer: CGI.escape(self["id"]) }),
params: params,
opts: opts
)
end
# Removes the currently applied discount on a customer.
def self.delete_discount(customer, params = {}, opts = {})
request_stripe_object(
method: :delete,
path: format("/v1/customers/%<customer>s/discount", { customer: CGI.escape(customer) }),
params: params,
opts: opts
)
end
# Returns a list of your customers. The customers are returned sorted by creation date, with the most recent customers appearing first.
def self.list(filters = {}, opts = {})
request_stripe_object(method: :get, path: "/v1/customers", params: filters, opts: opts)
end
# Returns a list of PaymentMethods for a given Customer
def list_payment_methods(params = {}, opts = {})
request_stripe_object(
method: :get,
path: format("/v1/customers/%<customer>s/payment_methods", { customer: CGI.escape(self["id"]) }),
params: params,
opts: opts
)
end
# Returns a list of PaymentMethods for a given Customer
def self.list_payment_methods(customer, params = {}, opts = {})
request_stripe_object(
method: :get,
path: format("/v1/customers/%<customer>s/payment_methods", { customer: CGI.escape(customer) }),
params: params,
opts: opts
)
end
# Retrieves a customer's cash balance.
def self.retrieve_cash_balance(customer, params = {}, opts = {})
request_stripe_object(
method: :get,
path: format("/v1/customers/%<customer>s/cash_balance", { customer: CGI.escape(customer) }),
params: params,
opts: opts
)
end
# Retrieves a PaymentMethod object for a given Customer.
def retrieve_payment_method(payment_method, params = {}, opts = {})
request_stripe_object(
method: :get,
path: format("/v1/customers/%<customer>s/payment_methods/%<payment_method>s", { customer: CGI.escape(self["id"]), payment_method: CGI.escape(payment_method) }),
params: params,
opts: opts
)
end
# Retrieves a PaymentMethod object for a given Customer.
def self.retrieve_payment_method(customer, payment_method, params = {}, opts = {})
request_stripe_object(
method: :get,
path: format("/v1/customers/%<customer>s/payment_methods/%<payment_method>s", { customer: CGI.escape(customer), payment_method: CGI.escape(payment_method) }),
params: params,
opts: opts
)
end
def self.search(params = {}, opts = {})
request_stripe_object(method: :get, path: "/v1/customers/search", params: params, opts: opts)
end
@ -165,16 +167,6 @@ module Stripe
)
end
# Retrieves a customer's cash balance.
def self.retrieve_cash_balance(customer, params = {}, opts = {})
request_stripe_object(
method: :get,
path: format("/v1/customers/%<customer>s/cash_balance", { customer: CGI.escape(customer) }),
params: params,
opts: opts
)
end
# Changes the settings on a customer's cash balance.
def self.update_cash_balance(customer, params = {}, opts = {})
request_stripe_object(
@ -185,6 +177,14 @@ module Stripe
)
end
save_nested_resource :source
# The API request for deleting a card or bank account and for detaching a
# source object are the same.
class << self
alias detach_source delete_source
end
def test_helpers
TestHelpers.new(self)
end

View File

@ -11,15 +11,6 @@ module Stripe
"ephemeral_key"
end
def self.create(params = {}, opts = {})
opts = Util.normalize_opts(opts)
unless opts[:stripe_version]
raise ArgumentError,
"stripe_version must be specified to create an ephemeral key"
end
super
end
# Invalidates a short-lived API key for a given resource.
def self.delete(id, params = {}, opts = {})
request_stripe_object(
@ -39,5 +30,14 @@ module Stripe
opts: opts
)
end
def self.create(params = {}, opts = {})
opts = Util.normalize_opts(opts)
unless opts[:stripe_version]
raise ArgumentError,
"stripe_version must be specified to create an ephemeral key"
end
super
end
end
end

View File

@ -18,6 +18,11 @@ module Stripe
"file"
end
# Returns a list of the files that your account has access to. Stripe sorts and returns the files by their creation dates, placing the most recently created files at the top.
def self.list(filters = {}, opts = {})
request_stripe_object(method: :get, path: "/v1/files", params: filters, opts: opts)
end
# This resource can have two different object names. In latter API
# versions, only `file` is used, but since stripe-ruby may be used with
# any API version, we need to support deserializing the older
@ -43,10 +48,5 @@ module Stripe
}.merge(Util.normalize_opts(opts))
super
end
# Returns a list of the files that your account has access to. Stripe sorts and returns the files by their creation dates, placing the most recently created files at the top.
def self.list(filters = {}, opts = {})
request_stripe_object(method: :get, path: "/v1/files", params: filters, opts: opts)
end
end
end

View File

@ -22,46 +22,6 @@ module Stripe
)
end
# Lists all owners for a given Account
def list_owners(params = {}, opts = {})
request_stripe_object(
method: :get,
path: format("/v1/financial_connections/accounts/%<account>s/owners", { account: CGI.escape(self["id"]) }),
params: params,
opts: opts
)
end
# Refreshes the data associated with a Financial Connections Account.
def refresh_account(params = {}, opts = {})
request_stripe_object(
method: :post,
path: format("/v1/financial_connections/accounts/%<account>s/refresh", { account: CGI.escape(self["id"]) }),
params: params,
opts: opts
)
end
# Subscribes to periodic refreshes of data associated with a Financial Connections Account.
def subscribe(params = {}, opts = {})
request_stripe_object(
method: :post,
path: format("/v1/financial_connections/accounts/%<account>s/subscribe", { account: CGI.escape(self["id"]) }),
params: params,
opts: opts
)
end
# Unsubscribes from periodic refreshes of data associated with a Financial Connections Account.
def unsubscribe(params = {}, opts = {})
request_stripe_object(
method: :post,
path: format("/v1/financial_connections/accounts/%<account>s/unsubscribe", { account: CGI.escape(self["id"]) }),
params: params,
opts: opts
)
end
# Disables your access to a Financial Connections Account. You will no longer be able to access data associated with the account (e.g. balances, transactions).
def self.disconnect(account, params = {}, opts = {})
request_stripe_object(
@ -72,6 +32,26 @@ module Stripe
)
end
# Returns a list of Financial Connections Account objects.
def self.list(filters = {}, opts = {})
request_stripe_object(
method: :get,
path: "/v1/financial_connections/accounts",
params: filters,
opts: opts
)
end
# Lists all owners for a given Account
def list_owners(params = {}, opts = {})
request_stripe_object(
method: :get,
path: format("/v1/financial_connections/accounts/%<account>s/owners", { account: CGI.escape(self["id"]) }),
params: params,
opts: opts
)
end
# Lists all owners for a given Account
def self.list_owners(account, params = {}, opts = {})
request_stripe_object(
@ -82,6 +62,16 @@ module Stripe
)
end
# Refreshes the data associated with a Financial Connections Account.
def refresh_account(params = {}, opts = {})
request_stripe_object(
method: :post,
path: format("/v1/financial_connections/accounts/%<account>s/refresh", { account: CGI.escape(self["id"]) }),
params: params,
opts: opts
)
end
# Refreshes the data associated with a Financial Connections Account.
def self.refresh_account(account, params = {}, opts = {})
request_stripe_object(
@ -92,6 +82,16 @@ module Stripe
)
end
# Subscribes to periodic refreshes of data associated with a Financial Connections Account.
def subscribe(params = {}, opts = {})
request_stripe_object(
method: :post,
path: format("/v1/financial_connections/accounts/%<account>s/subscribe", { account: CGI.escape(self["id"]) }),
params: params,
opts: opts
)
end
# Subscribes to periodic refreshes of data associated with a Financial Connections Account.
def self.subscribe(account, params = {}, opts = {})
request_stripe_object(
@ -102,6 +102,16 @@ module Stripe
)
end
# Unsubscribes from periodic refreshes of data associated with a Financial Connections Account.
def unsubscribe(params = {}, opts = {})
request_stripe_object(
method: :post,
path: format("/v1/financial_connections/accounts/%<account>s/unsubscribe", { account: CGI.escape(self["id"]) }),
params: params,
opts: opts
)
end
# Unsubscribes from periodic refreshes of data associated with a Financial Connections Account.
def self.unsubscribe(account, params = {}, opts = {})
request_stripe_object(
@ -111,16 +121,6 @@ module Stripe
opts: opts
)
end
# Returns a list of Financial Connections Account objects.
def self.list(filters = {}, opts = {})
request_stripe_object(
method: :get,
path: "/v1/financial_connections/accounts",
params: filters,
opts: opts
)
end
end
end
end

View File

@ -36,6 +36,44 @@ module Stripe
)
end
# A VerificationSession object can be canceled when it is in requires_input [status](https://stripe.com/docs/identity/how-sessions-work).
#
# Once canceled, future submission attempts are disabled. This cannot be undone. [Learn more](https://stripe.com/docs/identity/verification-sessions#cancel).
def self.cancel(session, params = {}, opts = {})
request_stripe_object(
method: :post,
path: format("/v1/identity/verification_sessions/%<session>s/cancel", { session: CGI.escape(session) }),
params: params,
opts: opts
)
end
# Creates a VerificationSession object.
#
# After the VerificationSession is created, display a verification modal using the session client_secret or send your users to the session's url.
#
# If your API key is in test mode, verification checks won't actually process, though everything else will occur as if in live mode.
#
# Related guide: [Verify your users' identity documents](https://stripe.com/docs/identity/verify-identity-documents)
def self.create(params = {}, opts = {})
request_stripe_object(
method: :post,
path: "/v1/identity/verification_sessions",
params: params,
opts: opts
)
end
# Returns a list of VerificationSessions
def self.list(filters = {}, opts = {})
request_stripe_object(
method: :get,
path: "/v1/identity/verification_sessions",
params: filters,
opts: opts
)
end
# Redact a VerificationSession to remove all collected information from Stripe. This will redact
# the VerificationSession and all objects related to it, including VerificationReports, Events,
# request logs, etc.
@ -64,18 +102,6 @@ module Stripe
)
end
# A VerificationSession object can be canceled when it is in requires_input [status](https://stripe.com/docs/identity/how-sessions-work).
#
# Once canceled, future submission attempts are disabled. This cannot be undone. [Learn more](https://stripe.com/docs/identity/verification-sessions#cancel).
def self.cancel(session, params = {}, opts = {})
request_stripe_object(
method: :post,
path: format("/v1/identity/verification_sessions/%<session>s/cancel", { session: CGI.escape(session) }),
params: params,
opts: opts
)
end
# Redact a VerificationSession to remove all collected information from Stripe. This will redact
# the VerificationSession and all objects related to it, including VerificationReports, Events,
# request logs, etc.
@ -104,32 +130,6 @@ module Stripe
)
end
# Creates a VerificationSession object.
#
# After the VerificationSession is created, display a verification modal using the session client_secret or send your users to the session's url.
#
# If your API key is in test mode, verification checks won't actually process, though everything else will occur as if in live mode.
#
# Related guide: [Verify your users' identity documents](https://stripe.com/docs/identity/verify-identity-documents)
def self.create(params = {}, opts = {})
request_stripe_object(
method: :post,
path: "/v1/identity/verification_sessions",
params: params,
opts: opts
)
end
# Returns a list of VerificationSessions
def self.list(filters = {}, opts = {})
request_stripe_object(
method: :get,
path: "/v1/identity/verification_sessions",
params: filters,
opts: opts
)
end
# Updates a VerificationSession object.
#
# When the session status is requires_input, you can use this method to update the

View File

@ -46,6 +46,31 @@ module Stripe
"invoice"
end
# This endpoint creates a draft invoice for a given customer. The invoice remains a draft until you [finalize the invoice, which allows you to [pay](#pay_invoice) or <a href="#send_invoice">send](https://stripe.com/docs/api#finalize_invoice) the invoice to your customers.
def self.create(params = {}, opts = {})
request_stripe_object(method: :post, path: "/v1/invoices", params: params, opts: opts)
end
# Permanently deletes a one-off invoice draft. This cannot be undone. Attempts to delete invoices that are no longer in a draft state will fail; once an invoice has been finalized or if an invoice is for a subscription, it must be [voided](https://stripe.com/docs/api#void_invoice).
def self.delete(id, params = {}, opts = {})
request_stripe_object(
method: :delete,
path: format("/v1/invoices/%<id>s", { id: CGI.escape(id) }),
params: params,
opts: opts
)
end
# Permanently deletes a one-off invoice draft. This cannot be undone. Attempts to delete invoices that are no longer in a draft state will fail; once an invoice has been finalized or if an invoice is for a subscription, it must be [voided](https://stripe.com/docs/api#void_invoice).
def delete(params = {}, opts = {})
request_stripe_object(
method: :delete,
path: format("/v1/invoices/%<invoice>s", { invoice: CGI.escape(self["id"]) }),
params: params,
opts: opts
)
end
# Stripe automatically finalizes drafts before sending and attempting payment on invoices. However, if you'd like to finalize a draft invoice manually, you can do so using this method.
def finalize_invoice(params = {}, opts = {})
request_stripe_object(
@ -56,48 +81,6 @@ module Stripe
)
end
# Marking an invoice as uncollectible is useful for keeping track of bad debts that can be written off for accounting purposes.
def mark_uncollectible(params = {}, opts = {})
request_stripe_object(
method: :post,
path: format("/v1/invoices/%<invoice>s/mark_uncollectible", { invoice: CGI.escape(self["id"]) }),
params: params,
opts: opts
)
end
# Stripe automatically creates and then attempts to collect payment on invoices for customers on subscriptions according to your [subscriptions settings](https://dashboard.stripe.com/account/billing/automatic). However, if you'd like to attempt payment on an invoice out of the normal collection schedule or for some other reason, you can do so.
def pay(params = {}, opts = {})
request_stripe_object(
method: :post,
path: format("/v1/invoices/%<invoice>s/pay", { invoice: CGI.escape(self["id"]) }),
params: params,
opts: opts
)
end
# Stripe will automatically send invoices to customers according to your [subscriptions settings](https://dashboard.stripe.com/account/billing/automatic). However, if you'd like to manually send an invoice to your customer out of the normal schedule, you can do so. When sending invoices that have already been paid, there will be no reference to the payment in the email.
#
# Requests made in test-mode result in no emails being sent, despite sending an invoice.sent event.
def send_invoice(params = {}, opts = {})
request_stripe_object(
method: :post,
path: format("/v1/invoices/%<invoice>s/send", { invoice: CGI.escape(self["id"]) }),
params: params,
opts: opts
)
end
# Mark a finalized invoice as void. This cannot be undone. Voiding an invoice is similar to [deletion](https://stripe.com/docs/api#delete_invoice), however it only applies to finalized invoices and maintains a papertrail where the invoice can still be found.
def void_invoice(params = {}, opts = {})
request_stripe_object(
method: :post,
path: format("/v1/invoices/%<invoice>s/void", { invoice: CGI.escape(self["id"]) }),
params: params,
opts: opts
)
end
# Stripe automatically finalizes drafts before sending and attempting payment on invoices. However, if you'd like to finalize a draft invoice manually, you can do so using this method.
def self.finalize_invoice(invoice, params = {}, opts = {})
request_stripe_object(
@ -108,6 +91,11 @@ module Stripe
)
end
# You can list all invoices, or list the invoices for a specific customer. The invoices are returned sorted by creation date, with the most recently created invoices appearing first.
def self.list(filters = {}, opts = {})
request_stripe_object(method: :get, path: "/v1/invoices", params: filters, opts: opts)
end
# When retrieving an upcoming invoice, you'll get a lines property containing the total count of line items and the first handful of those items. There is also a URL where you can retrieve the full (paginated) list of line items.
def self.list_upcoming_line_items(params = {}, opts = {})
request_stripe_object(
@ -118,6 +106,16 @@ module Stripe
)
end
# Marking an invoice as uncollectible is useful for keeping track of bad debts that can be written off for accounting purposes.
def mark_uncollectible(params = {}, opts = {})
request_stripe_object(
method: :post,
path: format("/v1/invoices/%<invoice>s/mark_uncollectible", { invoice: CGI.escape(self["id"]) }),
params: params,
opts: opts
)
end
# Marking an invoice as uncollectible is useful for keeping track of bad debts that can be written off for accounting purposes.
def self.mark_uncollectible(invoice, params = {}, opts = {})
request_stripe_object(
@ -128,6 +126,16 @@ module Stripe
)
end
# Stripe automatically creates and then attempts to collect payment on invoices for customers on subscriptions according to your [subscriptions settings](https://dashboard.stripe.com/account/billing/automatic). However, if you'd like to attempt payment on an invoice out of the normal collection schedule or for some other reason, you can do so.
def pay(params = {}, opts = {})
request_stripe_object(
method: :post,
path: format("/v1/invoices/%<invoice>s/pay", { invoice: CGI.escape(self["id"]) }),
params: params,
opts: opts
)
end
# Stripe automatically creates and then attempts to collect payment on invoices for customers on subscriptions according to your [subscriptions settings](https://dashboard.stripe.com/account/billing/automatic). However, if you'd like to attempt payment on an invoice out of the normal collection schedule or for some other reason, you can do so.
def self.pay(invoice, params = {}, opts = {})
request_stripe_object(
@ -138,6 +146,26 @@ module Stripe
)
end
def self.search(params = {}, opts = {})
request_stripe_object(method: :get, path: "/v1/invoices/search", params: params, opts: opts)
end
def self.search_auto_paging_each(params = {}, opts = {}, &blk)
search(params, opts).auto_paging_each(&blk)
end
# Stripe will automatically send invoices to customers according to your [subscriptions settings](https://dashboard.stripe.com/account/billing/automatic). However, if you'd like to manually send an invoice to your customer out of the normal schedule, you can do so. When sending invoices that have already been paid, there will be no reference to the payment in the email.
#
# Requests made in test-mode result in no emails being sent, despite sending an invoice.sent event.
def send_invoice(params = {}, opts = {})
request_stripe_object(
method: :post,
path: format("/v1/invoices/%<invoice>s/send", { invoice: CGI.escape(self["id"]) }),
params: params,
opts: opts
)
end
# Stripe will automatically send invoices to customers according to your [subscriptions settings](https://dashboard.stripe.com/account/billing/automatic). However, if you'd like to manually send an invoice to your customer out of the normal schedule, you can do so. When sending invoices that have already been paid, there will be no reference to the payment in the email.
#
# Requests made in test-mode result in no emails being sent, despite sending an invoice.sent event.
@ -159,54 +187,6 @@ module Stripe
request_stripe_object(method: :get, path: "/v1/invoices/upcoming", params: params, opts: opts)
end
# Mark a finalized invoice as void. This cannot be undone. Voiding an invoice is similar to [deletion](https://stripe.com/docs/api#delete_invoice), however it only applies to finalized invoices and maintains a papertrail where the invoice can still be found.
def self.void_invoice(invoice, params = {}, opts = {})
request_stripe_object(
method: :post,
path: format("/v1/invoices/%<invoice>s/void", { invoice: CGI.escape(invoice) }),
params: params,
opts: opts
)
end
# This endpoint creates a draft invoice for a given customer. The invoice remains a draft until you [finalize the invoice, which allows you to [pay](#pay_invoice) or <a href="#send_invoice">send](https://stripe.com/docs/api#finalize_invoice) the invoice to your customers.
def self.create(params = {}, opts = {})
request_stripe_object(method: :post, path: "/v1/invoices", params: params, opts: opts)
end
# Permanently deletes a one-off invoice draft. This cannot be undone. Attempts to delete invoices that are no longer in a draft state will fail; once an invoice has been finalized or if an invoice is for a subscription, it must be [voided](https://stripe.com/docs/api#void_invoice).
def self.delete(id, params = {}, opts = {})
request_stripe_object(
method: :delete,
path: format("/v1/invoices/%<id>s", { id: CGI.escape(id) }),
params: params,
opts: opts
)
end
# Permanently deletes a one-off invoice draft. This cannot be undone. Attempts to delete invoices that are no longer in a draft state will fail; once an invoice has been finalized or if an invoice is for a subscription, it must be [voided](https://stripe.com/docs/api#void_invoice).
def delete(params = {}, opts = {})
request_stripe_object(
method: :delete,
path: format("/v1/invoices/%<invoice>s", { invoice: CGI.escape(self["id"]) }),
params: params,
opts: opts
)
end
# You can list all invoices, or list the invoices for a specific customer. The invoices are returned sorted by creation date, with the most recently created invoices appearing first.
def self.list(filters = {}, opts = {})
request_stripe_object(method: :get, path: "/v1/invoices", params: filters, opts: opts)
end
def self.search(params = {}, opts = {})
request_stripe_object(method: :get, path: "/v1/invoices/search", params: params, opts: opts)
end
def self.search_auto_paging_each(params = {}, opts = {}, &blk)
search(params, opts).auto_paging_each(&blk)
end
# Draft invoices are fully editable. Once an invoice is [finalized](https://stripe.com/docs/billing/invoices/workflow#finalized),
# monetary values, as well as collection_method, become uneditable.
#
@ -221,5 +201,25 @@ module Stripe
opts: opts
)
end
# Mark a finalized invoice as void. This cannot be undone. Voiding an invoice is similar to [deletion](https://stripe.com/docs/api#delete_invoice), however it only applies to finalized invoices and maintains a papertrail where the invoice can still be found.
def void_invoice(params = {}, opts = {})
request_stripe_object(
method: :post,
path: format("/v1/invoices/%<invoice>s/void", { invoice: CGI.escape(self["id"]) }),
params: params,
opts: opts
)
end
# Mark a finalized invoice as void. This cannot be undone. Voiding an invoice is similar to [deletion](https://stripe.com/docs/api#delete_invoice), however it only applies to finalized invoices and maintains a papertrail where the invoice can still be found.
def self.void_invoice(invoice, params = {}, opts = {})
request_stripe_object(
method: :post,
path: format("/v1/invoices/%<invoice>s/void", { invoice: CGI.escape(invoice) }),
params: params,
opts: opts
)
end
end
end

View File

@ -28,17 +28,6 @@ module Stripe
)
end
# [Deprecated] Declines a pending Issuing Authorization object. This request should be made within the timeout window of the [real time authorization](https://stripe.com/docs/issuing/controls/real-time-authorizations) flow.
# This method is deprecated. Instead, [respond directly to the webhook request to decline an authorization](https://stripe.com/docs/issuing/controls/real-time-authorizations#authorization-handling).
def decline(params = {}, opts = {})
request_stripe_object(
method: :post,
path: format("/v1/issuing/authorizations/%<authorization>s/decline", { authorization: CGI.escape(self["id"]) }),
params: params,
opts: opts
)
end
# [Deprecated] Approves a pending Issuing Authorization object. This request should be made within the timeout window of the [real-time authorization](https://stripe.com/docs/issuing/controls/real-time-authorizations) flow.
# This method is deprecated. Instead, [respond directly to the webhook request to approve an authorization](https://stripe.com/docs/issuing/controls/real-time-authorizations#authorization-handling).
def self.approve(authorization, params = {}, opts = {})
@ -50,6 +39,17 @@ module Stripe
)
end
# [Deprecated] Declines a pending Issuing Authorization object. This request should be made within the timeout window of the [real time authorization](https://stripe.com/docs/issuing/controls/real-time-authorizations) flow.
# This method is deprecated. Instead, [respond directly to the webhook request to decline an authorization](https://stripe.com/docs/issuing/controls/real-time-authorizations#authorization-handling).
def decline(params = {}, opts = {})
request_stripe_object(
method: :post,
path: format("/v1/issuing/authorizations/%<authorization>s/decline", { authorization: CGI.escape(self["id"]) }),
params: params,
opts: opts
)
end
# [Deprecated] Declines a pending Issuing Authorization object. This request should be made within the timeout window of the [real time authorization](https://stripe.com/docs/issuing/controls/real-time-authorizations) flow.
# This method is deprecated. Instead, [respond directly to the webhook request to decline an authorization](https://stripe.com/docs/issuing/controls/real-time-authorizations#authorization-handling).
def self.decline(authorization, params = {}, opts = {})

View File

@ -16,26 +16,6 @@ module Stripe
"issuing.dispute"
end
# Submits an Issuing Dispute to the card network. Stripe validates that all evidence fields required for the dispute's reason are present. For more details, see [Dispute reasons and evidence](https://stripe.com/docs/issuing/purchases/disputes#dispute-reasons-and-evidence).
def submit(params = {}, opts = {})
request_stripe_object(
method: :post,
path: format("/v1/issuing/disputes/%<dispute>s/submit", { dispute: CGI.escape(self["id"]) }),
params: params,
opts: opts
)
end
# Submits an Issuing Dispute to the card network. Stripe validates that all evidence fields required for the dispute's reason are present. For more details, see [Dispute reasons and evidence](https://stripe.com/docs/issuing/purchases/disputes#dispute-reasons-and-evidence).
def self.submit(dispute, params = {}, opts = {})
request_stripe_object(
method: :post,
path: format("/v1/issuing/disputes/%<dispute>s/submit", { dispute: CGI.escape(dispute) }),
params: params,
opts: opts
)
end
# Creates an Issuing Dispute object. Individual pieces of evidence within the evidence object are optional at this point. Stripe only validates that required evidence is present during submission. Refer to [Dispute reasons and evidence](https://stripe.com/docs/issuing/purchases/disputes#dispute-reasons-and-evidence) for more details about evidence requirements.
def self.create(params = {}, opts = {})
request_stripe_object(
@ -56,6 +36,26 @@ module Stripe
)
end
# Submits an Issuing Dispute to the card network. Stripe validates that all evidence fields required for the dispute's reason are present. For more details, see [Dispute reasons and evidence](https://stripe.com/docs/issuing/purchases/disputes#dispute-reasons-and-evidence).
def submit(params = {}, opts = {})
request_stripe_object(
method: :post,
path: format("/v1/issuing/disputes/%<dispute>s/submit", { dispute: CGI.escape(self["id"]) }),
params: params,
opts: opts
)
end
# Submits an Issuing Dispute to the card network. Stripe validates that all evidence fields required for the dispute's reason are present. For more details, see [Dispute reasons and evidence](https://stripe.com/docs/issuing/purchases/disputes#dispute-reasons-and-evidence).
def self.submit(dispute, params = {}, opts = {})
request_stripe_object(
method: :post,
path: format("/v1/issuing/disputes/%<dispute>s/submit", { dispute: CGI.escape(dispute) }),
params: params,
opts: opts
)
end
# Updates the specified Issuing Dispute object by setting the values of the parameters passed. Any parameters not provided will be left unchanged. Properties on the evidence object can be unset by passing in an empty string.
def self.update(id, params = {}, opts = {})
request_stripe_object(

View File

@ -34,108 +34,6 @@ module Stripe
)
end
# You can cancel a PaymentIntent object when it's in one of these statuses: requires_payment_method, requires_capture, requires_confirmation, requires_action or, [in rare cases](https://stripe.com/docs/payments/intents), processing.
#
# After it's canceled, no additional charges are made by the PaymentIntent and any operations on the PaymentIntent fail with an error. For PaymentIntents with a status of requires_capture, the remaining amount_capturable is automatically refunded.
#
# You can't cancel the PaymentIntent for a Checkout Session. [Expire the Checkout Session](https://stripe.com/docs/api/checkout/sessions/expire) instead.
def cancel(params = {}, opts = {})
request_stripe_object(
method: :post,
path: format("/v1/payment_intents/%<intent>s/cancel", { intent: CGI.escape(self["id"]) }),
params: params,
opts: opts
)
end
# Capture the funds of an existing uncaptured PaymentIntent when its status is requires_capture.
#
# Uncaptured PaymentIntents are cancelled a set number of days (7 by default) after their creation.
#
# Learn more about [separate authorization and capture](https://stripe.com/docs/payments/capture-later).
def capture(params = {}, opts = {})
request_stripe_object(
method: :post,
path: format("/v1/payment_intents/%<intent>s/capture", { intent: CGI.escape(self["id"]) }),
params: params,
opts: opts
)
end
# Confirm that your customer intends to pay with current or provided
# payment method. Upon confirmation, the PaymentIntent will attempt to initiate
# a payment.
# If the selected payment method requires additional authentication steps, the
# PaymentIntent will transition to the requires_action status and
# suggest additional actions via next_action. If payment fails,
# the PaymentIntent transitions to the requires_payment_method status or the
# canceled status if the confirmation limit is reached. If
# payment succeeds, the PaymentIntent will transition to the succeeded
# status (or requires_capture, if capture_method is set to manual).
# If the confirmation_method is automatic, payment may be attempted
# using our [client SDKs](https://stripe.com/docs/stripe-js/reference#stripe-handle-card-payment)
# and the PaymentIntent's [client_secret](https://stripe.com/docs/api#payment_intent_object-client_secret).
# After next_actions are handled by the client, no additional
# confirmation is required to complete the payment.
# If the confirmation_method is manual, all payment attempts must be
# initiated using a secret key.
# If any actions are required for the payment, the PaymentIntent will
# return to the requires_confirmation state
# after those actions are completed. Your server needs to then
# explicitly re-confirm the PaymentIntent to initiate the next payment
# attempt.
def confirm(params = {}, opts = {})
request_stripe_object(
method: :post,
path: format("/v1/payment_intents/%<intent>s/confirm", { intent: CGI.escape(self["id"]) }),
params: params,
opts: opts
)
end
# Perform an incremental authorization on an eligible
# [PaymentIntent](https://stripe.com/docs/api/payment_intents/object). To be eligible, the
# PaymentIntent's status must be requires_capture and
# [incremental_authorization_supported](https://stripe.com/docs/api/charges/object#charge_object-payment_method_details-card_present-incremental_authorization_supported)
# must be true.
#
# Incremental authorizations attempt to increase the authorized amount on
# your customer's card to the new, higher amount provided. Similar to the
# initial authorization, incremental authorizations can be declined. A
# single PaymentIntent can call this endpoint multiple times to further
# increase the authorized amount.
#
# If the incremental authorization succeeds, the PaymentIntent object
# returns with the updated
# [amount](https://stripe.com/docs/api/payment_intents/object#payment_intent_object-amount).
# If the incremental authorization fails, a
# [card_declined](https://stripe.com/docs/error-codes#card-declined) error returns, and no other
# fields on the PaymentIntent or Charge update. The PaymentIntent
# object remains capturable for the previously authorized amount.
#
# Each PaymentIntent can have a maximum of 10 incremental authorization attempts, including declines.
# After it's captured, a PaymentIntent can no longer be incremented.
#
# Learn more about [incremental authorizations](https://stripe.com/docs/terminal/features/incremental-authorizations).
def increment_authorization(params = {}, opts = {})
request_stripe_object(
method: :post,
path: format("/v1/payment_intents/%<intent>s/increment_authorization", { intent: CGI.escape(self["id"]) }),
params: params,
opts: opts
)
end
# Verifies microdeposits on a PaymentIntent object.
def verify_microdeposits(params = {}, opts = {})
request_stripe_object(
method: :post,
path: format("/v1/payment_intents/%<intent>s/verify_microdeposits", { intent: CGI.escape(self["id"]) }),
params: params,
opts: opts
)
end
# Manually reconcile the remaining amount for a customer_balance PaymentIntent.
def self.apply_customer_balance(intent, params = {}, opts = {})
request_stripe_object(
@ -146,6 +44,20 @@ module Stripe
)
end
# You can cancel a PaymentIntent object when it's in one of these statuses: requires_payment_method, requires_capture, requires_confirmation, requires_action or, [in rare cases](https://stripe.com/docs/payments/intents), processing.
#
# After it's canceled, no additional charges are made by the PaymentIntent and any operations on the PaymentIntent fail with an error. For PaymentIntents with a status of requires_capture, the remaining amount_capturable is automatically refunded.
#
# You can't cancel the PaymentIntent for a Checkout Session. [Expire the Checkout Session](https://stripe.com/docs/api/checkout/sessions/expire) instead.
def cancel(params = {}, opts = {})
request_stripe_object(
method: :post,
path: format("/v1/payment_intents/%<intent>s/cancel", { intent: CGI.escape(self["id"]) }),
params: params,
opts: opts
)
end
# You can cancel a PaymentIntent object when it's in one of these statuses: requires_payment_method, requires_capture, requires_confirmation, requires_action or, [in rare cases](https://stripe.com/docs/payments/intents), processing.
#
# After it's canceled, no additional charges are made by the PaymentIntent and any operations on the PaymentIntent fail with an error. For PaymentIntents with a status of requires_capture, the remaining amount_capturable is automatically refunded.
@ -160,6 +72,20 @@ module Stripe
)
end
# Capture the funds of an existing uncaptured PaymentIntent when its status is requires_capture.
#
# Uncaptured PaymentIntents are cancelled a set number of days (7 by default) after their creation.
#
# Learn more about [separate authorization and capture](https://stripe.com/docs/payments/capture-later).
def capture(params = {}, opts = {})
request_stripe_object(
method: :post,
path: format("/v1/payment_intents/%<intent>s/capture", { intent: CGI.escape(self["id"]) }),
params: params,
opts: opts
)
end
# Capture the funds of an existing uncaptured PaymentIntent when its status is requires_capture.
#
# Uncaptured PaymentIntents are cancelled a set number of days (7 by default) after their creation.
@ -174,6 +100,37 @@ module Stripe
)
end
# Confirm that your customer intends to pay with current or provided
# payment method. Upon confirmation, the PaymentIntent will attempt to initiate
# a payment.
# If the selected payment method requires additional authentication steps, the
# PaymentIntent will transition to the requires_action status and
# suggest additional actions via next_action. If payment fails,
# the PaymentIntent transitions to the requires_payment_method status or the
# canceled status if the confirmation limit is reached. If
# payment succeeds, the PaymentIntent will transition to the succeeded
# status (or requires_capture, if capture_method is set to manual).
# If the confirmation_method is automatic, payment may be attempted
# using our [client SDKs](https://stripe.com/docs/stripe-js/reference#stripe-handle-card-payment)
# and the PaymentIntent's [client_secret](https://stripe.com/docs/api#payment_intent_object-client_secret).
# After next_actions are handled by the client, no additional
# confirmation is required to complete the payment.
# If the confirmation_method is manual, all payment attempts must be
# initiated using a secret key.
# If any actions are required for the payment, the PaymentIntent will
# return to the requires_confirmation state
# after those actions are completed. Your server needs to then
# explicitly re-confirm the PaymentIntent to initiate the next payment
# attempt.
def confirm(params = {}, opts = {})
request_stripe_object(
method: :post,
path: format("/v1/payment_intents/%<intent>s/confirm", { intent: CGI.escape(self["id"]) }),
params: params,
opts: opts
)
end
# Confirm that your customer intends to pay with current or provided
# payment method. Upon confirmation, the PaymentIntent will attempt to initiate
# a payment.
@ -205,6 +162,53 @@ module Stripe
)
end
# Creates a PaymentIntent object.
#
# After the PaymentIntent is created, attach a payment method and [confirm](https://stripe.com/docs/api/payment_intents/confirm)
# to continue the payment. Learn more about <a href="/docs/payments/payment-intents">the available payment flows
# with the Payment Intents API.
#
# When you use confirm=true during creation, it's equivalent to creating
# and confirming the PaymentIntent in the same call. You can use any parameters
# available in the [confirm API](https://stripe.com/docs/api/payment_intents/confirm) when you supply
# confirm=true.
def self.create(params = {}, opts = {})
request_stripe_object(method: :post, path: "/v1/payment_intents", params: params, opts: opts)
end
# Perform an incremental authorization on an eligible
# [PaymentIntent](https://stripe.com/docs/api/payment_intents/object). To be eligible, the
# PaymentIntent's status must be requires_capture and
# [incremental_authorization_supported](https://stripe.com/docs/api/charges/object#charge_object-payment_method_details-card_present-incremental_authorization_supported)
# must be true.
#
# Incremental authorizations attempt to increase the authorized amount on
# your customer's card to the new, higher amount provided. Similar to the
# initial authorization, incremental authorizations can be declined. A
# single PaymentIntent can call this endpoint multiple times to further
# increase the authorized amount.
#
# If the incremental authorization succeeds, the PaymentIntent object
# returns with the updated
# [amount](https://stripe.com/docs/api/payment_intents/object#payment_intent_object-amount).
# If the incremental authorization fails, a
# [card_declined](https://stripe.com/docs/error-codes#card-declined) error returns, and no other
# fields on the PaymentIntent or Charge update. The PaymentIntent
# object remains capturable for the previously authorized amount.
#
# Each PaymentIntent can have a maximum of 10 incremental authorization attempts, including declines.
# After it's captured, a PaymentIntent can no longer be incremented.
#
# Learn more about [incremental authorizations](https://stripe.com/docs/terminal/features/incremental-authorizations).
def increment_authorization(params = {}, opts = {})
request_stripe_object(
method: :post,
path: format("/v1/payment_intents/%<intent>s/increment_authorization", { intent: CGI.escape(self["id"]) }),
params: params,
opts: opts
)
end
# Perform an incremental authorization on an eligible
# [PaymentIntent](https://stripe.com/docs/api/payment_intents/object). To be eligible, the
# PaymentIntent's status must be requires_capture and
@ -238,30 +242,6 @@ module Stripe
)
end
# Verifies microdeposits on a PaymentIntent object.
def self.verify_microdeposits(intent, params = {}, opts = {})
request_stripe_object(
method: :post,
path: format("/v1/payment_intents/%<intent>s/verify_microdeposits", { intent: CGI.escape(intent) }),
params: params,
opts: opts
)
end
# Creates a PaymentIntent object.
#
# After the PaymentIntent is created, attach a payment method and [confirm](https://stripe.com/docs/api/payment_intents/confirm)
# to continue the payment. Learn more about <a href="/docs/payments/payment-intents">the available payment flows
# with the Payment Intents API.
#
# When you use confirm=true during creation, it's equivalent to creating
# and confirming the PaymentIntent in the same call. You can use any parameters
# available in the [confirm API](https://stripe.com/docs/api/payment_intents/confirm) when you supply
# confirm=true.
def self.create(params = {}, opts = {})
request_stripe_object(method: :post, path: "/v1/payment_intents", params: params, opts: opts)
end
# Returns a list of PaymentIntents.
def self.list(filters = {}, opts = {})
request_stripe_object(method: :get, path: "/v1/payment_intents", params: filters, opts: opts)
@ -295,5 +275,25 @@ module Stripe
opts: opts
)
end
# Verifies microdeposits on a PaymentIntent object.
def verify_microdeposits(params = {}, opts = {})
request_stripe_object(
method: :post,
path: format("/v1/payment_intents/%<intent>s/verify_microdeposits", { intent: CGI.escape(self["id"]) }),
params: params,
opts: opts
)
end
# Verifies microdeposits on a PaymentIntent object.
def self.verify_microdeposits(intent, params = {}, opts = {})
request_stripe_object(
method: :post,
path: format("/v1/payment_intents/%<intent>s/verify_microdeposits", { intent: CGI.escape(intent) }),
params: params,
opts: opts
)
end
end
end

View File

@ -17,6 +17,16 @@ module Stripe
"payment_link"
end
# Creates a payment link.
def self.create(params = {}, opts = {})
request_stripe_object(method: :post, path: "/v1/payment_links", params: params, opts: opts)
end
# Returns a list of your payment links.
def self.list(filters = {}, opts = {})
request_stripe_object(method: :get, path: "/v1/payment_links", params: filters, opts: opts)
end
# When retrieving a payment link, there is an includable line_items property containing the first handful of those items. There is also a URL where you can retrieve the full (paginated) list of line items.
def list_line_items(params = {}, opts = {})
request_stripe_object(
@ -37,16 +47,6 @@ module Stripe
)
end
# Creates a payment link.
def self.create(params = {}, opts = {})
request_stripe_object(method: :post, path: "/v1/payment_links", params: params, opts: opts)
end
# Returns a list of your payment links.
def self.list(filters = {}, opts = {})
request_stripe_object(method: :get, path: "/v1/payment_links", params: filters, opts: opts)
end
# Updates a payment link.
def self.update(id, params = {}, opts = {})
request_stripe_object(

View File

@ -39,16 +39,6 @@ module Stripe
)
end
# Detaches a PaymentMethod object from a Customer. After a PaymentMethod is detached, it can no longer be used for a payment or re-attached to a Customer.
def detach(params = {}, opts = {})
request_stripe_object(
method: :post,
path: format("/v1/payment_methods/%<payment_method>s/detach", { payment_method: CGI.escape(self["id"]) }),
params: params,
opts: opts
)
end
# Attaches a PaymentMethod object to a Customer.
#
# To attach a new PaymentMethod to a customer for future payments, we recommend you use a [SetupIntent](https://stripe.com/docs/api/setup_intents)
@ -71,6 +61,23 @@ module Stripe
)
end
# Creates a PaymentMethod object. Read the [Stripe.js reference](https://stripe.com/docs/stripe-js/reference#stripe-create-payment-method) to learn how to create PaymentMethods via Stripe.js.
#
# Instead of creating a PaymentMethod directly, we recommend using the [PaymentIntents API to accept a payment immediately or the <a href="/docs/payments/save-and-reuse">SetupIntent](https://stripe.com/docs/payments/accept-a-payment) API to collect payment method details ahead of a future payment.
def self.create(params = {}, opts = {})
request_stripe_object(method: :post, path: "/v1/payment_methods", params: params, opts: opts)
end
# Detaches a PaymentMethod object from a Customer. After a PaymentMethod is detached, it can no longer be used for a payment or re-attached to a Customer.
def detach(params = {}, opts = {})
request_stripe_object(
method: :post,
path: format("/v1/payment_methods/%<payment_method>s/detach", { payment_method: CGI.escape(self["id"]) }),
params: params,
opts: opts
)
end
# Detaches a PaymentMethod object from a Customer. After a PaymentMethod is detached, it can no longer be used for a payment or re-attached to a Customer.
def self.detach(payment_method, params = {}, opts = {})
request_stripe_object(
@ -81,13 +88,6 @@ module Stripe
)
end
# Creates a PaymentMethod object. Read the [Stripe.js reference](https://stripe.com/docs/stripe-js/reference#stripe-create-payment-method) to learn how to create PaymentMethods via Stripe.js.
#
# Instead of creating a PaymentMethod directly, we recommend using the [PaymentIntents API to accept a payment immediately or the <a href="/docs/payments/save-and-reuse">SetupIntent](https://stripe.com/docs/payments/accept-a-payment) API to collect payment method details ahead of a future payment.
def self.create(params = {}, opts = {})
request_stripe_object(method: :post, path: "/v1/payment_methods", params: params, opts: opts)
end
# Returns a list of PaymentMethods for Treasury flows. If you want to list the PaymentMethods attached to a Customer for payments, you should use the [List a Customer's PaymentMethods](https://stripe.com/docs/api/payment_methods/customer_list) API instead.
def self.list(filters = {}, opts = {})
request_stripe_object(method: :get, path: "/v1/payment_methods", params: filters, opts: opts)

View File

@ -16,36 +16,6 @@ module Stripe
"payment_method_domain"
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
# Creates a payment method domain.
def self.create(params = {}, opts = {})
request_stripe_object(
@ -75,5 +45,35 @@ module Stripe
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

View File

@ -30,18 +30,6 @@ module Stripe
)
end
# Reverses a payout by debiting the destination bank account. At this time, you can only reverse payouts for connected accounts to US bank accounts. If the payout is manual and in the pending status, use /v1/payouts/:id/cancel instead.
#
# By requesting a reversal through /v1/payouts/:id/reverse, you confirm that the authorized signatory of the selected bank account authorizes the debit on the bank account and that no other authorization is required.
def reverse(params = {}, opts = {})
request_stripe_object(
method: :post,
path: format("/v1/payouts/%<payout>s/reverse", { payout: CGI.escape(self["id"]) }),
params: params,
opts: opts
)
end
# You can cancel a previously created payout if its status is pending. Stripe refunds the funds to your available balance. You can't cancel automatic Stripe payouts.
def self.cancel(payout, params = {}, opts = {})
request_stripe_object(
@ -52,18 +40,6 @@ module Stripe
)
end
# Reverses a payout by debiting the destination bank account. At this time, you can only reverse payouts for connected accounts to US bank accounts. If the payout is manual and in the pending status, use /v1/payouts/:id/cancel instead.
#
# By requesting a reversal through /v1/payouts/:id/reverse, you confirm that the authorized signatory of the selected bank account authorizes the debit on the bank account and that no other authorization is required.
def self.reverse(payout, params = {}, opts = {})
request_stripe_object(
method: :post,
path: format("/v1/payouts/%<payout>s/reverse", { payout: CGI.escape(payout) }),
params: params,
opts: opts
)
end
# To send funds to your own bank account, create a new payout object. Your [Stripe balance](https://stripe.com/docs/api#balance) must cover the payout amount. If it doesn't, you receive an “Insufficient Funds” error.
#
# If your API key is in test mode, money won't actually be sent, though every other action occurs as if you're in live mode.
@ -78,6 +54,30 @@ module Stripe
request_stripe_object(method: :get, path: "/v1/payouts", params: filters, opts: opts)
end
# Reverses a payout by debiting the destination bank account. At this time, you can only reverse payouts for connected accounts to US bank accounts. If the payout is manual and in the pending status, use /v1/payouts/:id/cancel instead.
#
# By requesting a reversal through /v1/payouts/:id/reverse, you confirm that the authorized signatory of the selected bank account authorizes the debit on the bank account and that no other authorization is required.
def reverse(params = {}, opts = {})
request_stripe_object(
method: :post,
path: format("/v1/payouts/%<payout>s/reverse", { payout: CGI.escape(self["id"]) }),
params: params,
opts: opts
)
end
# Reverses a payout by debiting the destination bank account. At this time, you can only reverse payouts for connected accounts to US bank accounts. If the payout is manual and in the pending status, use /v1/payouts/:id/cancel instead.
#
# By requesting a reversal through /v1/payouts/:id/reverse, you confirm that the authorized signatory of the selected bank account authorizes the debit on the bank account and that no other authorization is required.
def self.reverse(payout, params = {}, opts = {})
request_stripe_object(
method: :post,
path: format("/v1/payouts/%<payout>s/reverse", { payout: CGI.escape(payout) }),
params: params,
opts: opts
)
end
# Updates the specified payout by setting the values of the parameters you pass. We don't change parameters that you don't provide. This request only accepts the metadata as arguments.
def self.update(id, params = {}, opts = {})
request_stripe_object(

View File

@ -24,6 +24,16 @@ module Stripe
)
end
# Accepts the specified quote.
def self.accept(quote, params = {}, opts = {})
request_stripe_object(
method: :post,
path: format("/v1/quotes/%<quote>s/accept", { quote: CGI.escape(quote) }),
params: params,
opts: opts
)
end
# Cancels the quote.
def cancel(params = {}, opts = {})
request_stripe_object(
@ -34,6 +44,21 @@ module Stripe
)
end
# Cancels the quote.
def self.cancel(quote, params = {}, opts = {})
request_stripe_object(
method: :post,
path: format("/v1/quotes/%<quote>s/cancel", { quote: CGI.escape(quote) }),
params: params,
opts: opts
)
end
# A quote models prices and services for a customer. Default options for header, description, footer, and expires_at can be set in the dashboard via the [quote template](https://dashboard.stripe.com/settings/billing/quote).
def self.create(params = {}, opts = {})
request_stripe_object(method: :post, path: "/v1/quotes", params: params, opts: opts)
end
# Finalizes the quote.
def finalize_quote(params = {}, opts = {})
request_stripe_object(
@ -44,6 +69,21 @@ module Stripe
)
end
# Finalizes the quote.
def self.finalize_quote(quote, params = {}, opts = {})
request_stripe_object(
method: :post,
path: format("/v1/quotes/%<quote>s/finalize", { quote: CGI.escape(quote) }),
params: params,
opts: opts
)
end
# Returns a list of your quotes.
def self.list(filters = {}, opts = {})
request_stripe_object(method: :get, path: "/v1/quotes", params: filters, opts: opts)
end
# When retrieving a quote, there is an includable [computed.upfront.line_items](https://stripe.com/docs/api/quotes/object#quote_object-computed-upfront-line_items) property containing the first handful of those items. There is also a URL where you can retrieve the full (paginated) list of upfront line items.
def list_computed_upfront_line_items(params = {}, opts = {})
request_stripe_object(
@ -54,6 +94,16 @@ module Stripe
)
end
# When retrieving a quote, there is an includable [computed.upfront.line_items](https://stripe.com/docs/api/quotes/object#quote_object-computed-upfront-line_items) property containing the first handful of those items. There is also a URL where you can retrieve the full (paginated) list of upfront line items.
def self.list_computed_upfront_line_items(quote, params = {}, opts = {})
request_stripe_object(
method: :get,
path: format("/v1/quotes/%<quote>s/computed_upfront_line_items", { quote: CGI.escape(quote) }),
params: params,
opts: opts
)
end
# When retrieving a quote, there is an includable line_items property containing the first handful of those items. There is also a URL where you can retrieve the full (paginated) list of line items.
def list_line_items(params = {}, opts = {})
request_stripe_object(
@ -64,6 +114,16 @@ module Stripe
)
end
# When retrieving a quote, there is an includable line_items property containing the first handful of those items. There is also a URL where you can retrieve the full (paginated) list of line items.
def self.list_line_items(quote, params = {}, opts = {})
request_stripe_object(
method: :get,
path: format("/v1/quotes/%<quote>s/line_items", { quote: CGI.escape(quote) }),
params: params,
opts: opts
)
end
# Download the PDF for a finalized quote
def pdf(params = {}, opts = {}, &read_body_chunk_block)
config = opts[:client]&.config || Stripe.config
@ -77,56 +137,6 @@ module Stripe
)
end
# Accepts the specified quote.
def self.accept(quote, params = {}, opts = {})
request_stripe_object(
method: :post,
path: format("/v1/quotes/%<quote>s/accept", { quote: CGI.escape(quote) }),
params: params,
opts: opts
)
end
# Cancels the quote.
def self.cancel(quote, params = {}, opts = {})
request_stripe_object(
method: :post,
path: format("/v1/quotes/%<quote>s/cancel", { quote: CGI.escape(quote) }),
params: params,
opts: opts
)
end
# Finalizes the quote.
def self.finalize_quote(quote, params = {}, opts = {})
request_stripe_object(
method: :post,
path: format("/v1/quotes/%<quote>s/finalize", { quote: CGI.escape(quote) }),
params: params,
opts: opts
)
end
# When retrieving a quote, there is an includable [computed.upfront.line_items](https://stripe.com/docs/api/quotes/object#quote_object-computed-upfront-line_items) property containing the first handful of those items. There is also a URL where you can retrieve the full (paginated) list of upfront line items.
def self.list_computed_upfront_line_items(quote, params = {}, opts = {})
request_stripe_object(
method: :get,
path: format("/v1/quotes/%<quote>s/computed_upfront_line_items", { quote: CGI.escape(quote) }),
params: params,
opts: opts
)
end
# When retrieving a quote, there is an includable line_items property containing the first handful of those items. There is also a URL where you can retrieve the full (paginated) list of line items.
def self.list_line_items(quote, params = {}, opts = {})
request_stripe_object(
method: :get,
path: format("/v1/quotes/%<quote>s/line_items", { quote: CGI.escape(quote) }),
params: params,
opts: opts
)
end
# Download the PDF for a finalized quote
def self.pdf(quote, params = {}, opts = {}, &read_body_chunk_block)
config = opts[:client]&.config || Stripe.config
@ -140,16 +150,6 @@ module Stripe
)
end
# A quote models prices and services for a customer. Default options for header, description, footer, and expires_at can be set in the dashboard via the [quote template](https://dashboard.stripe.com/settings/billing/quote).
def self.create(params = {}, opts = {})
request_stripe_object(method: :post, path: "/v1/quotes", params: params, opts: opts)
end
# Returns a list of your quotes.
def self.list(filters = {}, opts = {})
request_stripe_object(method: :get, path: "/v1/quotes", params: filters, opts: opts)
end
# A quote models prices and services for a customer.
def self.update(id, params = {}, opts = {})
request_stripe_object(

View File

@ -45,6 +45,18 @@ module Stripe
)
end
# You can cancel a SetupIntent object when it's in one of these statuses: requires_payment_method, requires_confirmation, or requires_action.
#
# After you cancel it, setup is abandoned and any operations on the SetupIntent fail with an error.
def self.cancel(intent, params = {}, opts = {})
request_stripe_object(
method: :post,
path: format("/v1/setup_intents/%<intent>s/cancel", { intent: CGI.escape(intent) }),
params: params,
opts: opts
)
end
# Confirm that your customer intends to set up the current or
# provided payment method. For example, you would confirm a SetupIntent
# when a customer hits the “Save” button on a payment method management
@ -68,28 +80,6 @@ module Stripe
)
end
# Verifies microdeposits on a SetupIntent object.
def verify_microdeposits(params = {}, opts = {})
request_stripe_object(
method: :post,
path: format("/v1/setup_intents/%<intent>s/verify_microdeposits", { intent: CGI.escape(self["id"]) }),
params: params,
opts: opts
)
end
# You can cancel a SetupIntent object when it's in one of these statuses: requires_payment_method, requires_confirmation, or requires_action.
#
# After you cancel it, setup is abandoned and any operations on the SetupIntent fail with an error.
def self.cancel(intent, params = {}, opts = {})
request_stripe_object(
method: :post,
path: format("/v1/setup_intents/%<intent>s/cancel", { intent: CGI.escape(intent) }),
params: params,
opts: opts
)
end
# Confirm that your customer intends to set up the current or
# provided payment method. For example, you would confirm a SetupIntent
# when a customer hits the “Save” button on a payment method management
@ -113,16 +103,6 @@ module Stripe
)
end
# Verifies microdeposits on a SetupIntent object.
def self.verify_microdeposits(intent, params = {}, opts = {})
request_stripe_object(
method: :post,
path: format("/v1/setup_intents/%<intent>s/verify_microdeposits", { intent: CGI.escape(intent) }),
params: params,
opts: opts
)
end
# Creates a SetupIntent object.
#
# After you create the SetupIntent, attach a payment method and [confirm](https://stripe.com/docs/api/setup_intents/confirm)
@ -145,5 +125,25 @@ module Stripe
opts: opts
)
end
# Verifies microdeposits on a SetupIntent object.
def verify_microdeposits(params = {}, opts = {})
request_stripe_object(
method: :post,
path: format("/v1/setup_intents/%<intent>s/verify_microdeposits", { intent: CGI.escape(self["id"]) }),
params: params,
opts: opts
)
end
# Verifies microdeposits on a SetupIntent object.
def self.verify_microdeposits(intent, params = {}, opts = {})
request_stripe_object(
method: :post,
path: format("/v1/setup_intents/%<intent>s/verify_microdeposits", { intent: CGI.escape(intent) }),
params: params,
opts: opts
)
end
end
end

View File

@ -15,10 +15,6 @@ module Stripe
"scheduled_query_run"
end
def self.resource_url
"/v1/sigma/scheduled_query_runs"
end
# Returns a list of scheduled query runs.
def self.list(filters = {}, opts = {})
request_stripe_object(
@ -28,6 +24,10 @@ module Stripe
opts: opts
)
end
def self.resource_url
"/v1/sigma/scheduled_query_runs"
end
end
end
end

View File

@ -24,6 +24,23 @@ module Stripe
nested_resource_class_methods :source_transaction, operations: %i[retrieve list]
# Creates a new source object.
def self.create(params = {}, opts = {})
request_stripe_object(method: :post, path: "/v1/sources", params: params, opts: opts)
end
# Updates the specified source by setting the values of the parameters passed. Any parameters not provided will be left unchanged.
#
# This request accepts the metadata and owner as arguments. It is also possible to update type specific information for selected payment methods. Please refer to our [payment method guides](https://stripe.com/docs/sources) for more detail.
def self.update(id, params = {}, opts = {})
request_stripe_object(
method: :post,
path: format("/v1/sources/%<id>s", { id: CGI.escape(id) }),
params: params,
opts: opts
)
end
# Verify a given source.
def verify(params = {}, opts = {})
request_stripe_object(
@ -67,22 +84,5 @@ module Stripe
end
extend Gem::Deprecate
deprecate :source_transactions, :"Source.list_source_transactions", 2020, 1
# Creates a new source object.
def self.create(params = {}, opts = {})
request_stripe_object(method: :post, path: "/v1/sources", params: params, opts: opts)
end
# Updates the specified source by setting the values of the parameters passed. Any parameters not provided will be left unchanged.
#
# This request accepts the metadata and owner as arguments. It is also possible to update type specific information for selected payment methods. Please refer to our [payment method guides](https://stripe.com/docs/sources) for more detail.
def self.update(id, params = {}, opts = {})
request_stripe_object(
method: :post,
path: format("/v1/sources/%<id>s", { id: CGI.escape(id) }),
params: params,
opts: opts
)
end
end
end

View File

@ -30,26 +30,6 @@ module Stripe
)
end
# Removes the currently applied discount on a subscription.
def delete_discount(params = {}, opts = {})
request_stripe_object(
method: :delete,
path: format("/v1/subscriptions/%<subscription_exposed_id>s/discount", { subscription_exposed_id: CGI.escape(self["id"]) }),
params: params,
opts: opts
)
end
# Initiates resumption of a paused subscription, optionally resetting the billing cycle anchor and creating prorations. If a resumption invoice is generated, it must be paid or marked uncollectible before the subscription will be unpaused. If payment succeeds the subscription will become active, and if payment fails the subscription will be past_due. The resumption invoice will void automatically if not paid by the expiration date.
def resume(params = {}, opts = {})
request_stripe_object(
method: :post,
path: format("/v1/subscriptions/%<subscription>s/resume", { subscription: CGI.escape(self["id"]) }),
params: params,
opts: opts
)
end
# Cancels a customer's subscription immediately. The customer will not be charged again for the subscription.
#
# Note, however, that any pending invoice items that you've created will still be charged for at the end of the period, unless manually [deleted](https://stripe.com/docs/api#delete_invoiceitem). If you've set the subscription to cancel at the end of the period, any pending prorations will also be left in place and collected at the end of the period. But if the subscription is set to cancel immediately, pending prorations will be removed.
@ -64,6 +44,27 @@ module Stripe
)
end
# Creates a new subscription on an existing customer. Each customer can have up to 500 active or scheduled subscriptions.
#
# When you create a subscription with collection_method=charge_automatically, the first invoice is finalized as part of the request.
# The payment_behavior parameter determines the exact behavior of the initial payment.
#
# To start subscriptions where the first invoice always begins in a draft status, use [subscription schedules](https://stripe.com/docs/billing/subscriptions/subscription-schedules#managing) instead.
# Schedules provide the flexibility to model more complex billing configurations that change over time.
def self.create(params = {}, opts = {})
request_stripe_object(method: :post, path: "/v1/subscriptions", params: params, opts: opts)
end
# Removes the currently applied discount on a subscription.
def delete_discount(params = {}, opts = {})
request_stripe_object(
method: :delete,
path: format("/v1/subscriptions/%<subscription_exposed_id>s/discount", { subscription_exposed_id: CGI.escape(self["id"]) }),
params: params,
opts: opts
)
end
# Removes the currently applied discount on a subscription.
def self.delete_discount(subscription_exposed_id, params = {}, opts = {})
request_stripe_object(
@ -74,6 +75,21 @@ module Stripe
)
end
# By default, returns a list of subscriptions that have not been canceled. In order to list canceled subscriptions, specify status=canceled.
def self.list(filters = {}, opts = {})
request_stripe_object(method: :get, path: "/v1/subscriptions", params: filters, opts: opts)
end
# Initiates resumption of a paused subscription, optionally resetting the billing cycle anchor and creating prorations. If a resumption invoice is generated, it must be paid or marked uncollectible before the subscription will be unpaused. If payment succeeds the subscription will become active, and if payment fails the subscription will be past_due. The resumption invoice will void automatically if not paid by the expiration date.
def resume(params = {}, opts = {})
request_stripe_object(
method: :post,
path: format("/v1/subscriptions/%<subscription>s/resume", { subscription: CGI.escape(self["id"]) }),
params: params,
opts: opts
)
end
# Initiates resumption of a paused subscription, optionally resetting the billing cycle anchor and creating prorations. If a resumption invoice is generated, it must be paid or marked uncollectible before the subscription will be unpaused. If payment succeeds the subscription will become active, and if payment fails the subscription will be past_due. The resumption invoice will void automatically if not paid by the expiration date.
def self.resume(subscription, params = {}, opts = {})
request_stripe_object(
@ -84,24 +100,6 @@ module Stripe
)
end
save_nested_resource :source
# Creates a new subscription on an existing customer. Each customer can have up to 500 active or scheduled subscriptions.
#
# When you create a subscription with collection_method=charge_automatically, the first invoice is finalized as part of the request.
# The payment_behavior parameter determines the exact behavior of the initial payment.
#
# To start subscriptions where the first invoice always begins in a draft status, use [subscription schedules](https://stripe.com/docs/billing/subscriptions/subscription-schedules#managing) instead.
# Schedules provide the flexibility to model more complex billing configurations that change over time.
def self.create(params = {}, opts = {})
request_stripe_object(method: :post, path: "/v1/subscriptions", params: params, opts: opts)
end
# By default, returns a list of subscriptions that have not been canceled. In order to list canceled subscriptions, specify status=canceled.
def self.list(filters = {}, opts = {})
request_stripe_object(method: :get, path: "/v1/subscriptions", params: filters, opts: opts)
end
def self.search(params = {}, opts = {})
request_stripe_object(
method: :get,
@ -144,5 +142,7 @@ module Stripe
opts: opts
)
end
save_nested_resource :source
end
end

View File

@ -25,16 +25,6 @@ module Stripe
)
end
# Releases the subscription schedule immediately, which will stop scheduling of its phases, but leave any existing subscription in place. A schedule can only be released if its status is not_started or active. If the subscription schedule is currently associated with a subscription, releasing it will remove its subscription property and set the subscription's ID to the released_subscription property.
def release(params = {}, opts = {})
request_stripe_object(
method: :post,
path: format("/v1/subscription_schedules/%<schedule>s/release", { schedule: CGI.escape(self["id"]) }),
params: params,
opts: opts
)
end
# Cancels a subscription schedule and its associated subscription immediately (if the subscription schedule has an active subscription). A subscription schedule can only be canceled if its status is not_started or active.
def self.cancel(schedule, params = {}, opts = {})
request_stripe_object(
@ -45,16 +35,6 @@ module Stripe
)
end
# Releases the subscription schedule immediately, which will stop scheduling of its phases, but leave any existing subscription in place. A schedule can only be released if its status is not_started or active. If the subscription schedule is currently associated with a subscription, releasing it will remove its subscription property and set the subscription's ID to the released_subscription property.
def self.release(schedule, params = {}, opts = {})
request_stripe_object(
method: :post,
path: format("/v1/subscription_schedules/%<schedule>s/release", { schedule: CGI.escape(schedule) }),
params: params,
opts: opts
)
end
# Creates a new subscription schedule object. Each customer can have up to 500 active or scheduled subscriptions.
def self.create(params = {}, opts = {})
request_stripe_object(
@ -75,6 +55,26 @@ module Stripe
)
end
# Releases the subscription schedule immediately, which will stop scheduling of its phases, but leave any existing subscription in place. A schedule can only be released if its status is not_started or active. If the subscription schedule is currently associated with a subscription, releasing it will remove its subscription property and set the subscription's ID to the released_subscription property.
def release(params = {}, opts = {})
request_stripe_object(
method: :post,
path: format("/v1/subscription_schedules/%<schedule>s/release", { schedule: CGI.escape(self["id"]) }),
params: params,
opts: opts
)
end
# Releases the subscription schedule immediately, which will stop scheduling of its phases, but leave any existing subscription in place. A schedule can only be released if its status is not_started or active. If the subscription schedule is currently associated with a subscription, releasing it will remove its subscription property and set the subscription's ID to the released_subscription property.
def self.release(schedule, params = {}, opts = {})
request_stripe_object(
method: :post,
path: format("/v1/subscription_schedules/%<schedule>s/release", { schedule: CGI.escape(schedule) }),
params: params,
opts: opts
)
end
# Updates an existing subscription schedule.
def self.update(id, params = {}, opts = {})
request_stripe_object(

View File

@ -14,6 +14,16 @@ module Stripe
"tax.calculation"
end
# Calculates tax based on input and returns a Tax Calculation object.
def self.create(params = {}, opts = {})
request_stripe_object(
method: :post,
path: "/v1/tax/calculations",
params: params,
opts: opts
)
end
# Retrieves the line items of a persisted tax calculation as a collection.
def list_line_items(params = {}, opts = {})
request_stripe_object(
@ -33,16 +43,6 @@ module Stripe
opts: opts
)
end
# Calculates tax based on input and returns a Tax Calculation object.
def self.create(params = {}, opts = {})
request_stripe_object(
method: :post,
path: "/v1/tax/calculations",
params: params,
opts: opts
)
end
end
end
end

View File

@ -12,16 +12,6 @@ module Stripe
"tax.transaction"
end
# Retrieves the line items of a committed standalone transaction as a collection.
def list_line_items(params = {}, opts = {})
request_stripe_object(
method: :get,
path: format("/v1/tax/transactions/%<transaction>s/line_items", { transaction: CGI.escape(self["id"]) }),
params: params,
opts: opts
)
end
# Creates a Tax Transaction from a calculation.
def self.create_from_calculation(params = {}, opts = {})
request_stripe_object(
@ -42,6 +32,16 @@ module Stripe
)
end
# Retrieves the line items of a committed standalone transaction as a collection.
def list_line_items(params = {}, opts = {})
request_stripe_object(
method: :get,
path: format("/v1/tax/transactions/%<transaction>s/line_items", { transaction: CGI.escape(self["id"]) }),
params: params,
opts: opts
)
end
# Retrieves the line items of a committed standalone transaction as a collection.
def self.list_line_items(transaction, params = {}, opts = {})
request_stripe_object(

View File

@ -27,46 +27,6 @@ module Stripe
)
end
# Initiates a payment flow on a Reader.
def process_payment_intent(params = {}, opts = {})
request_stripe_object(
method: :post,
path: format("/v1/terminal/readers/%<reader>s/process_payment_intent", { reader: CGI.escape(self["id"]) }),
params: params,
opts: opts
)
end
# Initiates a setup intent flow on a Reader.
def process_setup_intent(params = {}, opts = {})
request_stripe_object(
method: :post,
path: format("/v1/terminal/readers/%<reader>s/process_setup_intent", { reader: CGI.escape(self["id"]) }),
params: params,
opts: opts
)
end
# Initiates a refund on a Reader
def refund_payment(params = {}, opts = {})
request_stripe_object(
method: :post,
path: format("/v1/terminal/readers/%<reader>s/refund_payment", { reader: CGI.escape(self["id"]) }),
params: params,
opts: opts
)
end
# Sets reader display to show cart details.
def set_reader_display(params = {}, opts = {})
request_stripe_object(
method: :post,
path: format("/v1/terminal/readers/%<reader>s/set_reader_display", { reader: CGI.escape(self["id"]) }),
params: params,
opts: opts
)
end
# Cancels the current reader action.
def self.cancel_action(reader, params = {}, opts = {})
request_stripe_object(
@ -77,46 +37,6 @@ module Stripe
)
end
# Initiates a payment flow on a Reader.
def self.process_payment_intent(reader, params = {}, opts = {})
request_stripe_object(
method: :post,
path: format("/v1/terminal/readers/%<reader>s/process_payment_intent", { reader: CGI.escape(reader) }),
params: params,
opts: opts
)
end
# Initiates a setup intent flow on a Reader.
def self.process_setup_intent(reader, params = {}, opts = {})
request_stripe_object(
method: :post,
path: format("/v1/terminal/readers/%<reader>s/process_setup_intent", { reader: CGI.escape(reader) }),
params: params,
opts: opts
)
end
# Initiates a refund on a Reader
def self.refund_payment(reader, params = {}, opts = {})
request_stripe_object(
method: :post,
path: format("/v1/terminal/readers/%<reader>s/refund_payment", { reader: CGI.escape(reader) }),
params: params,
opts: opts
)
end
# Sets reader display to show cart details.
def self.set_reader_display(reader, params = {}, opts = {})
request_stripe_object(
method: :post,
path: format("/v1/terminal/readers/%<reader>s/set_reader_display", { reader: CGI.escape(reader) }),
params: params,
opts: opts
)
end
# Creates a new Reader object.
def self.create(params = {}, opts = {})
request_stripe_object(
@ -157,6 +77,86 @@ module Stripe
)
end
# Initiates a payment flow on a Reader.
def process_payment_intent(params = {}, opts = {})
request_stripe_object(
method: :post,
path: format("/v1/terminal/readers/%<reader>s/process_payment_intent", { reader: CGI.escape(self["id"]) }),
params: params,
opts: opts
)
end
# Initiates a payment flow on a Reader.
def self.process_payment_intent(reader, params = {}, opts = {})
request_stripe_object(
method: :post,
path: format("/v1/terminal/readers/%<reader>s/process_payment_intent", { reader: CGI.escape(reader) }),
params: params,
opts: opts
)
end
# Initiates a setup intent flow on a Reader.
def process_setup_intent(params = {}, opts = {})
request_stripe_object(
method: :post,
path: format("/v1/terminal/readers/%<reader>s/process_setup_intent", { reader: CGI.escape(self["id"]) }),
params: params,
opts: opts
)
end
# Initiates a setup intent flow on a Reader.
def self.process_setup_intent(reader, params = {}, opts = {})
request_stripe_object(
method: :post,
path: format("/v1/terminal/readers/%<reader>s/process_setup_intent", { reader: CGI.escape(reader) }),
params: params,
opts: opts
)
end
# Initiates a refund on a Reader
def refund_payment(params = {}, opts = {})
request_stripe_object(
method: :post,
path: format("/v1/terminal/readers/%<reader>s/refund_payment", { reader: CGI.escape(self["id"]) }),
params: params,
opts: opts
)
end
# Initiates a refund on a Reader
def self.refund_payment(reader, params = {}, opts = {})
request_stripe_object(
method: :post,
path: format("/v1/terminal/readers/%<reader>s/refund_payment", { reader: CGI.escape(reader) }),
params: params,
opts: opts
)
end
# Sets reader display to show cart details.
def set_reader_display(params = {}, opts = {})
request_stripe_object(
method: :post,
path: format("/v1/terminal/readers/%<reader>s/set_reader_display", { reader: CGI.escape(self["id"]) }),
params: params,
opts: opts
)
end
# Sets reader display to show cart details.
def self.set_reader_display(reader, params = {}, opts = {})
request_stripe_object(
method: :post,
path: format("/v1/terminal/readers/%<reader>s/set_reader_display", { reader: CGI.escape(reader) }),
params: params,
opts: opts
)
end
# Updates a Reader object by setting the values of the parameters passed. Any parameters not provided will be left unchanged.
def self.update(id, params = {}, opts = {})
request_stripe_object(

View File

@ -15,46 +15,6 @@ module Stripe
"treasury.financial_account"
end
# Retrieves Features information associated with the FinancialAccount.
def retrieve_features(params = {}, opts = {})
request_stripe_object(
method: :get,
path: format("/v1/treasury/financial_accounts/%<financial_account>s/features", { financial_account: CGI.escape(self["id"]) }),
params: params,
opts: opts
)
end
# Updates the Features associated with a FinancialAccount.
def update_features(params = {}, opts = {})
request_stripe_object(
method: :post,
path: format("/v1/treasury/financial_accounts/%<financial_account>s/features", { financial_account: CGI.escape(self["id"]) }),
params: params,
opts: opts
)
end
# Retrieves Features information associated with the FinancialAccount.
def self.retrieve_features(financial_account, params = {}, opts = {})
request_stripe_object(
method: :get,
path: format("/v1/treasury/financial_accounts/%<financial_account>s/features", { financial_account: CGI.escape(financial_account) }),
params: params,
opts: opts
)
end
# Updates the Features associated with a FinancialAccount.
def self.update_features(financial_account, params = {}, opts = {})
request_stripe_object(
method: :post,
path: format("/v1/treasury/financial_accounts/%<financial_account>s/features", { financial_account: CGI.escape(financial_account) }),
params: params,
opts: opts
)
end
# Creates a new FinancialAccount. For now, each connected account can only have one FinancialAccount.
def self.create(params = {}, opts = {})
request_stripe_object(
@ -75,6 +35,26 @@ module Stripe
)
end
# Retrieves Features information associated with the FinancialAccount.
def retrieve_features(params = {}, opts = {})
request_stripe_object(
method: :get,
path: format("/v1/treasury/financial_accounts/%<financial_account>s/features", { financial_account: CGI.escape(self["id"]) }),
params: params,
opts: opts
)
end
# Retrieves Features information associated with the FinancialAccount.
def self.retrieve_features(financial_account, params = {}, opts = {})
request_stripe_object(
method: :get,
path: format("/v1/treasury/financial_accounts/%<financial_account>s/features", { financial_account: CGI.escape(financial_account) }),
params: params,
opts: opts
)
end
# Updates the details of a FinancialAccount.
def self.update(id, params = {}, opts = {})
request_stripe_object(
@ -84,6 +64,26 @@ module Stripe
opts: opts
)
end
# Updates the Features associated with a FinancialAccount.
def update_features(params = {}, opts = {})
request_stripe_object(
method: :post,
path: format("/v1/treasury/financial_accounts/%<financial_account>s/features", { financial_account: CGI.escape(self["id"]) }),
params: params,
opts: opts
)
end
# Updates the Features associated with a FinancialAccount.
def self.update_features(financial_account, params = {}, opts = {})
request_stripe_object(
method: :post,
path: format("/v1/treasury/financial_accounts/%<financial_account>s/features", { financial_account: CGI.escape(financial_account) }),
params: params,
opts: opts
)
end
end
end
end

View File

@ -12,10 +12,6 @@ module Stripe
"treasury.transaction_entry"
end
def self.resource_url
"/v1/treasury/transaction_entries"
end
# Retrieves a list of TransactionEntry objects.
def self.list(filters = {}, opts = {})
request_stripe_object(
@ -25,6 +21,10 @@ module Stripe
opts: opts
)
end
def self.resource_url
"/v1/treasury/transaction_entries"
end
end
end
end