stripe 10.1.0 → 12.6.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 +215 -21
- data/Gemfile +6 -5
- data/Makefile +8 -1
- data/OPENAPI_VERSION +1 -1
- data/README.md +46 -14
- data/Rakefile +7 -5
- data/VERSION +1 -1
- data/{bin → exe}/stripe-console +1 -1
- data/lib/stripe/api_operations/nested_resource.rb +22 -2
- data/lib/stripe/api_operations/request.rb +22 -18
- data/lib/stripe/api_operations/save.rb +7 -9
- data/lib/stripe/api_operations/search.rb +5 -0
- data/lib/stripe/api_operations/singleton_save.rb +86 -0
- data/lib/stripe/api_resource.rb +13 -4
- data/lib/stripe/api_resource_test_helpers.rb +7 -3
- data/lib/stripe/api_version.rb +1 -1
- data/lib/stripe/connection_manager.rb +4 -6
- data/lib/stripe/errors.rb +3 -11
- data/lib/stripe/instrumentation.rb +5 -21
- data/lib/stripe/list_object.rb +3 -0
- data/lib/stripe/multipart_encoder.rb +7 -7
- data/lib/stripe/oauth.rb +6 -6
- data/lib/stripe/object_types.rb +135 -116
- data/lib/stripe/resources/account.rb +103 -25
- data/lib/stripe/resources/account_link.rb +8 -0
- data/lib/stripe/resources/account_session.rb +8 -0
- data/lib/stripe/resources/alipay_account.rb +1 -1
- data/lib/stripe/resources/apple_pay_domain.rb +43 -0
- data/lib/stripe/resources/application_fee.rb +8 -0
- data/lib/stripe/resources/application_fee_refund.rb +4 -2
- data/lib/stripe/resources/apps/secret.rb +15 -0
- data/lib/stripe/resources/balance.rb +3 -0
- data/lib/stripe/resources/balance_transaction.rb +15 -0
- data/lib/stripe/resources/bank_account.rb +49 -7
- data/lib/stripe/resources/billing/alert.rb +87 -0
- data/lib/stripe/resources/billing/meter.rb +83 -0
- data/lib/stripe/resources/billing/meter_event.rb +27 -0
- data/lib/stripe/resources/billing/meter_event_adjustment.rb +26 -0
- data/lib/stripe/resources/billing/meter_event_summary.rb +15 -0
- data/lib/stripe/resources/billing_portal/configuration.rb +33 -0
- data/lib/stripe/resources/billing_portal/session.rb +14 -1
- data/lib/stripe/resources/capability.rb +4 -2
- data/lib/stripe/resources/card.rb +28 -0
- data/lib/stripe/resources/cash_balance.rb +3 -0
- data/lib/stripe/resources/charge.rb +39 -1
- data/lib/stripe/resources/checkout/session.rb +47 -5
- data/lib/stripe/resources/climate/order.rb +67 -0
- data/lib/stripe/resources/climate/product.rb +27 -0
- data/lib/stripe/resources/climate/supplier.rb +26 -0
- data/lib/stripe/resources/confirmation_token.rb +39 -0
- data/lib/stripe/resources/country_spec.rb +8 -0
- data/lib/stripe/resources/coupon.rb +45 -0
- data/lib/stripe/resources/credit_note.rb +47 -7
- data/lib/stripe/resources/credit_note_line_item.rb +3 -0
- data/lib/stripe/resources/customer.rb +89 -26
- data/lib/stripe/resources/customer_balance_transaction.rb +3 -1
- data/lib/stripe/resources/customer_cash_balance_transaction.rb +3 -2
- data/lib/stripe/resources/customer_session.rb +29 -0
- data/lib/stripe/resources/discount.rb +3 -0
- data/lib/stripe/resources/dispute.rb +26 -0
- data/lib/stripe/resources/entitlements/active_entitlement.rb +26 -0
- data/lib/stripe/resources/entitlements/feature.rb +49 -0
- data/lib/stripe/resources/ephemeral_key.rb +23 -0
- data/lib/stripe/resources/event.rb +11 -3
- data/lib/stripe/resources/exchange_rate.rb +8 -0
- data/lib/stripe/resources/file.rb +29 -16
- data/lib/stripe/resources/file_link.rb +23 -0
- data/lib/stripe/resources/financial_connections/account.rb +66 -7
- data/lib/stripe/resources/financial_connections/account_owner.rb +3 -0
- data/lib/stripe/resources/financial_connections/account_ownership.rb +3 -0
- data/lib/stripe/resources/financial_connections/session.rb +13 -0
- data/lib/stripe/resources/financial_connections/transaction.rb +26 -0
- data/lib/stripe/resources/forwarding/request.rb +52 -0
- data/lib/stripe/resources/funding_instructions.rb +3 -0
- data/lib/stripe/resources/identity/verification_report.rb +14 -1
- data/lib/stripe/resources/identity/verification_session.rb +90 -4
- data/lib/stripe/resources/invoice.rb +170 -17
- data/lib/stripe/resources/invoice_item.rb +43 -0
- data/lib/stripe/resources/invoice_line_item.rb +21 -0
- data/lib/stripe/resources/invoice_rendering_template.rb +63 -0
- data/lib/stripe/resources/issuing/authorization.rb +88 -14
- data/lib/stripe/resources/issuing/card.rb +50 -16
- data/lib/stripe/resources/issuing/cardholder.rb +33 -0
- data/lib/stripe/resources/issuing/dispute.rb +35 -0
- data/lib/stripe/resources/issuing/personalization_design.rb +119 -0
- data/lib/stripe/resources/issuing/physical_bundle.rb +26 -0
- data/lib/stripe/resources/issuing/token.rb +18 -0
- data/lib/stripe/resources/issuing/transaction.rb +30 -0
- data/lib/stripe/resources/line_item.rb +3 -0
- data/lib/stripe/resources/login_link.rb +4 -1
- data/lib/stripe/resources/mandate.rb +3 -0
- data/lib/stripe/resources/payment_intent.rb +190 -25
- data/lib/stripe/resources/payment_link.rb +25 -0
- data/lib/stripe/resources/payment_method.rb +57 -4
- data/lib/stripe/resources/payment_method_configuration.rb +33 -0
- data/lib/stripe/resources/payment_method_domain.rb +46 -1
- data/lib/stripe/resources/payout.rb +39 -4
- data/lib/stripe/resources/person.rb +5 -4
- data/lib/stripe/resources/plan.rb +43 -0
- data/lib/stripe/resources/price.rb +24 -1
- data/lib/stripe/resources/product.rb +47 -1
- data/lib/stripe/resources/product_feature.rb +13 -0
- data/lib/stripe/resources/promotion_code.rb +23 -0
- data/lib/stripe/resources/quote.rb +67 -32
- data/lib/stripe/resources/radar/early_fraud_warning.rb +13 -0
- data/lib/stripe/resources/radar/value_list.rb +53 -0
- data/lib/stripe/resources/radar/value_list_item.rb +43 -0
- data/lib/stripe/resources/refund.rb +46 -0
- data/lib/stripe/resources/reporting/report_run.rb +23 -0
- data/lib/stripe/resources/reporting/report_type.rb +13 -0
- data/lib/stripe/resources/reversal.rb +5 -3
- data/lib/stripe/resources/review.rb +10 -0
- data/lib/stripe/resources/setup_attempt.rb +8 -0
- data/lib/stripe/resources/setup_intent.rb +72 -10
- data/lib/stripe/resources/shipping_rate.rb +23 -0
- data/lib/stripe/resources/sigma/scheduled_query_run.rb +13 -0
- data/lib/stripe/resources/source.rb +23 -1
- data/lib/stripe/resources/source_transaction.rb +3 -0
- data/lib/stripe/resources/subscription.rb +81 -13
- data/lib/stripe/resources/subscription_item.rb +54 -1
- data/lib/stripe/resources/subscription_schedule.rb +41 -4
- data/lib/stripe/resources/tax/calculation.rb +15 -0
- data/lib/stripe/resources/tax/calculation_line_item.rb +3 -0
- data/lib/stripe/resources/tax/registration.rb +35 -0
- data/lib/stripe/resources/tax/settings.rb +4 -2
- data/lib/stripe/resources/tax/transaction.rb +15 -8
- data/lib/stripe/resources/tax/transaction_line_item.rb +3 -0
- data/lib/stripe/resources/tax_code.rb +8 -0
- data/lib/stripe/resources/tax_id.rb +30 -12
- data/lib/stripe/resources/tax_rate.rb +23 -0
- data/lib/stripe/resources/terminal/configuration.rb +53 -0
- data/lib/stripe/resources/terminal/connection_token.rb +13 -0
- data/lib/stripe/resources/terminal/location.rb +54 -0
- data/lib/stripe/resources/terminal/reader.rb +80 -12
- data/lib/stripe/resources/test_helpers/test_clock.rb +45 -0
- data/lib/stripe/resources/token.rb +10 -1
- data/lib/stripe/resources/topup.rb +25 -0
- data/lib/stripe/resources/transfer.rb +26 -1
- data/lib/stripe/resources/treasury/credit_reversal.rb +23 -0
- data/lib/stripe/resources/treasury/debit_reversal.rb +23 -0
- data/lib/stripe/resources/treasury/financial_account.rb +42 -5
- data/lib/stripe/resources/treasury/financial_account_features.rb +3 -0
- data/lib/stripe/resources/treasury/inbound_transfer.rb +47 -11
- data/lib/stripe/resources/treasury/outbound_payment.rb +64 -8
- data/lib/stripe/resources/treasury/outbound_transfer.rb +64 -8
- data/lib/stripe/resources/treasury/received_credit.rb +17 -0
- data/lib/stripe/resources/treasury/received_debit.rb +17 -0
- data/lib/stripe/resources/treasury/transaction.rb +13 -0
- data/lib/stripe/resources/treasury/transaction_entry.rb +13 -0
- data/lib/stripe/resources/usage_record.rb +5 -0
- data/lib/stripe/resources/usage_record_summary.rb +3 -0
- data/lib/stripe/resources/webhook_endpoint.rb +55 -2
- data/lib/stripe/resources.rb +18 -0
- data/lib/stripe/search_result_object.rb +4 -1
- data/lib/stripe/singleton_api_resource.rb +20 -3
- data/lib/stripe/stripe_client.rb +61 -63
- data/lib/stripe/stripe_configuration.rb +13 -29
- data/lib/stripe/stripe_object.rb +23 -21
- data/lib/stripe/stripe_response.rb +1 -3
- data/lib/stripe/util.rb +13 -15
- data/lib/stripe/version.rb +1 -1
- data/lib/stripe.rb +26 -0
- data/stripe.gemspec +7 -4
- metadata +25 -5
@@ -0,0 +1,67 @@
|
|
1
|
+
# File generated from our OpenAPI spec
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
module Stripe
|
5
|
+
module Climate
|
6
|
+
# Orders represent your intent to purchase a particular Climate product. When you create an order, the
|
7
|
+
# payment is deducted from your merchant balance.
|
8
|
+
class Order < APIResource
|
9
|
+
extend Stripe::APIOperations::Create
|
10
|
+
extend Stripe::APIOperations::List
|
11
|
+
include Stripe::APIOperations::Save
|
12
|
+
|
13
|
+
OBJECT_NAME = "climate.order"
|
14
|
+
def self.object_name
|
15
|
+
"climate.order"
|
16
|
+
end
|
17
|
+
|
18
|
+
# Cancels a Climate order. You can cancel an order within 24 hours of creation. Stripe refunds the
|
19
|
+
# reservation amount_subtotal, but not the amount_fees for user-triggered cancellations. Frontier
|
20
|
+
# might cancel reservations if suppliers fail to deliver. If Frontier cancels the reservation, Stripe
|
21
|
+
# provides 90 days advance notice and refunds the amount_total.
|
22
|
+
def cancel(params = {}, opts = {})
|
23
|
+
request_stripe_object(
|
24
|
+
method: :post,
|
25
|
+
path: format("/v1/climate/orders/%<order>s/cancel", { order: CGI.escape(self["id"]) }),
|
26
|
+
params: params,
|
27
|
+
opts: opts
|
28
|
+
)
|
29
|
+
end
|
30
|
+
|
31
|
+
# Cancels a Climate order. You can cancel an order within 24 hours of creation. Stripe refunds the
|
32
|
+
# reservation amount_subtotal, but not the amount_fees for user-triggered cancellations. Frontier
|
33
|
+
# might cancel reservations if suppliers fail to deliver. If Frontier cancels the reservation, Stripe
|
34
|
+
# provides 90 days advance notice and refunds the amount_total.
|
35
|
+
def self.cancel(order, params = {}, opts = {})
|
36
|
+
request_stripe_object(
|
37
|
+
method: :post,
|
38
|
+
path: format("/v1/climate/orders/%<order>s/cancel", { order: CGI.escape(order) }),
|
39
|
+
params: params,
|
40
|
+
opts: opts
|
41
|
+
)
|
42
|
+
end
|
43
|
+
|
44
|
+
# Creates a Climate order object for a given Climate product. The order will be processed immediately
|
45
|
+
# after creation and payment will be deducted your Stripe balance.
|
46
|
+
def self.create(params = {}, opts = {})
|
47
|
+
request_stripe_object(method: :post, path: "/v1/climate/orders", params: params, opts: opts)
|
48
|
+
end
|
49
|
+
|
50
|
+
# Lists all Climate order objects. The orders are returned sorted by creation date, with the
|
51
|
+
# most recently created orders appearing first.
|
52
|
+
def self.list(filters = {}, opts = {})
|
53
|
+
request_stripe_object(method: :get, path: "/v1/climate/orders", params: filters, opts: opts)
|
54
|
+
end
|
55
|
+
|
56
|
+
# Updates the specified order by setting the values of the parameters passed.
|
57
|
+
def self.update(id, params = {}, opts = {})
|
58
|
+
request_stripe_object(
|
59
|
+
method: :post,
|
60
|
+
path: format("/v1/climate/orders/%<id>s", { id: CGI.escape(id) }),
|
61
|
+
params: params,
|
62
|
+
opts: opts
|
63
|
+
)
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# File generated from our OpenAPI spec
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
module Stripe
|
5
|
+
module Climate
|
6
|
+
# A Climate product represents a type of carbon removal unit available for reservation.
|
7
|
+
# You can retrieve it to see the current price and availability.
|
8
|
+
class Product < APIResource
|
9
|
+
extend Stripe::APIOperations::List
|
10
|
+
|
11
|
+
OBJECT_NAME = "climate.product"
|
12
|
+
def self.object_name
|
13
|
+
"climate.product"
|
14
|
+
end
|
15
|
+
|
16
|
+
# Lists all available Climate product objects.
|
17
|
+
def self.list(filters = {}, opts = {})
|
18
|
+
request_stripe_object(
|
19
|
+
method: :get,
|
20
|
+
path: "/v1/climate/products",
|
21
|
+
params: filters,
|
22
|
+
opts: opts
|
23
|
+
)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# File generated from our OpenAPI spec
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
module Stripe
|
5
|
+
module Climate
|
6
|
+
# A supplier of carbon removal.
|
7
|
+
class Supplier < APIResource
|
8
|
+
extend Stripe::APIOperations::List
|
9
|
+
|
10
|
+
OBJECT_NAME = "climate.supplier"
|
11
|
+
def self.object_name
|
12
|
+
"climate.supplier"
|
13
|
+
end
|
14
|
+
|
15
|
+
# Lists all available Climate supplier objects.
|
16
|
+
def self.list(filters = {}, opts = {})
|
17
|
+
request_stripe_object(
|
18
|
+
method: :get,
|
19
|
+
path: "/v1/climate/suppliers",
|
20
|
+
params: filters,
|
21
|
+
opts: opts
|
22
|
+
)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
# File generated from our OpenAPI spec
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
module Stripe
|
5
|
+
# ConfirmationTokens help transport client side data collected by Stripe JS over
|
6
|
+
# to your server for confirming a PaymentIntent or SetupIntent. If the confirmation
|
7
|
+
# is successful, values present on the ConfirmationToken are written onto the Intent.
|
8
|
+
#
|
9
|
+
# To learn more about how to use ConfirmationToken, visit the related guides:
|
10
|
+
# - [Finalize payments on the server](https://stripe.com/docs/payments/finalize-payments-on-the-server)
|
11
|
+
# - [Build two-step confirmation](https://stripe.com/docs/payments/build-a-two-step-confirmation).
|
12
|
+
class ConfirmationToken < APIResource
|
13
|
+
OBJECT_NAME = "confirmation_token"
|
14
|
+
def self.object_name
|
15
|
+
"confirmation_token"
|
16
|
+
end
|
17
|
+
|
18
|
+
def test_helpers
|
19
|
+
TestHelpers.new(self)
|
20
|
+
end
|
21
|
+
|
22
|
+
class TestHelpers < APIResourceTestHelpers
|
23
|
+
RESOURCE_CLASS = ConfirmationToken
|
24
|
+
def self.resource_class
|
25
|
+
"ConfirmationToken"
|
26
|
+
end
|
27
|
+
|
28
|
+
# Creates a test mode Confirmation Token server side for your integration tests.
|
29
|
+
def self.create(params = {}, opts = {})
|
30
|
+
request_stripe_object(
|
31
|
+
method: :post,
|
32
|
+
path: "/v1/test_helpers/confirmation_tokens",
|
33
|
+
params: params,
|
34
|
+
opts: opts
|
35
|
+
)
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -12,5 +12,13 @@ module Stripe
|
|
12
12
|
extend Stripe::APIOperations::List
|
13
13
|
|
14
14
|
OBJECT_NAME = "country_spec"
|
15
|
+
def self.object_name
|
16
|
+
"country_spec"
|
17
|
+
end
|
18
|
+
|
19
|
+
# Lists all Country Spec objects available in the API.
|
20
|
+
def self.list(filters = {}, opts = {})
|
21
|
+
request_stripe_object(method: :get, path: "/v1/country_specs", params: filters, opts: opts)
|
22
|
+
end
|
15
23
|
end
|
16
24
|
end
|
@@ -12,5 +12,50 @@ module Stripe
|
|
12
12
|
include Stripe::APIOperations::Save
|
13
13
|
|
14
14
|
OBJECT_NAME = "coupon"
|
15
|
+
def self.object_name
|
16
|
+
"coupon"
|
17
|
+
end
|
18
|
+
|
19
|
+
# You can create coupons easily via the [coupon management](https://dashboard.stripe.com/coupons) page of the Stripe dashboard. Coupon creation is also accessible via the API if you need to create coupons on the fly.
|
20
|
+
#
|
21
|
+
# A coupon has either a percent_off or an amount_off and currency. If you set an amount_off, that amount will be subtracted from any invoice's subtotal. For example, an invoice with a subtotal of 100 will have a final total of 0 if a coupon with an amount_off of 200 is applied to it and an invoice with a subtotal of 300 will have a final total of 100 if a coupon with an amount_off of 200 is applied to it.
|
22
|
+
def self.create(params = {}, opts = {})
|
23
|
+
request_stripe_object(method: :post, path: "/v1/coupons", params: params, opts: opts)
|
24
|
+
end
|
25
|
+
|
26
|
+
# You can delete coupons via the [coupon management](https://dashboard.stripe.com/coupons) page of the Stripe dashboard. However, deleting a coupon does not affect any customers who have already applied the coupon; it means that new customers can't redeem the coupon. You can also delete coupons via the API.
|
27
|
+
def self.delete(id, params = {}, opts = {})
|
28
|
+
request_stripe_object(
|
29
|
+
method: :delete,
|
30
|
+
path: format("/v1/coupons/%<id>s", { id: CGI.escape(id) }),
|
31
|
+
params: params,
|
32
|
+
opts: opts
|
33
|
+
)
|
34
|
+
end
|
35
|
+
|
36
|
+
# You can delete coupons via the [coupon management](https://dashboard.stripe.com/coupons) page of the Stripe dashboard. However, deleting a coupon does not affect any customers who have already applied the coupon; it means that new customers can't redeem the coupon. You can also delete coupons via the API.
|
37
|
+
def delete(params = {}, opts = {})
|
38
|
+
request_stripe_object(
|
39
|
+
method: :delete,
|
40
|
+
path: format("/v1/coupons/%<coupon>s", { coupon: CGI.escape(self["id"]) }),
|
41
|
+
params: params,
|
42
|
+
opts: opts
|
43
|
+
)
|
44
|
+
end
|
45
|
+
|
46
|
+
# Returns a list of your coupons.
|
47
|
+
def self.list(filters = {}, opts = {})
|
48
|
+
request_stripe_object(method: :get, path: "/v1/coupons", params: filters, opts: opts)
|
49
|
+
end
|
50
|
+
|
51
|
+
# Updates the metadata of a coupon. Other coupon details (currency, duration, amount_off) are, by design, not editable.
|
52
|
+
def self.update(id, params = {}, opts = {})
|
53
|
+
request_stripe_object(
|
54
|
+
method: :post,
|
55
|
+
path: format("/v1/coupons/%<id>s", { id: CGI.escape(id) }),
|
56
|
+
params: params,
|
57
|
+
opts: opts
|
58
|
+
)
|
59
|
+
end
|
15
60
|
end
|
16
61
|
end
|
@@ -11,16 +11,34 @@ module Stripe
|
|
11
11
|
include Stripe::APIOperations::Save
|
12
12
|
|
13
13
|
OBJECT_NAME = "credit_note"
|
14
|
+
def self.object_name
|
15
|
+
"credit_note"
|
16
|
+
end
|
14
17
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
18
|
+
# Issue a credit note to adjust the amount of a finalized invoice. For a status=open invoice, a credit note reduces
|
19
|
+
# its amount_due. For a status=paid invoice, a credit note does not affect its amount_due. Instead, it can result
|
20
|
+
# in any combination of the following:
|
21
|
+
#
|
22
|
+
#
|
23
|
+
# Refund: create a new refund (using refund_amount) or link an existing refund (using refund).
|
24
|
+
# Customer balance credit: credit the customer's balance (using credit_amount) which will be automatically applied to their next invoice when it's finalized.
|
25
|
+
# Outside of Stripe credit: record the amount that is or will be credited outside of Stripe (using out_of_band_amount).
|
26
|
+
#
|
27
|
+
#
|
28
|
+
# For post-payment credit notes the sum of the refund, credit and outside of Stripe amounts must equal the credit note total.
|
29
|
+
#
|
30
|
+
# You may issue multiple credit notes for an invoice. Each credit note will increment the invoice's pre_payment_credit_notes_amount
|
31
|
+
# or post_payment_credit_notes_amount depending on its status at the time of credit note creation.
|
32
|
+
def self.create(params = {}, opts = {})
|
33
|
+
request_stripe_object(method: :post, path: "/v1/credit_notes", params: params, opts: opts)
|
34
|
+
end
|
35
|
+
|
36
|
+
# Returns a list of credit notes.
|
37
|
+
def self.list(filters = {}, opts = {})
|
38
|
+
request_stripe_object(method: :get, path: "/v1/credit_notes", params: filters, opts: opts)
|
22
39
|
end
|
23
40
|
|
41
|
+
# 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.
|
24
42
|
def self.list_preview_line_items(params = {}, opts = {})
|
25
43
|
request_stripe_object(
|
26
44
|
method: :get,
|
@@ -30,6 +48,7 @@ module Stripe
|
|
30
48
|
)
|
31
49
|
end
|
32
50
|
|
51
|
+
# Get a preview of a credit note without creating it.
|
33
52
|
def self.preview(params = {}, opts = {})
|
34
53
|
request_stripe_object(
|
35
54
|
method: :get,
|
@@ -39,6 +58,27 @@ module Stripe
|
|
39
58
|
)
|
40
59
|
end
|
41
60
|
|
61
|
+
# Updates an existing credit note.
|
62
|
+
def self.update(id, params = {}, opts = {})
|
63
|
+
request_stripe_object(
|
64
|
+
method: :post,
|
65
|
+
path: format("/v1/credit_notes/%<id>s", { id: CGI.escape(id) }),
|
66
|
+
params: params,
|
67
|
+
opts: opts
|
68
|
+
)
|
69
|
+
end
|
70
|
+
|
71
|
+
# Marks a credit note as void. Learn more about [voiding credit notes](https://stripe.com/docs/billing/invoices/credit-notes#voiding).
|
72
|
+
def void_credit_note(params = {}, opts = {})
|
73
|
+
request_stripe_object(
|
74
|
+
method: :post,
|
75
|
+
path: format("/v1/credit_notes/%<id>s/void", { id: CGI.escape(self["id"]) }),
|
76
|
+
params: params,
|
77
|
+
opts: opts
|
78
|
+
)
|
79
|
+
end
|
80
|
+
|
81
|
+
# Marks a credit note as void. Learn more about [voiding credit notes](https://stripe.com/docs/billing/invoices/credit-notes#voiding).
|
42
82
|
def self.void_credit_note(id, params = {}, opts = {})
|
43
83
|
request_stripe_object(
|
44
84
|
method: :post,
|
@@ -9,16 +9,28 @@ module Stripe
|
|
9
9
|
extend Stripe::APIOperations::Create
|
10
10
|
include Stripe::APIOperations::Delete
|
11
11
|
extend Stripe::APIOperations::List
|
12
|
+
extend Stripe::APIOperations::NestedResource
|
12
13
|
extend Stripe::APIOperations::Search
|
13
14
|
include Stripe::APIOperations::Save
|
14
|
-
extend Stripe::APIOperations::NestedResource
|
15
15
|
|
16
16
|
OBJECT_NAME = "customer"
|
17
|
+
def self.object_name
|
18
|
+
"customer"
|
19
|
+
end
|
17
20
|
|
18
21
|
nested_resource_class_methods :balance_transaction, operations: %i[create retrieve update list]
|
19
22
|
nested_resource_class_methods :cash_balance_transaction, operations: %i[retrieve list]
|
23
|
+
nested_resource_class_methods :source, operations: %i[create retrieve update delete list]
|
20
24
|
nested_resource_class_methods :tax_id, operations: %i[create retrieve delete list]
|
21
25
|
|
26
|
+
# Creates a new customer object.
|
27
|
+
def self.create(params = {}, opts = {})
|
28
|
+
request_stripe_object(method: :post, path: "/v1/customers", params: params, opts: opts)
|
29
|
+
end
|
30
|
+
|
31
|
+
# Retrieve funding instructions for a customer cash balance. If funding instructions do not yet exist for the customer, new
|
32
|
+
# funding instructions will be created. If funding instructions have already been created for a given customer, the same
|
33
|
+
# funding instructions will be retrieved. In other words, we will return the same funding instructions each time.
|
22
34
|
def create_funding_instructions(params = {}, opts = {})
|
23
35
|
request_stripe_object(
|
24
36
|
method: :post,
|
@@ -28,42 +40,49 @@ module Stripe
|
|
28
40
|
)
|
29
41
|
end
|
30
42
|
|
31
|
-
|
43
|
+
# Retrieve funding instructions for a customer cash balance. If funding instructions do not yet exist for the customer, new
|
44
|
+
# funding instructions will be created. If funding instructions have already been created for a given customer, the same
|
45
|
+
# funding instructions will be retrieved. In other words, we will return the same funding instructions each time.
|
46
|
+
def self.create_funding_instructions(customer, params = {}, opts = {})
|
32
47
|
request_stripe_object(
|
33
|
-
method: :
|
34
|
-
path: format("/v1/customers/%<customer>s/
|
48
|
+
method: :post,
|
49
|
+
path: format("/v1/customers/%<customer>s/funding_instructions", { customer: CGI.escape(customer) }),
|
35
50
|
params: params,
|
36
51
|
opts: opts
|
37
52
|
)
|
38
53
|
end
|
39
54
|
|
40
|
-
|
55
|
+
# Permanently deletes a customer. It cannot be undone. Also immediately cancels any active subscriptions on the customer.
|
56
|
+
def self.delete(id, params = {}, opts = {})
|
41
57
|
request_stripe_object(
|
42
|
-
method: :
|
43
|
-
path: format("/v1/customers/%<
|
58
|
+
method: :delete,
|
59
|
+
path: format("/v1/customers/%<id>s", { id: CGI.escape(id) }),
|
44
60
|
params: params,
|
45
61
|
opts: opts
|
46
62
|
)
|
47
63
|
end
|
48
64
|
|
49
|
-
|
65
|
+
# Permanently deletes a customer. It cannot be undone. Also immediately cancels any active subscriptions on the customer.
|
66
|
+
def delete(params = {}, opts = {})
|
50
67
|
request_stripe_object(
|
51
|
-
method: :
|
52
|
-
path: format("/v1/customers/%<customer>s
|
68
|
+
method: :delete,
|
69
|
+
path: format("/v1/customers/%<customer>s", { customer: CGI.escape(self["id"]) }),
|
53
70
|
params: params,
|
54
71
|
opts: opts
|
55
72
|
)
|
56
73
|
end
|
57
74
|
|
58
|
-
|
75
|
+
# Removes the currently applied discount on a customer.
|
76
|
+
def delete_discount(params = {}, opts = {})
|
59
77
|
request_stripe_object(
|
60
|
-
method: :
|
61
|
-
path: format("/v1/customers/%<customer>s/
|
78
|
+
method: :delete,
|
79
|
+
path: format("/v1/customers/%<customer>s/discount", { customer: CGI.escape(self["id"]) }),
|
62
80
|
params: params,
|
63
81
|
opts: opts
|
64
82
|
)
|
65
83
|
end
|
66
84
|
|
85
|
+
# Removes the currently applied discount on a customer.
|
67
86
|
def self.delete_discount(customer, params = {}, opts = {})
|
68
87
|
request_stripe_object(
|
69
88
|
method: :delete,
|
@@ -73,6 +92,22 @@ module Stripe
|
|
73
92
|
)
|
74
93
|
end
|
75
94
|
|
95
|
+
# Returns a list of your customers. The customers are returned sorted by creation date, with the most recent customers appearing first.
|
96
|
+
def self.list(filters = {}, opts = {})
|
97
|
+
request_stripe_object(method: :get, path: "/v1/customers", params: filters, opts: opts)
|
98
|
+
end
|
99
|
+
|
100
|
+
# Returns a list of PaymentMethods for a given Customer
|
101
|
+
def list_payment_methods(params = {}, opts = {})
|
102
|
+
request_stripe_object(
|
103
|
+
method: :get,
|
104
|
+
path: format("/v1/customers/%<customer>s/payment_methods", { customer: CGI.escape(self["id"]) }),
|
105
|
+
params: params,
|
106
|
+
opts: opts
|
107
|
+
)
|
108
|
+
end
|
109
|
+
|
110
|
+
# Returns a list of PaymentMethods for a given Customer
|
76
111
|
def self.list_payment_methods(customer, params = {}, opts = {})
|
77
112
|
request_stripe_object(
|
78
113
|
method: :get,
|
@@ -82,42 +117,57 @@ module Stripe
|
|
82
117
|
)
|
83
118
|
end
|
84
119
|
|
85
|
-
|
120
|
+
# Retrieves a customer's cash balance.
|
121
|
+
def self.retrieve_cash_balance(customer, params = {}, opts = {})
|
86
122
|
request_stripe_object(
|
87
123
|
method: :get,
|
88
|
-
path: format("/v1/customers/%<customer>s/
|
124
|
+
path: format("/v1/customers/%<customer>s/cash_balance", { customer: CGI.escape(customer) }),
|
89
125
|
params: params,
|
90
126
|
opts: opts
|
91
127
|
)
|
92
128
|
end
|
93
129
|
|
94
|
-
|
95
|
-
|
96
|
-
|
130
|
+
# Retrieves a PaymentMethod object for a given Customer.
|
131
|
+
def retrieve_payment_method(payment_method, params = {}, opts = {})
|
132
|
+
request_stripe_object(
|
133
|
+
method: :get,
|
134
|
+
path: format("/v1/customers/%<customer>s/payment_methods/%<payment_method>s", { customer: CGI.escape(self["id"]), payment_method: CGI.escape(payment_method) }),
|
135
|
+
params: params,
|
136
|
+
opts: opts
|
137
|
+
)
|
138
|
+
end
|
97
139
|
|
98
|
-
#
|
99
|
-
|
100
|
-
|
101
|
-
|
140
|
+
# Retrieves a PaymentMethod object for a given Customer.
|
141
|
+
def self.retrieve_payment_method(customer, payment_method, params = {}, opts = {})
|
142
|
+
request_stripe_object(
|
143
|
+
method: :get,
|
144
|
+
path: format("/v1/customers/%<customer>s/payment_methods/%<payment_method>s", { customer: CGI.escape(customer), payment_method: CGI.escape(payment_method) }),
|
145
|
+
params: params,
|
146
|
+
opts: opts
|
147
|
+
)
|
102
148
|
end
|
103
149
|
|
104
150
|
def self.search(params = {}, opts = {})
|
105
|
-
|
151
|
+
request_stripe_object(method: :get, path: "/v1/customers/search", params: params, opts: opts)
|
106
152
|
end
|
107
153
|
|
108
154
|
def self.search_auto_paging_each(params = {}, opts = {}, &blk)
|
109
155
|
search(params, opts).auto_paging_each(&blk)
|
110
156
|
end
|
111
157
|
|
112
|
-
|
158
|
+
# Updates the specified customer by setting the values of the parameters passed. Any parameters not provided will be left unchanged. For example, if you pass the source parameter, that becomes the customer's active source (e.g., a card) to be used for all charges in the future. When you update a customer to a new valid card source by passing the source parameter: for each of the customer's current subscriptions, if the subscription bills automatically and is in the past_due state, then the latest open invoice for the subscription with automatic collection enabled will be retried. This retry will not count as an automatic retry, and will not affect the next regularly scheduled payment for the invoice. Changing the default_source for a customer will not trigger this behavior.
|
159
|
+
#
|
160
|
+
# This request accepts mostly the same arguments as the customer creation call.
|
161
|
+
def self.update(id, params = {}, opts = {})
|
113
162
|
request_stripe_object(
|
114
|
-
method: :
|
115
|
-
path: format("/v1/customers/%<
|
163
|
+
method: :post,
|
164
|
+
path: format("/v1/customers/%<id>s", { id: CGI.escape(id) }),
|
116
165
|
params: params,
|
117
166
|
opts: opts
|
118
167
|
)
|
119
168
|
end
|
120
169
|
|
170
|
+
# Changes the settings on a customer's cash balance.
|
121
171
|
def self.update_cash_balance(customer, params = {}, opts = {})
|
122
172
|
request_stripe_object(
|
123
173
|
method: :post,
|
@@ -127,13 +177,25 @@ module Stripe
|
|
127
177
|
)
|
128
178
|
end
|
129
179
|
|
180
|
+
save_nested_resource :source
|
181
|
+
|
182
|
+
# The API request for deleting a card or bank account and for detaching a
|
183
|
+
# source object are the same.
|
184
|
+
class << self
|
185
|
+
alias detach_source delete_source
|
186
|
+
end
|
187
|
+
|
130
188
|
def test_helpers
|
131
189
|
TestHelpers.new(self)
|
132
190
|
end
|
133
191
|
|
134
192
|
class TestHelpers < APIResourceTestHelpers
|
135
193
|
RESOURCE_CLASS = Customer
|
194
|
+
def self.resource_class
|
195
|
+
"Customer"
|
196
|
+
end
|
136
197
|
|
198
|
+
# Create an incoming testmode bank transfer
|
137
199
|
def self.fund_cash_balance(customer, params = {}, opts = {})
|
138
200
|
request_stripe_object(
|
139
201
|
method: :post,
|
@@ -143,6 +205,7 @@ module Stripe
|
|
143
205
|
)
|
144
206
|
end
|
145
207
|
|
208
|
+
# Create an incoming testmode bank transfer
|
146
209
|
def fund_cash_balance(params = {}, opts = {})
|
147
210
|
@resource.request_stripe_object(
|
148
211
|
method: :post,
|
@@ -9,10 +9,12 @@ module Stripe
|
|
9
9
|
#
|
10
10
|
# Related guide: [Customer balance](https://stripe.com/docs/billing/customer/balance)
|
11
11
|
class CustomerBalanceTransaction < APIResource
|
12
|
-
extend Stripe::APIOperations::List
|
13
12
|
include Stripe::APIOperations::Save
|
14
13
|
|
15
14
|
OBJECT_NAME = "customer_balance_transaction"
|
15
|
+
def self.object_name
|
16
|
+
"customer_balance_transaction"
|
17
|
+
end
|
16
18
|
|
17
19
|
def resource_url
|
18
20
|
if !respond_to?(:customer) || customer.nil?
|
@@ -7,8 +7,9 @@ module Stripe
|
|
7
7
|
# represent when funds are moved into or out of this balance. This includes funding by the customer, allocation
|
8
8
|
# to payments, and refunds to the customer.
|
9
9
|
class CustomerCashBalanceTransaction < APIResource
|
10
|
-
extend Stripe::APIOperations::List
|
11
|
-
|
12
10
|
OBJECT_NAME = "customer_cash_balance_transaction"
|
11
|
+
def self.object_name
|
12
|
+
"customer_cash_balance_transaction"
|
13
|
+
end
|
13
14
|
end
|
14
15
|
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# File generated from our OpenAPI spec
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
module Stripe
|
5
|
+
# A Customer Session allows you to grant Stripe's frontend SDKs (like Stripe.js) client-side access
|
6
|
+
# control over a Customer.
|
7
|
+
#
|
8
|
+
# Related guides: [Customer Session with the Payment Element](https://stripe.com/payments/accept-a-payment-deferred?platform=web&type=payment#save-payment-methods),
|
9
|
+
# [Customer Session with the Pricing Table](https://stripe.com/payments/checkout/pricing-table#customer-session),
|
10
|
+
# [Customer Session with the Buy Button](https://stripe.com/payment-links/buy-button#pass-an-existing-customer).
|
11
|
+
class CustomerSession < APIResource
|
12
|
+
extend Stripe::APIOperations::Create
|
13
|
+
|
14
|
+
OBJECT_NAME = "customer_session"
|
15
|
+
def self.object_name
|
16
|
+
"customer_session"
|
17
|
+
end
|
18
|
+
|
19
|
+
# Creates a Customer Session object that includes a single-use client secret that you can use on your front-end to grant client-side API access for certain customer resources.
|
20
|
+
def self.create(params = {}, opts = {})
|
21
|
+
request_stripe_object(
|
22
|
+
method: :post,
|
23
|
+
path: "/v1/customer_sessions",
|
24
|
+
params: params,
|
25
|
+
opts: opts
|
26
|
+
)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -12,7 +12,13 @@ module Stripe
|
|
12
12
|
include Stripe::APIOperations::Save
|
13
13
|
|
14
14
|
OBJECT_NAME = "dispute"
|
15
|
+
def self.object_name
|
16
|
+
"dispute"
|
17
|
+
end
|
15
18
|
|
19
|
+
# Closing the dispute for a charge indicates that you do not have any evidence to submit and are essentially dismissing the dispute, acknowledging it as lost.
|
20
|
+
#
|
21
|
+
# The status of the dispute will change from needs_response to lost. Closing a dispute is irreversible.
|
16
22
|
def close(params = {}, opts = {})
|
17
23
|
request_stripe_object(
|
18
24
|
method: :post,
|
@@ -22,6 +28,9 @@ module Stripe
|
|
22
28
|
)
|
23
29
|
end
|
24
30
|
|
31
|
+
# Closing the dispute for a charge indicates that you do not have any evidence to submit and are essentially dismissing the dispute, acknowledging it as lost.
|
32
|
+
#
|
33
|
+
# The status of the dispute will change from needs_response to lost. Closing a dispute is irreversible.
|
25
34
|
def self.close(dispute, params = {}, opts = {})
|
26
35
|
request_stripe_object(
|
27
36
|
method: :post,
|
@@ -30,5 +39,22 @@ module Stripe
|
|
30
39
|
opts: opts
|
31
40
|
)
|
32
41
|
end
|
42
|
+
|
43
|
+
# Returns a list of your disputes.
|
44
|
+
def self.list(filters = {}, opts = {})
|
45
|
+
request_stripe_object(method: :get, path: "/v1/disputes", params: filters, opts: opts)
|
46
|
+
end
|
47
|
+
|
48
|
+
# When you get a dispute, contacting your customer is always the best first step. If that doesn't work, you can submit evidence to help us resolve the dispute in your favor. You can do this in your [dashboard](https://dashboard.stripe.com/disputes), but if you prefer, you can use the API to submit evidence programmatically.
|
49
|
+
#
|
50
|
+
# Depending on your dispute type, different evidence fields will give you a better chance of winning your dispute. To figure out which evidence fields to provide, see our [guide to dispute types](https://stripe.com/docs/disputes/categories).
|
51
|
+
def self.update(id, params = {}, opts = {})
|
52
|
+
request_stripe_object(
|
53
|
+
method: :post,
|
54
|
+
path: format("/v1/disputes/%<id>s", { id: CGI.escape(id) }),
|
55
|
+
params: params,
|
56
|
+
opts: opts
|
57
|
+
)
|
58
|
+
end
|
33
59
|
end
|
34
60
|
end
|