stripe 5.55.0 → 8.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +122 -2
- data/Gemfile +1 -0
- data/Makefile +1 -1
- data/OPENAPI_VERSION +1 -0
- data/README.md +37 -3
- data/VERSION +1 -1
- data/lib/data/ca-certificates.crt +1241 -1937
- data/lib/stripe/api_operations/create.rb +6 -2
- data/lib/stripe/api_operations/delete.rb +12 -7
- data/lib/stripe/api_operations/list.rb +6 -9
- data/lib/stripe/api_operations/nested_resource.rb +62 -34
- data/lib/stripe/api_operations/request.rb +10 -0
- data/lib/stripe/api_operations/save.rb +11 -3
- data/lib/stripe/api_operations/search.rb +6 -9
- data/lib/stripe/api_resource.rb +1 -1
- data/lib/stripe/api_resource_test_helpers.rb +2 -0
- data/lib/stripe/api_version.rb +8 -0
- data/lib/stripe/instrumentation.rb +45 -7
- data/lib/stripe/object_types.rb +12 -10
- data/lib/stripe/resources/account.rb +36 -9
- data/lib/stripe/resources/account_link.rb +4 -0
- data/lib/stripe/resources/application_fee_refund.rb +5 -0
- data/lib/stripe/resources/apps/secret.rb +40 -0
- data/lib/stripe/resources/balance.rb +11 -0
- data/lib/stripe/resources/balance_transaction.rb +4 -0
- data/lib/stripe/resources/bank_account.rb +7 -0
- data/lib/stripe/resources/billing_portal/configuration.rb +1 -0
- data/lib/stripe/resources/billing_portal/session.rb +14 -0
- data/lib/stripe/resources/capability.rb +3 -0
- data/lib/stripe/resources/card.rb +6 -3
- data/lib/stripe/resources/cash_balance.rb +1 -0
- data/lib/stripe/resources/charge.rb +15 -3
- data/lib/stripe/resources/checkout/session.rb +41 -5
- data/lib/stripe/resources/country_spec.rb +6 -0
- data/lib/stripe/resources/coupon.rb +3 -0
- data/lib/stripe/resources/credit_note.rb +27 -9
- data/lib/stripe/resources/customer.rb +109 -19
- data/lib/stripe/resources/customer_balance_transaction.rb +6 -0
- data/lib/stripe/resources/customer_cash_balance_transaction.rb +14 -0
- data/lib/stripe/resources/discount.rb +4 -0
- data/lib/stripe/resources/dispute.rb +17 -3
- data/lib/stripe/resources/event.rb +29 -0
- data/lib/stripe/resources/exchange_rate.rb +11 -0
- data/lib/stripe/resources/file.rb +7 -0
- data/lib/stripe/resources/file_link.rb +3 -0
- data/lib/stripe/resources/financial_connections/account.rb +42 -6
- data/lib/stripe/resources/financial_connections/account_ownership.rb +1 -0
- data/lib/stripe/resources/financial_connections/session.rb +1 -0
- data/lib/stripe/resources/funding_instructions.rb +5 -0
- data/lib/stripe/resources/identity/verification_report.rb +11 -0
- data/lib/stripe/resources/identity/verification_session.rb +31 -5
- data/lib/stripe/resources/invoice.rb +96 -17
- data/lib/stripe/resources/invoice_item.rb +11 -0
- data/lib/stripe/resources/issuing/authorization.rb +25 -5
- data/lib/stripe/resources/issuing/card.rb +78 -8
- data/lib/stripe/resources/issuing/cardholder.rb +3 -0
- data/lib/stripe/resources/issuing/dispute.rb +13 -3
- data/lib/stripe/resources/issuing/transaction.rb +5 -0
- data/lib/stripe/resources/line_item.rb +1 -0
- data/lib/stripe/resources/mandate.rb +1 -0
- data/lib/stripe/resources/payment_intent.rb +71 -13
- data/lib/stripe/resources/payment_link.rb +15 -3
- data/lib/stripe/resources/payment_method.rb +25 -5
- data/lib/stripe/resources/payout.rb +28 -5
- data/lib/stripe/resources/person.rb +6 -0
- data/lib/stripe/resources/plan.rb +8 -0
- data/lib/stripe/resources/price.rb +6 -0
- data/lib/stripe/resources/product.rb +8 -0
- data/lib/stripe/resources/promotion_code.rb +2 -0
- data/lib/stripe/resources/quote.rb +52 -11
- data/lib/stripe/resources/radar/early_fraud_warning.rb +4 -0
- data/lib/stripe/resources/radar/value_list.rb +3 -0
- data/lib/stripe/resources/radar/value_list_item.rb +3 -0
- data/lib/stripe/resources/refund.rb +24 -5
- data/lib/stripe/resources/reporting/report_run.rb +8 -0
- data/lib/stripe/resources/reporting/report_type.rb +8 -1
- data/lib/stripe/resources/reversal.rb +13 -0
- data/lib/stripe/resources/review.rb +14 -3
- data/lib/stripe/resources/setup_attempt.rb +4 -0
- data/lib/stripe/resources/setup_intent.rb +52 -7
- data/lib/stripe/resources/shipping_rate.rb +3 -0
- data/lib/stripe/resources/sigma/scheduled_query_run.rb +4 -0
- data/lib/stripe/resources/source.rb +26 -6
- data/lib/stripe/resources/source_transaction.rb +4 -0
- data/lib/stripe/resources/subscription.rb +48 -3
- data/lib/stripe/resources/subscription_item.rb +2 -7
- data/lib/stripe/resources/subscription_schedule.rb +23 -5
- data/lib/stripe/resources/tax_code.rb +1 -0
- data/lib/stripe/resources/tax_id.rb +4 -0
- data/lib/stripe/resources/tax_rate.rb +3 -0
- data/lib/stripe/resources/terminal/configuration.rb +1 -0
- data/lib/stripe/resources/terminal/connection_token.rb +3 -0
- data/lib/stripe/resources/terminal/location.rb +3 -0
- data/lib/stripe/resources/terminal/reader.rb +70 -11
- data/lib/stripe/resources/test_helpers/test_clock.rb +13 -3
- data/lib/stripe/resources/token.rb +22 -0
- data/lib/stripe/resources/topup.rb +15 -3
- data/lib/stripe/resources/transfer.rb +10 -11
- data/lib/stripe/resources/treasury/credit_reversal.rb +14 -0
- data/lib/stripe/resources/treasury/debit_reversal.rb +14 -0
- data/lib/stripe/resources/treasury/financial_account.rb +52 -0
- data/lib/stripe/resources/treasury/inbound_transfer.rb +94 -0
- data/lib/stripe/resources/treasury/outbound_payment.rb +96 -0
- data/lib/stripe/resources/treasury/outbound_transfer.rb +100 -0
- data/lib/stripe/resources/treasury/received_credit.rb +30 -0
- data/lib/stripe/resources/treasury/received_debit.rb +30 -0
- data/lib/stripe/resources/treasury/transaction.rb +13 -0
- data/lib/stripe/resources/treasury/transaction_entry.rb +17 -0
- data/lib/stripe/resources/usage_record.rb +4 -0
- data/lib/stripe/resources/webhook_endpoint.rb +7 -0
- data/lib/stripe/resources.rb +12 -10
- data/lib/stripe/stripe_client.rb +25 -17
- data/lib/stripe/stripe_object.rb +2 -2
- data/lib/stripe/util.rb +38 -3
- data/lib/stripe/version.rb +1 -1
- metadata +17 -11
- data/lib/stripe/resources/bitcoin_receiver.rb +0 -24
- data/lib/stripe/resources/bitcoin_transaction.rb +0 -16
- data/lib/stripe/resources/issuing/card_details.rb +0 -10
- data/lib/stripe/resources/order.rb +0 -33
- data/lib/stripe/resources/order_return.rb +0 -10
- data/lib/stripe/resources/recipient.rb +0 -14
- data/lib/stripe/resources/sku.rb +0 -13
- data/lib/stripe/resources/three_d_secure.rb +0 -14
@@ -2,6 +2,9 @@
|
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
4
|
module Stripe
|
5
|
+
# This is an object representing a capability for a Stripe account.
|
6
|
+
#
|
7
|
+
# Related guide: [Account capabilities](https://stripe.com/docs/connect/account-capabilities).
|
5
8
|
class Capability < APIResource
|
6
9
|
extend Stripe::APIOperations::List
|
7
10
|
include Stripe::APIOperations::Save
|
@@ -2,6 +2,11 @@
|
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
4
|
module Stripe
|
5
|
+
# You can store multiple cards on a customer in order to charge the customer
|
6
|
+
# later. You can also store multiple debit cards on a recipient in order to
|
7
|
+
# transfer to those cards later.
|
8
|
+
#
|
9
|
+
# Related guide: [Card Payments with Sources](https://stripe.com/docs/sources/cards).
|
5
10
|
class Card < APIResource
|
6
11
|
include Stripe::APIOperations::Delete
|
7
12
|
extend Stripe::APIOperations::List
|
@@ -10,9 +15,7 @@ module Stripe
|
|
10
15
|
OBJECT_NAME = "card"
|
11
16
|
|
12
17
|
def resource_url
|
13
|
-
if respond_to?(:
|
14
|
-
"#{Recipient.resource_url}/#{CGI.escape(recipient)}/cards/#{CGI.escape(id)}"
|
15
|
-
elsif respond_to?(:customer) && !customer.nil? && !customer.empty?
|
18
|
+
if respond_to?(:customer) && !customer.nil? && !customer.empty?
|
16
19
|
"#{Customer.resource_url}/#{CGI.escape(customer)}/sources/#{CGI.escape(id)}"
|
17
20
|
elsif respond_to?(:account) && !account.nil? && !account.empty?
|
18
21
|
"#{Account.resource_url}/#{CGI.escape(account)}/external_accounts/#{CGI.escape(id)}"
|
@@ -2,6 +2,7 @@
|
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
4
|
module Stripe
|
5
|
+
# A customer's `Cash balance` represents real funds. Customers can add funds to their cash balance by sending a bank transfer. These funds can be used for payment and can eventually be paid out to your bank account.
|
5
6
|
class CashBalance < APIResource
|
6
7
|
OBJECT_NAME = "cash_balance"
|
7
8
|
|
@@ -2,6 +2,11 @@
|
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
4
|
module Stripe
|
5
|
+
# To charge a credit or a debit card, you create a `Charge` object. You can
|
6
|
+
# retrieve and refund individual charges as well as list all charges. Charges
|
7
|
+
# are identified by a unique, random ID.
|
8
|
+
#
|
9
|
+
# Related guide: [Accept a payment with the Charges API](https://stripe.com/docs/payments/accept-a-payment-charges).
|
5
10
|
class Charge < APIResource
|
6
11
|
extend Stripe::APIOperations::Create
|
7
12
|
extend Stripe::APIOperations::List
|
@@ -10,12 +15,19 @@ module Stripe
|
|
10
15
|
|
11
16
|
OBJECT_NAME = "charge"
|
12
17
|
|
13
|
-
custom_method :capture, http_verb: :post
|
14
|
-
|
15
18
|
def capture(params = {}, opts = {})
|
16
19
|
request_stripe_object(
|
17
20
|
method: :post,
|
18
|
-
path:
|
21
|
+
path: format("/v1/charges/%<charge>s/capture", { charge: CGI.escape(self["id"]) }),
|
22
|
+
params: params,
|
23
|
+
opts: opts
|
24
|
+
)
|
25
|
+
end
|
26
|
+
|
27
|
+
def self.capture(charge, params = {}, opts = {})
|
28
|
+
request_stripe_object(
|
29
|
+
method: :post,
|
30
|
+
path: format("/v1/charges/%<charge>s/capture", { charge: CGI.escape(charge) }),
|
19
31
|
params: params,
|
20
32
|
opts: opts
|
21
33
|
)
|
@@ -3,21 +3,57 @@
|
|
3
3
|
|
4
4
|
module Stripe
|
5
5
|
module Checkout
|
6
|
+
# A Checkout Session represents your customer's session as they pay for
|
7
|
+
# one-time purchases or subscriptions through [Checkout](https://stripe.com/docs/payments/checkout)
|
8
|
+
# or [Payment Links](https://stripe.com/docs/payments/payment-links). We recommend creating a
|
9
|
+
# new Session each time your customer attempts to pay.
|
10
|
+
#
|
11
|
+
# Once payment is successful, the Checkout Session will contain a reference
|
12
|
+
# to the [Customer](https://stripe.com/docs/api/customers), and either the successful
|
13
|
+
# [PaymentIntent](https://stripe.com/docs/api/payment_intents) or an active
|
14
|
+
# [Subscription](https://stripe.com/docs/api/subscriptions).
|
15
|
+
#
|
16
|
+
# You can create a Checkout Session on your server and redirect to its URL
|
17
|
+
# to begin Checkout.
|
18
|
+
#
|
19
|
+
# Related guide: [Checkout Quickstart](https://stripe.com/docs/checkout/quickstart).
|
6
20
|
class Session < APIResource
|
7
21
|
extend Stripe::APIOperations::Create
|
8
22
|
extend Stripe::APIOperations::List
|
9
|
-
extend Stripe::APIOperations::NestedResource
|
10
23
|
|
11
24
|
OBJECT_NAME = "checkout.session"
|
12
25
|
|
13
|
-
|
26
|
+
def expire(params = {}, opts = {})
|
27
|
+
request_stripe_object(
|
28
|
+
method: :post,
|
29
|
+
path: format("/v1/checkout/sessions/%<session>s/expire", { session: CGI.escape(self["id"]) }),
|
30
|
+
params: params,
|
31
|
+
opts: opts
|
32
|
+
)
|
33
|
+
end
|
14
34
|
|
15
|
-
|
35
|
+
def list_line_items(params = {}, opts = {})
|
36
|
+
request_stripe_object(
|
37
|
+
method: :get,
|
38
|
+
path: format("/v1/checkout/sessions/%<session>s/line_items", { session: CGI.escape(self["id"]) }),
|
39
|
+
params: params,
|
40
|
+
opts: opts
|
41
|
+
)
|
42
|
+
end
|
16
43
|
|
17
|
-
def expire(params = {}, opts = {})
|
44
|
+
def self.expire(session, params = {}, opts = {})
|
18
45
|
request_stripe_object(
|
19
46
|
method: :post,
|
20
|
-
path:
|
47
|
+
path: format("/v1/checkout/sessions/%<session>s/expire", { session: CGI.escape(session) }),
|
48
|
+
params: params,
|
49
|
+
opts: opts
|
50
|
+
)
|
51
|
+
end
|
52
|
+
|
53
|
+
def self.list_line_items(session, params = {}, opts = {})
|
54
|
+
request_stripe_object(
|
55
|
+
method: :get,
|
56
|
+
path: format("/v1/checkout/sessions/%<session>s/line_items", { session: CGI.escape(session) }),
|
21
57
|
params: params,
|
22
58
|
opts: opts
|
23
59
|
)
|
@@ -2,6 +2,12 @@
|
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
4
|
module Stripe
|
5
|
+
# Stripe needs to collect certain pieces of information about each account
|
6
|
+
# created. These requirements can differ depending on the account's country. The
|
7
|
+
# Country Specs API makes these rules available to your integration.
|
8
|
+
#
|
9
|
+
# You can also view the information from this API call as [an online
|
10
|
+
# guide](https://stripe.com/docs/connect/required-verification-information).
|
5
11
|
class CountrySpec < APIResource
|
6
12
|
extend Stripe::APIOperations::List
|
7
13
|
|
@@ -2,6 +2,9 @@
|
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
4
|
module Stripe
|
5
|
+
# A coupon contains information about a percent-off or amount-off discount you
|
6
|
+
# might want to apply to a customer. Coupons may be applied to [subscriptions](https://stripe.com/docs/api#subscriptions), [invoices](https://stripe.com/docs/api#invoices),
|
7
|
+
# [checkout sessions](https://stripe.com/docs/api/checkout/sessions), [quotes](https://stripe.com/docs/api#quotes), and more. Coupons do not work with conventional one-off [charges](https://stripe.com/docs/api#create_charge) or [payment intents](https://stripe.com/docs/api/payment_intents).
|
5
8
|
class Coupon < APIResource
|
6
9
|
extend Stripe::APIOperations::Create
|
7
10
|
include Stripe::APIOperations::Delete
|
@@ -2,6 +2,9 @@
|
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
4
|
module Stripe
|
5
|
+
# Issue a credit note to adjust an invoice's amount after the invoice is finalized.
|
6
|
+
#
|
7
|
+
# Related guide: [Credit Notes](https://stripe.com/docs/billing/invoices/credit-notes).
|
5
8
|
class CreditNote < APIResource
|
6
9
|
extend Stripe::APIOperations::Create
|
7
10
|
extend Stripe::APIOperations::List
|
@@ -9,25 +12,40 @@ module Stripe
|
|
9
12
|
|
10
13
|
OBJECT_NAME = "credit_note"
|
11
14
|
|
12
|
-
custom_method :void_credit_note, http_verb: :post, http_path: "void"
|
13
|
-
|
14
15
|
def void_credit_note(params = {}, opts = {})
|
15
16
|
request_stripe_object(
|
16
17
|
method: :post,
|
17
|
-
path:
|
18
|
+
path: format("/v1/credit_notes/%<id>s/void", { id: CGI.escape(self["id"]) }),
|
19
|
+
params: params,
|
20
|
+
opts: opts
|
21
|
+
)
|
22
|
+
end
|
23
|
+
|
24
|
+
def self.list_preview_line_items(params = {}, opts = {})
|
25
|
+
request_stripe_object(
|
26
|
+
method: :get,
|
27
|
+
path: "/v1/credit_notes/preview/lines",
|
18
28
|
params: params,
|
19
29
|
opts: opts
|
20
30
|
)
|
21
31
|
end
|
22
32
|
|
23
|
-
def self.preview(params, opts = {})
|
24
|
-
|
25
|
-
|
33
|
+
def self.preview(params = {}, opts = {})
|
34
|
+
request_stripe_object(
|
35
|
+
method: :get,
|
36
|
+
path: "/v1/credit_notes/preview",
|
37
|
+
params: params,
|
38
|
+
opts: opts
|
39
|
+
)
|
26
40
|
end
|
27
41
|
|
28
|
-
def self.
|
29
|
-
|
30
|
-
|
42
|
+
def self.void_credit_note(id, params = {}, opts = {})
|
43
|
+
request_stripe_object(
|
44
|
+
method: :post,
|
45
|
+
path: format("/v1/credit_notes/%<id>s/void", { id: CGI.escape(id) }),
|
46
|
+
params: params,
|
47
|
+
opts: opts
|
48
|
+
)
|
31
49
|
end
|
32
50
|
end
|
33
51
|
end
|
@@ -2,6 +2,9 @@
|
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
4
|
module Stripe
|
5
|
+
# This object represents a customer of your business. It lets you create recurring charges and track payments that belong to the same customer.
|
6
|
+
#
|
7
|
+
# Related guide: [Save a card during payment](https://stripe.com/docs/payments/save-during-payment).
|
5
8
|
class Customer < APIResource
|
6
9
|
extend Stripe::APIOperations::Create
|
7
10
|
include Stripe::APIOperations::Delete
|
@@ -12,21 +15,26 @@ module Stripe
|
|
12
15
|
|
13
16
|
OBJECT_NAME = "customer"
|
14
17
|
|
15
|
-
custom_method :create_funding_instructions, http_verb: :post, http_path: "funding_instructions"
|
16
|
-
custom_method :list_payment_methods, http_verb: :get, http_path: "payment_methods"
|
17
|
-
|
18
|
-
nested_resource_class_methods :cash_balance,
|
19
|
-
operations: %i[retrieve update],
|
20
|
-
resource_plural: "cash_balance"
|
21
18
|
nested_resource_class_methods :balance_transaction,
|
22
19
|
operations: %i[create retrieve update list]
|
20
|
+
nested_resource_class_methods :cash_balance_transaction,
|
21
|
+
operations: %i[retrieve list]
|
23
22
|
nested_resource_class_methods :tax_id,
|
24
23
|
operations: %i[create retrieve delete list]
|
25
24
|
|
26
25
|
def create_funding_instructions(params = {}, opts = {})
|
27
26
|
request_stripe_object(
|
28
27
|
method: :post,
|
29
|
-
path:
|
28
|
+
path: format("/v1/customers/%<customer>s/funding_instructions", { customer: CGI.escape(self["id"]) }),
|
29
|
+
params: params,
|
30
|
+
opts: opts
|
31
|
+
)
|
32
|
+
end
|
33
|
+
|
34
|
+
def delete_discount(params = {}, opts = {})
|
35
|
+
request_stripe_object(
|
36
|
+
method: :delete,
|
37
|
+
path: format("/v1/customers/%<customer>s/discount", { customer: CGI.escape(self["id"]) }),
|
30
38
|
params: params,
|
31
39
|
opts: opts
|
32
40
|
)
|
@@ -35,13 +43,61 @@ module Stripe
|
|
35
43
|
def list_payment_methods(params = {}, opts = {})
|
36
44
|
request_stripe_object(
|
37
45
|
method: :get,
|
38
|
-
path:
|
46
|
+
path: format("/v1/customers/%<customer>s/payment_methods", { customer: CGI.escape(self["id"]) }),
|
47
|
+
params: params,
|
48
|
+
opts: opts
|
49
|
+
)
|
50
|
+
end
|
51
|
+
|
52
|
+
def retrieve_payment_method(payment_method, params = {}, opts = {})
|
53
|
+
request_stripe_object(
|
54
|
+
method: :get,
|
55
|
+
path: format("/v1/customers/%<customer>s/payment_methods/%<payment_method>s", { customer: CGI.escape(self["id"]), payment_method: CGI.escape(payment_method) }),
|
56
|
+
params: params,
|
57
|
+
opts: opts
|
58
|
+
)
|
59
|
+
end
|
60
|
+
|
61
|
+
def self.create_funding_instructions(customer, params = {}, opts = {})
|
62
|
+
request_stripe_object(
|
63
|
+
method: :post,
|
64
|
+
path: format("/v1/customers/%<customer>s/funding_instructions", { customer: CGI.escape(customer) }),
|
65
|
+
params: params,
|
66
|
+
opts: opts
|
67
|
+
)
|
68
|
+
end
|
69
|
+
|
70
|
+
def self.delete_discount(customer, params = {}, opts = {})
|
71
|
+
request_stripe_object(
|
72
|
+
method: :delete,
|
73
|
+
path: format("/v1/customers/%<customer>s/discount", { customer: CGI.escape(customer) }),
|
74
|
+
params: params,
|
75
|
+
opts: opts
|
76
|
+
)
|
77
|
+
end
|
78
|
+
|
79
|
+
def self.list_payment_methods(customer, params = {}, opts = {})
|
80
|
+
request_stripe_object(
|
81
|
+
method: :get,
|
82
|
+
path: format("/v1/customers/%<customer>s/payment_methods", { customer: CGI.escape(customer) }),
|
39
83
|
params: params,
|
40
84
|
opts: opts
|
41
85
|
)
|
42
86
|
end
|
43
87
|
|
44
|
-
|
88
|
+
def self.retrieve_payment_method(
|
89
|
+
customer,
|
90
|
+
payment_method,
|
91
|
+
params = {},
|
92
|
+
opts = {}
|
93
|
+
)
|
94
|
+
request_stripe_object(
|
95
|
+
method: :get,
|
96
|
+
path: format("/v1/customers/%<customer>s/payment_methods/%<payment_method>s", { customer: CGI.escape(customer), payment_method: CGI.escape(payment_method) }),
|
97
|
+
params: params,
|
98
|
+
opts: opts
|
99
|
+
)
|
100
|
+
end
|
45
101
|
|
46
102
|
save_nested_resource :source
|
47
103
|
nested_resource_class_methods :source,
|
@@ -53,16 +109,6 @@ module Stripe
|
|
53
109
|
alias detach_source delete_source
|
54
110
|
end
|
55
111
|
|
56
|
-
# Deletes a discount associated with the customer.
|
57
|
-
#
|
58
|
-
# Returns the deleted discount. The customer object is not updated,
|
59
|
-
# so you must call `refresh` on it to get a new version with the
|
60
|
-
# discount removed.
|
61
|
-
def delete_discount
|
62
|
-
resp, opts = execute_resource_request(:delete, resource_url + "/discount")
|
63
|
-
Util.convert_to_stripe_object(resp.data, opts)
|
64
|
-
end
|
65
|
-
|
66
112
|
def self.search(params = {}, opts = {})
|
67
113
|
_search("/v1/customers/search", params, opts)
|
68
114
|
end
|
@@ -70,5 +116,49 @@ module Stripe
|
|
70
116
|
def self.search_auto_paging_each(params = {}, opts = {}, &blk)
|
71
117
|
search(params, opts).auto_paging_each(&blk)
|
72
118
|
end
|
119
|
+
|
120
|
+
def self.retrieve_cash_balance(customer, params = {}, opts = {})
|
121
|
+
request_stripe_object(
|
122
|
+
method: :get,
|
123
|
+
path: format("/v1/customers/%<customer>s/cash_balance", { customer: CGI.escape(customer) }),
|
124
|
+
params: params,
|
125
|
+
opts: opts
|
126
|
+
)
|
127
|
+
end
|
128
|
+
|
129
|
+
def self.update_cash_balance(customer, params = {}, opts = {})
|
130
|
+
request_stripe_object(
|
131
|
+
method: :post,
|
132
|
+
path: format("/v1/customers/%<customer>s/cash_balance", { customer: CGI.escape(customer) }),
|
133
|
+
params: params,
|
134
|
+
opts: opts
|
135
|
+
)
|
136
|
+
end
|
137
|
+
|
138
|
+
def test_helpers
|
139
|
+
TestHelpers.new(self)
|
140
|
+
end
|
141
|
+
|
142
|
+
class TestHelpers < APIResourceTestHelpers
|
143
|
+
RESOURCE_CLASS = Customer
|
144
|
+
|
145
|
+
def self.fund_cash_balance(customer, params = {}, opts = {})
|
146
|
+
request_stripe_object(
|
147
|
+
method: :post,
|
148
|
+
path: format("/v1/test_helpers/customers/%<customer>s/fund_cash_balance", { customer: CGI.escape(customer) }),
|
149
|
+
params: params,
|
150
|
+
opts: opts
|
151
|
+
)
|
152
|
+
end
|
153
|
+
|
154
|
+
def fund_cash_balance(params = {}, opts = {})
|
155
|
+
@resource.request_stripe_object(
|
156
|
+
method: :post,
|
157
|
+
path: format("/v1/test_helpers/customers/%<customer>s/fund_cash_balance", { customer: CGI.escape(@resource["id"]) }),
|
158
|
+
params: params,
|
159
|
+
opts: opts
|
160
|
+
)
|
161
|
+
end
|
162
|
+
end
|
73
163
|
end
|
74
164
|
end
|
@@ -2,6 +2,12 @@
|
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
4
|
module Stripe
|
5
|
+
# Each customer has a [`balance`](https://stripe.com/docs/api/customers/object#customer_object-balance) value,
|
6
|
+
# which denotes a debit or credit that's automatically applied to their next invoice upon finalization.
|
7
|
+
# You may modify the value directly by using the [update customer API](https://stripe.com/docs/api/customers/update),
|
8
|
+
# or by creating a Customer Balance Transaction, which increments or decrements the customer's `balance` by the specified `amount`.
|
9
|
+
#
|
10
|
+
# Related guide: [Customer Balance](https://stripe.com/docs/billing/customer/balance) to learn more.
|
5
11
|
class CustomerBalanceTransaction < APIResource
|
6
12
|
extend Stripe::APIOperations::List
|
7
13
|
include Stripe::APIOperations::Save
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# File generated from our OpenAPI spec
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
module Stripe
|
5
|
+
# Customers with certain payments enabled have a cash balance, representing funds that were paid
|
6
|
+
# by the customer to a merchant, but have not yet been allocated to a payment. Cash Balance Transactions
|
7
|
+
# represent when funds are moved into or out of this balance. This includes funding by the customer, allocation
|
8
|
+
# to payments, and refunds to the customer.
|
9
|
+
class CustomerCashBalanceTransaction < APIResource
|
10
|
+
extend Stripe::APIOperations::List
|
11
|
+
|
12
|
+
OBJECT_NAME = "customer_cash_balance_transaction"
|
13
|
+
end
|
14
|
+
end
|
@@ -2,6 +2,10 @@
|
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
4
|
module Stripe
|
5
|
+
# A discount represents the actual application of a [coupon](https://stripe.com/docs/api#coupons) or [promotion code](https://stripe.com/docs/api#promotion_codes).
|
6
|
+
# It contains information about when the discount began, when it will end, and what it is applied to.
|
7
|
+
#
|
8
|
+
# Related guide: [Applying Discounts to Subscriptions](https://stripe.com/docs/billing/subscriptions/discounts).
|
5
9
|
class Discount < StripeObject
|
6
10
|
OBJECT_NAME = "discount"
|
7
11
|
end
|
@@ -2,18 +2,32 @@
|
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
4
|
module Stripe
|
5
|
+
# A dispute occurs when a customer questions your charge with their card issuer.
|
6
|
+
# When this happens, you're given the opportunity to respond to the dispute with
|
7
|
+
# evidence that shows that the charge is legitimate. You can find more
|
8
|
+
# information about the dispute process in our [Disputes and
|
9
|
+
# Fraud](https://stripe.com/docs/disputes) documentation.
|
10
|
+
#
|
11
|
+
# Related guide: [Disputes and Fraud](https://stripe.com/docs/disputes).
|
5
12
|
class Dispute < APIResource
|
6
13
|
extend Stripe::APIOperations::List
|
7
14
|
include Stripe::APIOperations::Save
|
8
15
|
|
9
16
|
OBJECT_NAME = "dispute"
|
10
17
|
|
11
|
-
custom_method :close, http_verb: :post
|
12
|
-
|
13
18
|
def close(params = {}, opts = {})
|
14
19
|
request_stripe_object(
|
15
20
|
method: :post,
|
16
|
-
path:
|
21
|
+
path: format("/v1/disputes/%<dispute>s/close", { dispute: CGI.escape(self["id"]) }),
|
22
|
+
params: params,
|
23
|
+
opts: opts
|
24
|
+
)
|
25
|
+
end
|
26
|
+
|
27
|
+
def self.close(dispute, params = {}, opts = {})
|
28
|
+
request_stripe_object(
|
29
|
+
method: :post,
|
30
|
+
path: format("/v1/disputes/%<dispute>s/close", { dispute: CGI.escape(dispute) }),
|
17
31
|
params: params,
|
18
32
|
opts: opts
|
19
33
|
)
|
@@ -2,6 +2,35 @@
|
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
4
|
module Stripe
|
5
|
+
# Events are our way of letting you know when something interesting happens in
|
6
|
+
# your account. When an interesting event occurs, we create a new `Event`
|
7
|
+
# object. For example, when a charge succeeds, we create a `charge.succeeded`
|
8
|
+
# event; and when an invoice payment attempt fails, we create an
|
9
|
+
# `invoice.payment_failed` event. Note that many API requests may cause multiple
|
10
|
+
# events to be created. For example, if you create a new subscription for a
|
11
|
+
# customer, you will receive both a `customer.subscription.created` event and a
|
12
|
+
# `charge.succeeded` event.
|
13
|
+
#
|
14
|
+
# Events occur when the state of another API resource changes. The state of that
|
15
|
+
# resource at the time of the change is embedded in the event's data field. For
|
16
|
+
# example, a `charge.succeeded` event will contain a charge, and an
|
17
|
+
# `invoice.payment_failed` event will contain an invoice.
|
18
|
+
#
|
19
|
+
# As with other API resources, you can use endpoints to retrieve an
|
20
|
+
# [individual event](https://stripe.com/docs/api#retrieve_event) or a [list of events](https://stripe.com/docs/api#list_events)
|
21
|
+
# from the API. We also have a separate
|
22
|
+
# [webhooks](http://en.wikipedia.org/wiki/Webhook) system for sending the
|
23
|
+
# `Event` objects directly to an endpoint on your server. Webhooks are managed
|
24
|
+
# in your
|
25
|
+
# [account settings](https://dashboard.stripe.com/account/webhooks),
|
26
|
+
# and our [Using Webhooks](https://stripe.com/docs/webhooks) guide will help you get set up.
|
27
|
+
#
|
28
|
+
# When using [Connect](https://stripe.com/docs/connect), you can also receive notifications of
|
29
|
+
# events that occur in connected accounts. For these events, there will be an
|
30
|
+
# additional `account` attribute in the received `Event` object.
|
31
|
+
#
|
32
|
+
# **NOTE:** Right now, access to events through the [Retrieve Event API](https://stripe.com/docs/api#retrieve_event) is
|
33
|
+
# guaranteed only for 30 days.
|
5
34
|
class Event < APIResource
|
6
35
|
extend Stripe::APIOperations::List
|
7
36
|
|
@@ -2,6 +2,17 @@
|
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
4
|
module Stripe
|
5
|
+
# `Exchange Rate` objects allow you to determine the rates that Stripe is
|
6
|
+
# currently using to convert from one currency to another. Since this number is
|
7
|
+
# variable throughout the day, there are various reasons why you might want to
|
8
|
+
# know the current rate (for example, to dynamically price an item for a user
|
9
|
+
# with a default payment in a foreign currency).
|
10
|
+
#
|
11
|
+
# If you want a guarantee that the charge is made with a certain exchange rate
|
12
|
+
# you expect is current, you can pass in `exchange_rate` to charges endpoints.
|
13
|
+
# If the value is no longer up to date, the charge won't go through. Please
|
14
|
+
# refer to our [Exchange Rates API](https://stripe.com/docs/exchange-rates) guide for more
|
15
|
+
# details.
|
5
16
|
class ExchangeRate < APIResource
|
6
17
|
extend Stripe::APIOperations::List
|
7
18
|
|
@@ -2,6 +2,13 @@
|
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
4
|
module Stripe
|
5
|
+
# This is an object representing a file hosted on Stripe's servers. The
|
6
|
+
# file may have been uploaded by yourself using the [create file](https://stripe.com/docs/api#create_file)
|
7
|
+
# request (for example, when uploading dispute evidence) or it may have
|
8
|
+
# been created by Stripe (for example, the results of a [Sigma scheduled
|
9
|
+
# query](https://stripe.com/docs/api#scheduled_queries)).
|
10
|
+
#
|
11
|
+
# Related guide: [File Upload Guide](https://stripe.com/docs/file-upload).
|
5
12
|
class File < APIResource
|
6
13
|
extend Stripe::APIOperations::Create
|
7
14
|
extend Stripe::APIOperations::List
|
@@ -2,6 +2,9 @@
|
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
4
|
module Stripe
|
5
|
+
# To share the contents of a `File` object with non-Stripe users, you can
|
6
|
+
# create a `FileLink`. `FileLink`s contain a URL that can be used to
|
7
|
+
# retrieve the contents of the file without authentication.
|
5
8
|
class FileLink < APIResource
|
6
9
|
extend Stripe::APIOperations::Create
|
7
10
|
extend Stripe::APIOperations::List
|
@@ -3,25 +3,61 @@
|
|
3
3
|
|
4
4
|
module Stripe
|
5
5
|
module FinancialConnections
|
6
|
+
# A Financial Connections Account represents an account that exists outside of Stripe, to which you have been granted some degree of access.
|
6
7
|
class Account < APIResource
|
7
|
-
|
8
|
+
extend Stripe::APIOperations::List
|
8
9
|
|
9
|
-
|
10
|
-
custom_method :refresh, http_verb: :post
|
10
|
+
OBJECT_NAME = "financial_connections.account"
|
11
11
|
|
12
12
|
def disconnect(params = {}, opts = {})
|
13
13
|
request_stripe_object(
|
14
14
|
method: :post,
|
15
|
-
path:
|
15
|
+
path: format("/v1/financial_connections/accounts/%<account>s/disconnect", { account: CGI.escape(self["id"]) }),
|
16
|
+
params: params,
|
17
|
+
opts: opts
|
18
|
+
)
|
19
|
+
end
|
20
|
+
|
21
|
+
def list_owners(params = {}, opts = {})
|
22
|
+
request_stripe_object(
|
23
|
+
method: :get,
|
24
|
+
path: format("/v1/financial_connections/accounts/%<account>s/owners", { account: CGI.escape(self["id"]) }),
|
25
|
+
params: params,
|
26
|
+
opts: opts
|
27
|
+
)
|
28
|
+
end
|
29
|
+
|
30
|
+
def refresh_account(params = {}, opts = {})
|
31
|
+
request_stripe_object(
|
32
|
+
method: :post,
|
33
|
+
path: format("/v1/financial_connections/accounts/%<account>s/refresh", { account: CGI.escape(self["id"]) }),
|
34
|
+
params: params,
|
35
|
+
opts: opts
|
36
|
+
)
|
37
|
+
end
|
38
|
+
|
39
|
+
def self.disconnect(account, params = {}, opts = {})
|
40
|
+
request_stripe_object(
|
41
|
+
method: :post,
|
42
|
+
path: format("/v1/financial_connections/accounts/%<account>s/disconnect", { account: CGI.escape(account) }),
|
43
|
+
params: params,
|
44
|
+
opts: opts
|
45
|
+
)
|
46
|
+
end
|
47
|
+
|
48
|
+
def self.list_owners(account, params = {}, opts = {})
|
49
|
+
request_stripe_object(
|
50
|
+
method: :get,
|
51
|
+
path: format("/v1/financial_connections/accounts/%<account>s/owners", { account: CGI.escape(account) }),
|
16
52
|
params: params,
|
17
53
|
opts: opts
|
18
54
|
)
|
19
55
|
end
|
20
56
|
|
21
|
-
def
|
57
|
+
def self.refresh_account(account, params = {}, opts = {})
|
22
58
|
request_stripe_object(
|
23
59
|
method: :post,
|
24
|
-
path:
|
60
|
+
path: format("/v1/financial_connections/accounts/%<account>s/refresh", { account: CGI.escape(account) }),
|
25
61
|
params: params,
|
26
62
|
opts: opts
|
27
63
|
)
|
@@ -3,6 +3,7 @@
|
|
3
3
|
|
4
4
|
module Stripe
|
5
5
|
module FinancialConnections
|
6
|
+
# A Financial Connections Session is the secure way to programmatically launch the client-side Stripe.js modal that lets your users link their accounts.
|
6
7
|
class Session < APIResource
|
7
8
|
extend Stripe::APIOperations::Create
|
8
9
|
|
@@ -2,6 +2,11 @@
|
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
4
|
module Stripe
|
5
|
+
# Each customer has a [`balance`](https://stripe.com/docs/api/customers/object#customer_object-balance) that is
|
6
|
+
# automatically applied to future invoices and payments using the `customer_balance` payment method.
|
7
|
+
# Customers can fund this balance by initiating a bank transfer to any account in the
|
8
|
+
# `financial_addresses` field.
|
9
|
+
# Related guide: [Customer Balance - Funding Instructions](https://stripe.com/docs/payments/customer-balance/funding-instructions) to learn more
|
5
10
|
class FundingInstructions < APIResource
|
6
11
|
OBJECT_NAME = "funding_instructions"
|
7
12
|
|