stripe 5.28.0 → 8.7.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 +286 -0
- data/Gemfile +5 -3
- data/Makefile +13 -0
- data/OPENAPI_VERSION +1 -0
- data/README.md +43 -5
- 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 +45 -2
- data/lib/stripe/api_operations/save.rb +13 -3
- data/lib/stripe/api_operations/search.rb +16 -0
- data/lib/stripe/api_resource.rb +11 -18
- data/lib/stripe/api_resource_test_helpers.rb +49 -0
- data/lib/stripe/api_version.rb +8 -0
- data/lib/stripe/connection_manager.rb +49 -11
- data/lib/stripe/error_object.rb +2 -3
- data/lib/stripe/instrumentation.rb +46 -6
- data/lib/stripe/oauth.rb +4 -3
- data/lib/stripe/object_types.rb +36 -10
- data/lib/stripe/resources/account.rb +39 -17
- data/lib/stripe/resources/account_link.rb +4 -0
- data/lib/stripe/resources/application_fee_refund.rb +7 -1
- 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 +15 -0
- data/lib/stripe/resources/billing_portal/session.rb +14 -0
- data/lib/stripe/resources/capability.rb +5 -1
- data/lib/stripe/resources/card.rb +6 -3
- data/lib/stripe/resources/cash_balance.rb +23 -0
- data/lib/stripe/resources/charge.rb +23 -3
- data/lib/stripe/resources/checkout/session.rb +49 -2
- 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/credit_note_line_item.rb +2 -0
- data/lib/stripe/resources/customer.rb +132 -4
- data/lib/stripe/resources/customer_balance_transaction.rb +9 -2
- data/lib/stripe/resources/customer_cash_balance_transaction.rb +14 -0
- data/lib/stripe/resources/discount.rb +5 -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 +9 -1
- data/lib/stripe/resources/file_link.rb +3 -0
- data/lib/stripe/resources/financial_connections/account.rb +67 -0
- data/lib/stripe/resources/financial_connections/account_owner.rb +11 -0
- data/lib/stripe/resources/financial_connections/account_ownership.rb +11 -0
- data/lib/stripe/resources/financial_connections/session.rb +13 -0
- data/lib/stripe/resources/funding_instructions.rb +21 -0
- data/lib/stripe/resources/identity/verification_report.rb +23 -0
- data/lib/stripe/resources/identity/verification_session.rb +61 -0
- data/lib/stripe/resources/invoice.rb +105 -17
- data/lib/stripe/resources/invoice_item.rb +11 -0
- data/lib/stripe/resources/invoice_line_item.rb +1 -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 +2 -0
- data/lib/stripe/resources/login_link.rb +2 -0
- data/lib/stripe/resources/mandate.rb +1 -0
- data/lib/stripe/resources/payment_intent.rb +103 -6
- data/lib/stripe/resources/payment_link.rb +35 -0
- data/lib/stripe/resources/payment_method.rb +25 -5
- data/lib/stripe/resources/payout.rb +28 -5
- data/lib/stripe/resources/person.rb +7 -0
- data/lib/stripe/resources/plan.rb +8 -0
- data/lib/stripe/resources/price.rb +15 -0
- data/lib/stripe/resources/product.rb +17 -0
- data/lib/stripe/resources/promotion_code.rb +2 -0
- data/lib/stripe/resources/quote.rb +128 -0
- 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 +49 -0
- 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 +16 -2
- data/lib/stripe/resources/review.rb +14 -3
- data/lib/stripe/resources/setup_attempt.rb +4 -0
- data/lib/stripe/resources/setup_intent.rb +60 -5
- data/lib/stripe/resources/shipping_rate.rb +14 -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 +5 -0
- data/lib/stripe/resources/subscription.rb +57 -3
- data/lib/stripe/resources/subscription_item.rb +2 -7
- data/lib/stripe/resources/subscription_schedule.rb +23 -5
- data/lib/stripe/resources/tax/calculation.rb +33 -0
- data/lib/stripe/resources/tax/calculation_line_item.rb +10 -0
- data/lib/stripe/resources/tax/settings.rb +15 -0
- data/lib/stripe/resources/tax/transaction.rb +49 -0
- data/lib/stripe/resources/tax/transaction_line_item.rb +10 -0
- data/lib/stripe/resources/tax_code.rb +11 -0
- data/lib/stripe/resources/tax_id.rb +5 -0
- data/lib/stripe/resources/tax_rate.rb +3 -0
- data/lib/stripe/resources/terminal/configuration.rb +16 -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 +119 -0
- data/lib/stripe/resources/test_helpers/test_clock.rb +35 -0
- data/lib/stripe/resources/token.rb +20 -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/financial_account_features.rb +12 -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 +5 -0
- data/lib/stripe/resources/usage_record_summary.rb +1 -0
- data/lib/stripe/resources/webhook_endpoint.rb +7 -0
- data/lib/stripe/resources.rb +34 -10
- data/lib/stripe/search_result_object.rb +86 -0
- data/lib/stripe/stripe_client.rb +267 -121
- data/lib/stripe/stripe_configuration.rb +29 -10
- data/lib/stripe/stripe_object.rb +25 -2
- data/lib/stripe/stripe_response.rb +80 -52
- data/lib/stripe/util.rb +100 -9
- data/lib/stripe/version.rb +1 -1
- data/lib/stripe.rb +27 -23
- data/stripe.gemspec +12 -5
- metadata +46 -204
- data/.editorconfig +0 -10
- data/.gitattributes +0 -4
- data/.github/ISSUE_TEMPLATE.md +0 -5
- data/.gitignore +0 -8
- data/.rubocop.yml +0 -80
- data/.rubocop_todo.yml +0 -33
- data/.travis.yml +0 -38
- data/.vscode/extensions.json +0 -7
- data/.vscode/settings.json +0 -8
- data/lib/stripe/resources/bitcoin_receiver.rb +0 -24
- data/lib/stripe/resources/bitcoin_transaction.rb +0 -15
- data/lib/stripe/resources/issuing/card_details.rb +0 -9
- 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
- data/test/openapi/README.md +0 -9
- data/test/stripe/account_link_test.rb +0 -18
- data/test/stripe/account_test.rb +0 -412
- data/test/stripe/alipay_account_test.rb +0 -37
- data/test/stripe/api_operations_test.rb +0 -80
- data/test/stripe/api_resource_test.rb +0 -646
- data/test/stripe/apple_pay_domain_test.rb +0 -46
- data/test/stripe/application_fee_refund_test.rb +0 -37
- data/test/stripe/application_fee_test.rb +0 -58
- data/test/stripe/balance_test.rb +0 -13
- data/test/stripe/balance_transaction_test.rb +0 -20
- data/test/stripe/bank_account_test.rb +0 -36
- data/test/stripe/billing_portal/session_test.rb +0 -18
- data/test/stripe/capability_test.rb +0 -45
- data/test/stripe/charge_test.rb +0 -64
- data/test/stripe/checkout/session_test.rb +0 -53
- data/test/stripe/connection_manager_test.rb +0 -167
- data/test/stripe/country_spec_test.rb +0 -20
- data/test/stripe/coupon_test.rb +0 -61
- data/test/stripe/credit_note_test.rb +0 -90
- data/test/stripe/customer_balance_transaction_test.rb +0 -37
- data/test/stripe/customer_card_test.rb +0 -48
- data/test/stripe/customer_test.rb +0 -226
- data/test/stripe/dispute_test.rb +0 -51
- data/test/stripe/ephemeral_key_test.rb +0 -93
- data/test/stripe/errors_test.rb +0 -53
- data/test/stripe/exchange_rate_test.rb +0 -20
- data/test/stripe/file_link_test.rb +0 -41
- data/test/stripe/file_test.rb +0 -87
- data/test/stripe/instrumentation_test.rb +0 -74
- data/test/stripe/invoice_item_test.rb +0 -66
- data/test/stripe/invoice_line_item_test.rb +0 -8
- data/test/stripe/invoice_test.rb +0 -229
- data/test/stripe/issuing/authorization_test.rb +0 -72
- data/test/stripe/issuing/card_test.rb +0 -74
- data/test/stripe/issuing/cardholder_test.rb +0 -53
- data/test/stripe/issuing/dispute_test.rb +0 -54
- data/test/stripe/issuing/transaction_test.rb +0 -48
- data/test/stripe/list_object_test.rb +0 -202
- data/test/stripe/login_link_test.rb +0 -37
- data/test/stripe/mandate_test.rb +0 -14
- data/test/stripe/multipart_encoder_test.rb +0 -130
- data/test/stripe/oauth_test.rb +0 -104
- data/test/stripe/order_return_test.rb +0 -21
- data/test/stripe/order_test.rb +0 -82
- data/test/stripe/payment_intent_test.rb +0 -107
- data/test/stripe/payment_method_test.rb +0 -84
- data/test/stripe/payout_test.rb +0 -72
- data/test/stripe/person_test.rb +0 -46
- data/test/stripe/plan_test.rb +0 -98
- data/test/stripe/price_test.rb +0 -48
- data/test/stripe/product_test.rb +0 -58
- data/test/stripe/promotion_code_test.rb +0 -42
- data/test/stripe/radar/early_fraud_warning_test.rb +0 -22
- data/test/stripe/radar/value_list_item_test.rb +0 -48
- data/test/stripe/radar/value_list_test.rb +0 -61
- data/test/stripe/recipient_test.rb +0 -62
- data/test/stripe/refund_test.rb +0 -39
- data/test/stripe/reporting/report_run_test.rb +0 -33
- data/test/stripe/reporting/report_type_test.rb +0 -22
- data/test/stripe/reversal_test.rb +0 -43
- data/test/stripe/review_test.rb +0 -27
- data/test/stripe/setup_attempt_test.rb +0 -16
- data/test/stripe/setup_intent_test.rb +0 -84
- data/test/stripe/sigma/scheduled_query_run_test.rb +0 -22
- data/test/stripe/sku_test.rb +0 -60
- data/test/stripe/source_test.rb +0 -119
- data/test/stripe/stripe_client_test.rb +0 -1291
- data/test/stripe/stripe_configuration_test.rb +0 -131
- data/test/stripe/stripe_object_test.rb +0 -500
- data/test/stripe/stripe_response_test.rb +0 -95
- data/test/stripe/subscription_item_test.rb +0 -84
- data/test/stripe/subscription_schedule_test.rb +0 -82
- data/test/stripe/subscription_test.rb +0 -80
- data/test/stripe/tax_id_test.rb +0 -31
- data/test/stripe/tax_rate_test.rb +0 -43
- data/test/stripe/terminal/connection_token_test.rb +0 -16
- data/test/stripe/terminal/location_test.rb +0 -68
- data/test/stripe/terminal/reader_test.rb +0 -62
- data/test/stripe/three_d_secure_test.rb +0 -23
- data/test/stripe/topup_test.rb +0 -62
- data/test/stripe/transfer_test.rb +0 -88
- data/test/stripe/usage_record_summary_test.rb +0 -29
- data/test/stripe/util_test.rb +0 -402
- data/test/stripe/webhook_endpoint_test.rb +0 -59
- data/test/stripe/webhook_test.rb +0 -135
- data/test/stripe_mock.rb +0 -78
- data/test/stripe_test.rb +0 -132
- data/test/test_data.rb +0 -61
- data/test/test_helper.rb +0 -77
@@ -2,24 +2,51 @@
|
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
4
|
module Stripe
|
5
|
+
# Invoices are statements of amounts owed by a customer, and are either
|
6
|
+
# generated one-off, or generated periodically from a subscription.
|
7
|
+
#
|
8
|
+
# They contain [invoice items](https://stripe.com/docs/api#invoiceitems), and proration adjustments
|
9
|
+
# that may be caused by subscription upgrades/downgrades (if necessary).
|
10
|
+
#
|
11
|
+
# If your invoice is configured to be billed through automatic charges,
|
12
|
+
# Stripe automatically finalizes your invoice and attempts payment. Note
|
13
|
+
# that finalizing the invoice,
|
14
|
+
# [when automatic](https://stripe.com/docs/invoicing/integration/automatic-advancement-collection), does
|
15
|
+
# not happen immediately as the invoice is created. Stripe waits
|
16
|
+
# until one hour after the last webhook was successfully sent (or the last
|
17
|
+
# webhook timed out after failing). If you (and the platforms you may have
|
18
|
+
# connected to) have no webhooks configured, Stripe waits one hour after
|
19
|
+
# creation to finalize the invoice.
|
20
|
+
#
|
21
|
+
# If your invoice is configured to be billed by sending an email, then based on your
|
22
|
+
# [email settings](https://dashboard.stripe.com/account/billing/automatic),
|
23
|
+
# Stripe will email the invoice to your customer and await payment. These
|
24
|
+
# emails can contain a link to a hosted page to pay the invoice.
|
25
|
+
#
|
26
|
+
# Stripe applies any customer credit on the account before determining the
|
27
|
+
# amount due for the invoice (i.e., the amount that will be actually
|
28
|
+
# charged). If the amount due for the invoice is less than Stripe's [minimum allowed charge
|
29
|
+
# per currency](https://stripe.com/docs/currencies#minimum-and-maximum-charge-amounts), the
|
30
|
+
# invoice is automatically marked paid, and we add the amount due to the
|
31
|
+
# customer's credit balance which is applied to the next invoice.
|
32
|
+
#
|
33
|
+
# More details on the customer's credit balance are
|
34
|
+
# [here](https://stripe.com/docs/billing/customer/balance).
|
35
|
+
#
|
36
|
+
# Related guide: [Send invoices to customers](https://stripe.com/docs/billing/invoices/sending)
|
5
37
|
class Invoice < APIResource
|
6
38
|
extend Stripe::APIOperations::Create
|
7
39
|
include Stripe::APIOperations::Delete
|
8
40
|
extend Stripe::APIOperations::List
|
41
|
+
extend Stripe::APIOperations::Search
|
9
42
|
include Stripe::APIOperations::Save
|
10
43
|
|
11
44
|
OBJECT_NAME = "invoice"
|
12
45
|
|
13
|
-
custom_method :finalize_invoice, http_verb: :post, http_path: "finalize"
|
14
|
-
custom_method :mark_uncollectible, http_verb: :post
|
15
|
-
custom_method :pay, http_verb: :post
|
16
|
-
custom_method :send_invoice, http_verb: :post, http_path: "send"
|
17
|
-
custom_method :void_invoice, http_verb: :post, http_path: "void"
|
18
|
-
|
19
46
|
def finalize_invoice(params = {}, opts = {})
|
20
47
|
request_stripe_object(
|
21
48
|
method: :post,
|
22
|
-
path:
|
49
|
+
path: format("/v1/invoices/%<invoice>s/finalize", { invoice: CGI.escape(self["id"]) }),
|
23
50
|
params: params,
|
24
51
|
opts: opts
|
25
52
|
)
|
@@ -28,7 +55,7 @@ module Stripe
|
|
28
55
|
def mark_uncollectible(params = {}, opts = {})
|
29
56
|
request_stripe_object(
|
30
57
|
method: :post,
|
31
|
-
path:
|
58
|
+
path: format("/v1/invoices/%<invoice>s/mark_uncollectible", { invoice: CGI.escape(self["id"]) }),
|
32
59
|
params: params,
|
33
60
|
opts: opts
|
34
61
|
)
|
@@ -37,7 +64,7 @@ module Stripe
|
|
37
64
|
def pay(params = {}, opts = {})
|
38
65
|
request_stripe_object(
|
39
66
|
method: :post,
|
40
|
-
path:
|
67
|
+
path: format("/v1/invoices/%<invoice>s/pay", { invoice: CGI.escape(self["id"]) }),
|
41
68
|
params: params,
|
42
69
|
opts: opts
|
43
70
|
)
|
@@ -46,7 +73,7 @@ module Stripe
|
|
46
73
|
def send_invoice(params = {}, opts = {})
|
47
74
|
request_stripe_object(
|
48
75
|
method: :post,
|
49
|
-
path:
|
76
|
+
path: format("/v1/invoices/%<invoice>s/send", { invoice: CGI.escape(self["id"]) }),
|
50
77
|
params: params,
|
51
78
|
opts: opts
|
52
79
|
)
|
@@ -55,20 +82,81 @@ module Stripe
|
|
55
82
|
def void_invoice(params = {}, opts = {})
|
56
83
|
request_stripe_object(
|
57
84
|
method: :post,
|
58
|
-
path:
|
85
|
+
path: format("/v1/invoices/%<invoice>s/void", { invoice: CGI.escape(self["id"]) }),
|
86
|
+
params: params,
|
87
|
+
opts: opts
|
88
|
+
)
|
89
|
+
end
|
90
|
+
|
91
|
+
def self.finalize_invoice(invoice, params = {}, opts = {})
|
92
|
+
request_stripe_object(
|
93
|
+
method: :post,
|
94
|
+
path: format("/v1/invoices/%<invoice>s/finalize", { invoice: CGI.escape(invoice) }),
|
95
|
+
params: params,
|
96
|
+
opts: opts
|
97
|
+
)
|
98
|
+
end
|
99
|
+
|
100
|
+
def self.list_upcoming_line_items(params = {}, opts = {})
|
101
|
+
request_stripe_object(
|
102
|
+
method: :get,
|
103
|
+
path: "/v1/invoices/upcoming/lines",
|
104
|
+
params: params,
|
105
|
+
opts: opts
|
106
|
+
)
|
107
|
+
end
|
108
|
+
|
109
|
+
def self.mark_uncollectible(invoice, params = {}, opts = {})
|
110
|
+
request_stripe_object(
|
111
|
+
method: :post,
|
112
|
+
path: format("/v1/invoices/%<invoice>s/mark_uncollectible", { invoice: CGI.escape(invoice) }),
|
113
|
+
params: params,
|
114
|
+
opts: opts
|
115
|
+
)
|
116
|
+
end
|
117
|
+
|
118
|
+
def self.pay(invoice, params = {}, opts = {})
|
119
|
+
request_stripe_object(
|
120
|
+
method: :post,
|
121
|
+
path: format("/v1/invoices/%<invoice>s/pay", { invoice: CGI.escape(invoice) }),
|
122
|
+
params: params,
|
123
|
+
opts: opts
|
124
|
+
)
|
125
|
+
end
|
126
|
+
|
127
|
+
def self.send_invoice(invoice, params = {}, opts = {})
|
128
|
+
request_stripe_object(
|
129
|
+
method: :post,
|
130
|
+
path: format("/v1/invoices/%<invoice>s/send", { invoice: CGI.escape(invoice) }),
|
131
|
+
params: params,
|
132
|
+
opts: opts
|
133
|
+
)
|
134
|
+
end
|
135
|
+
|
136
|
+
def self.upcoming(params = {}, opts = {})
|
137
|
+
request_stripe_object(
|
138
|
+
method: :get,
|
139
|
+
path: "/v1/invoices/upcoming",
|
140
|
+
params: params,
|
141
|
+
opts: opts
|
142
|
+
)
|
143
|
+
end
|
144
|
+
|
145
|
+
def self.void_invoice(invoice, params = {}, opts = {})
|
146
|
+
request_stripe_object(
|
147
|
+
method: :post,
|
148
|
+
path: format("/v1/invoices/%<invoice>s/void", { invoice: CGI.escape(invoice) }),
|
59
149
|
params: params,
|
60
150
|
opts: opts
|
61
151
|
)
|
62
152
|
end
|
63
153
|
|
64
|
-
def self.
|
65
|
-
|
66
|
-
Util.convert_to_stripe_object(resp.data, opts)
|
154
|
+
def self.search(params = {}, opts = {})
|
155
|
+
_search("/v1/invoices/search", params, opts)
|
67
156
|
end
|
68
157
|
|
69
|
-
def self.
|
70
|
-
|
71
|
-
Util.convert_to_stripe_object(resp.data, opts)
|
158
|
+
def self.search_auto_paging_each(params = {}, opts = {}, &blk)
|
159
|
+
search(params, opts).auto_paging_each(&blk)
|
72
160
|
end
|
73
161
|
end
|
74
162
|
end
|
@@ -2,6 +2,17 @@
|
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
4
|
module Stripe
|
5
|
+
# Invoice Items represent the component lines of an [invoice](https://stripe.com/docs/api/invoices). An invoice item is added to an
|
6
|
+
# invoice by creating or updating it with an `invoice` field, at which point it will be included as
|
7
|
+
# [an invoice line item](https://stripe.com/docs/api/invoices/line_item) within
|
8
|
+
# [invoice.lines](https://stripe.com/docs/api/invoices/object#invoice_object-lines).
|
9
|
+
#
|
10
|
+
# Invoice Items can be created before you are ready to actually send the invoice. This can be particularly useful when combined
|
11
|
+
# with a [subscription](https://stripe.com/docs/api/subscriptions). Sometimes you want to add a charge or credit to a customer, but actually charge
|
12
|
+
# or credit the customer's card only at the end of a regular billing cycle. This is useful for combining several charges
|
13
|
+
# (to minimize per-transaction fees), or for having Stripe tabulate your usage-based billing totals.
|
14
|
+
#
|
15
|
+
# Related guides: [Integrate with the Invoicing API](https://stripe.com/docs/invoicing/integration), [Subscription Invoices](https://stripe.com/docs/billing/invoices/subscription#adding-upcoming-invoice-items).
|
5
16
|
class InvoiceItem < APIResource
|
6
17
|
extend Stripe::APIOperations::Create
|
7
18
|
include Stripe::APIOperations::Delete
|
@@ -3,19 +3,21 @@
|
|
3
3
|
|
4
4
|
module Stripe
|
5
5
|
module Issuing
|
6
|
+
# When an [issued card](https://stripe.com/docs/issuing) is used to make a purchase, an Issuing `Authorization`
|
7
|
+
# object is created. [Authorizations](https://stripe.com/docs/issuing/purchases/authorizations) must be approved for the
|
8
|
+
# purchase to be completed successfully.
|
9
|
+
#
|
10
|
+
# Related guide: [Issued card authorizations](https://stripe.com/docs/issuing/purchases/authorizations)
|
6
11
|
class Authorization < APIResource
|
7
12
|
extend Stripe::APIOperations::List
|
8
13
|
include Stripe::APIOperations::Save
|
9
14
|
|
10
15
|
OBJECT_NAME = "issuing.authorization"
|
11
16
|
|
12
|
-
custom_method :approve, http_verb: :post
|
13
|
-
custom_method :decline, http_verb: :post
|
14
|
-
|
15
17
|
def approve(params = {}, opts = {})
|
16
18
|
request_stripe_object(
|
17
19
|
method: :post,
|
18
|
-
path:
|
20
|
+
path: format("/v1/issuing/authorizations/%<authorization>s/approve", { authorization: CGI.escape(self["id"]) }),
|
19
21
|
params: params,
|
20
22
|
opts: opts
|
21
23
|
)
|
@@ -24,7 +26,25 @@ module Stripe
|
|
24
26
|
def decline(params = {}, opts = {})
|
25
27
|
request_stripe_object(
|
26
28
|
method: :post,
|
27
|
-
path:
|
29
|
+
path: format("/v1/issuing/authorizations/%<authorization>s/decline", { authorization: CGI.escape(self["id"]) }),
|
30
|
+
params: params,
|
31
|
+
opts: opts
|
32
|
+
)
|
33
|
+
end
|
34
|
+
|
35
|
+
def self.approve(authorization, params = {}, opts = {})
|
36
|
+
request_stripe_object(
|
37
|
+
method: :post,
|
38
|
+
path: format("/v1/issuing/authorizations/%<authorization>s/approve", { authorization: CGI.escape(authorization) }),
|
39
|
+
params: params,
|
40
|
+
opts: opts
|
41
|
+
)
|
42
|
+
end
|
43
|
+
|
44
|
+
def self.decline(authorization, params = {}, opts = {})
|
45
|
+
request_stripe_object(
|
46
|
+
method: :post,
|
47
|
+
path: format("/v1/issuing/authorizations/%<authorization>s/decline", { authorization: CGI.escape(authorization) }),
|
28
48
|
params: params,
|
29
49
|
opts: opts
|
30
50
|
)
|
@@ -3,6 +3,7 @@
|
|
3
3
|
|
4
4
|
module Stripe
|
5
5
|
module Issuing
|
6
|
+
# You can [create physical or virtual cards](https://stripe.com/docs/issuing/cards) that are issued to cardholders.
|
6
7
|
class Card < APIResource
|
7
8
|
extend Stripe::APIOperations::Create
|
8
9
|
extend Stripe::APIOperations::List
|
@@ -10,15 +11,84 @@ module Stripe
|
|
10
11
|
|
11
12
|
OBJECT_NAME = "issuing.card"
|
12
13
|
|
13
|
-
|
14
|
+
def test_helpers
|
15
|
+
TestHelpers.new(self)
|
16
|
+
end
|
17
|
+
|
18
|
+
class TestHelpers < APIResourceTestHelpers
|
19
|
+
RESOURCE_CLASS = Card
|
20
|
+
|
21
|
+
def self.deliver_card(card, params = {}, opts = {})
|
22
|
+
request_stripe_object(
|
23
|
+
method: :post,
|
24
|
+
path: format("/v1/test_helpers/issuing/cards/%<card>s/shipping/deliver", { card: CGI.escape(card) }),
|
25
|
+
params: params,
|
26
|
+
opts: opts
|
27
|
+
)
|
28
|
+
end
|
29
|
+
|
30
|
+
def self.fail_card(card, params = {}, opts = {})
|
31
|
+
request_stripe_object(
|
32
|
+
method: :post,
|
33
|
+
path: format("/v1/test_helpers/issuing/cards/%<card>s/shipping/fail", { card: CGI.escape(card) }),
|
34
|
+
params: params,
|
35
|
+
opts: opts
|
36
|
+
)
|
37
|
+
end
|
38
|
+
|
39
|
+
def self.return_card(card, params = {}, opts = {})
|
40
|
+
request_stripe_object(
|
41
|
+
method: :post,
|
42
|
+
path: format("/v1/test_helpers/issuing/cards/%<card>s/shipping/return", { card: CGI.escape(card) }),
|
43
|
+
params: params,
|
44
|
+
opts: opts
|
45
|
+
)
|
46
|
+
end
|
47
|
+
|
48
|
+
def self.ship_card(card, params = {}, opts = {})
|
49
|
+
request_stripe_object(
|
50
|
+
method: :post,
|
51
|
+
path: format("/v1/test_helpers/issuing/cards/%<card>s/shipping/ship", { card: CGI.escape(card) }),
|
52
|
+
params: params,
|
53
|
+
opts: opts
|
54
|
+
)
|
55
|
+
end
|
56
|
+
|
57
|
+
def deliver_card(params = {}, opts = {})
|
58
|
+
@resource.request_stripe_object(
|
59
|
+
method: :post,
|
60
|
+
path: format("/v1/test_helpers/issuing/cards/%<card>s/shipping/deliver", { card: CGI.escape(@resource["id"]) }),
|
61
|
+
params: params,
|
62
|
+
opts: opts
|
63
|
+
)
|
64
|
+
end
|
65
|
+
|
66
|
+
def fail_card(params = {}, opts = {})
|
67
|
+
@resource.request_stripe_object(
|
68
|
+
method: :post,
|
69
|
+
path: format("/v1/test_helpers/issuing/cards/%<card>s/shipping/fail", { card: CGI.escape(@resource["id"]) }),
|
70
|
+
params: params,
|
71
|
+
opts: opts
|
72
|
+
)
|
73
|
+
end
|
74
|
+
|
75
|
+
def return_card(params = {}, opts = {})
|
76
|
+
@resource.request_stripe_object(
|
77
|
+
method: :post,
|
78
|
+
path: format("/v1/test_helpers/issuing/cards/%<card>s/shipping/return", { card: CGI.escape(@resource["id"]) }),
|
79
|
+
params: params,
|
80
|
+
opts: opts
|
81
|
+
)
|
82
|
+
end
|
14
83
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
84
|
+
def ship_card(params = {}, opts = {})
|
85
|
+
@resource.request_stripe_object(
|
86
|
+
method: :post,
|
87
|
+
path: format("/v1/test_helpers/issuing/cards/%<card>s/shipping/ship", { card: CGI.escape(@resource["id"]) }),
|
88
|
+
params: params,
|
89
|
+
opts: opts
|
90
|
+
)
|
91
|
+
end
|
22
92
|
end
|
23
93
|
end
|
24
94
|
end
|
@@ -3,6 +3,9 @@
|
|
3
3
|
|
4
4
|
module Stripe
|
5
5
|
module Issuing
|
6
|
+
# An Issuing `Cardholder` object represents an individual or business entity who is [issued](https://stripe.com/docs/issuing) cards.
|
7
|
+
#
|
8
|
+
# Related guide: [How to create a cardholder](https://stripe.com/docs/issuing/cards#create-cardholder)
|
6
9
|
class Cardholder < APIResource
|
7
10
|
extend Stripe::APIOperations::Create
|
8
11
|
extend Stripe::APIOperations::List
|
@@ -3,6 +3,9 @@
|
|
3
3
|
|
4
4
|
module Stripe
|
5
5
|
module Issuing
|
6
|
+
# As a [card issuer](https://stripe.com/docs/issuing), you can dispute transactions that the cardholder does not recognize, suspects to be fraudulent, or has other issues with.
|
7
|
+
#
|
8
|
+
# Related guide: [Issuing disputes](https://stripe.com/docs/issuing/purchases/disputes)
|
6
9
|
class Dispute < APIResource
|
7
10
|
extend Stripe::APIOperations::Create
|
8
11
|
extend Stripe::APIOperations::List
|
@@ -10,12 +13,19 @@ module Stripe
|
|
10
13
|
|
11
14
|
OBJECT_NAME = "issuing.dispute"
|
12
15
|
|
13
|
-
custom_method :submit, http_verb: :post
|
14
|
-
|
15
16
|
def submit(params = {}, opts = {})
|
16
17
|
request_stripe_object(
|
17
18
|
method: :post,
|
18
|
-
path:
|
19
|
+
path: format("/v1/issuing/disputes/%<dispute>s/submit", { dispute: CGI.escape(self["id"]) }),
|
20
|
+
params: params,
|
21
|
+
opts: opts
|
22
|
+
)
|
23
|
+
end
|
24
|
+
|
25
|
+
def self.submit(dispute, params = {}, opts = {})
|
26
|
+
request_stripe_object(
|
27
|
+
method: :post,
|
28
|
+
path: format("/v1/issuing/disputes/%<dispute>s/submit", { dispute: CGI.escape(dispute) }),
|
19
29
|
params: params,
|
20
30
|
opts: opts
|
21
31
|
)
|
@@ -3,6 +3,11 @@
|
|
3
3
|
|
4
4
|
module Stripe
|
5
5
|
module Issuing
|
6
|
+
# Any use of an [issued card](https://stripe.com/docs/issuing) that results in funds entering or leaving
|
7
|
+
# your Stripe account, such as a completed purchase or refund, is represented by an Issuing
|
8
|
+
# `Transaction` object.
|
9
|
+
#
|
10
|
+
# Related guide: [Issued card transactions](https://stripe.com/docs/issuing/purchases/transactions)
|
6
11
|
class Transaction < APIResource
|
7
12
|
extend Stripe::APIOperations::List
|
8
13
|
include Stripe::APIOperations::Save
|
@@ -2,21 +2,38 @@
|
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
4
|
module Stripe
|
5
|
+
# A PaymentIntent guides you through the process of collecting a payment from your customer.
|
6
|
+
# We recommend that you create exactly one PaymentIntent for each order or
|
7
|
+
# customer session in your system. You can reference the PaymentIntent later to
|
8
|
+
# see the history of payment attempts for a particular session.
|
9
|
+
#
|
10
|
+
# A PaymentIntent transitions through
|
11
|
+
# [multiple statuses](https://stripe.com/docs/payments/intents#intent-statuses)
|
12
|
+
# throughout its lifetime as it interfaces with Stripe.js to perform
|
13
|
+
# authentication flows and ultimately creates at most one successful charge.
|
14
|
+
#
|
15
|
+
# Related guide: [Payment Intents API](https://stripe.com/docs/payments/payment-intents)
|
5
16
|
class PaymentIntent < APIResource
|
6
17
|
extend Stripe::APIOperations::Create
|
7
18
|
extend Stripe::APIOperations::List
|
19
|
+
extend Stripe::APIOperations::Search
|
8
20
|
include Stripe::APIOperations::Save
|
9
21
|
|
10
22
|
OBJECT_NAME = "payment_intent"
|
11
23
|
|
12
|
-
|
13
|
-
|
14
|
-
|
24
|
+
def apply_customer_balance(params = {}, opts = {})
|
25
|
+
request_stripe_object(
|
26
|
+
method: :post,
|
27
|
+
path: format("/v1/payment_intents/%<intent>s/apply_customer_balance", { intent: CGI.escape(self["id"]) }),
|
28
|
+
params: params,
|
29
|
+
opts: opts
|
30
|
+
)
|
31
|
+
end
|
15
32
|
|
16
33
|
def cancel(params = {}, opts = {})
|
17
34
|
request_stripe_object(
|
18
35
|
method: :post,
|
19
|
-
path:
|
36
|
+
path: format("/v1/payment_intents/%<intent>s/cancel", { intent: CGI.escape(self["id"]) }),
|
20
37
|
params: params,
|
21
38
|
opts: opts
|
22
39
|
)
|
@@ -25,7 +42,7 @@ module Stripe
|
|
25
42
|
def capture(params = {}, opts = {})
|
26
43
|
request_stripe_object(
|
27
44
|
method: :post,
|
28
|
-
path:
|
45
|
+
path: format("/v1/payment_intents/%<intent>s/capture", { intent: CGI.escape(self["id"]) }),
|
29
46
|
params: params,
|
30
47
|
opts: opts
|
31
48
|
)
|
@@ -34,10 +51,90 @@ module Stripe
|
|
34
51
|
def confirm(params = {}, opts = {})
|
35
52
|
request_stripe_object(
|
36
53
|
method: :post,
|
37
|
-
path:
|
54
|
+
path: format("/v1/payment_intents/%<intent>s/confirm", { intent: CGI.escape(self["id"]) }),
|
55
|
+
params: params,
|
56
|
+
opts: opts
|
57
|
+
)
|
58
|
+
end
|
59
|
+
|
60
|
+
def increment_authorization(params = {}, opts = {})
|
61
|
+
request_stripe_object(
|
62
|
+
method: :post,
|
63
|
+
path: format("/v1/payment_intents/%<intent>s/increment_authorization", { intent: CGI.escape(self["id"]) }),
|
64
|
+
params: params,
|
65
|
+
opts: opts
|
66
|
+
)
|
67
|
+
end
|
68
|
+
|
69
|
+
def verify_microdeposits(params = {}, opts = {})
|
70
|
+
request_stripe_object(
|
71
|
+
method: :post,
|
72
|
+
path: format("/v1/payment_intents/%<intent>s/verify_microdeposits", { intent: CGI.escape(self["id"]) }),
|
73
|
+
params: params,
|
74
|
+
opts: opts
|
75
|
+
)
|
76
|
+
end
|
77
|
+
|
78
|
+
def self.apply_customer_balance(intent, params = {}, opts = {})
|
79
|
+
request_stripe_object(
|
80
|
+
method: :post,
|
81
|
+
path: format("/v1/payment_intents/%<intent>s/apply_customer_balance", { intent: CGI.escape(intent) }),
|
82
|
+
params: params,
|
83
|
+
opts: opts
|
84
|
+
)
|
85
|
+
end
|
86
|
+
|
87
|
+
def self.cancel(intent, params = {}, opts = {})
|
88
|
+
request_stripe_object(
|
89
|
+
method: :post,
|
90
|
+
path: format("/v1/payment_intents/%<intent>s/cancel", { intent: CGI.escape(intent) }),
|
38
91
|
params: params,
|
39
92
|
opts: opts
|
40
93
|
)
|
41
94
|
end
|
95
|
+
|
96
|
+
def self.capture(intent, params = {}, opts = {})
|
97
|
+
request_stripe_object(
|
98
|
+
method: :post,
|
99
|
+
path: format("/v1/payment_intents/%<intent>s/capture", { intent: CGI.escape(intent) }),
|
100
|
+
params: params,
|
101
|
+
opts: opts
|
102
|
+
)
|
103
|
+
end
|
104
|
+
|
105
|
+
def self.confirm(intent, params = {}, opts = {})
|
106
|
+
request_stripe_object(
|
107
|
+
method: :post,
|
108
|
+
path: format("/v1/payment_intents/%<intent>s/confirm", { intent: CGI.escape(intent) }),
|
109
|
+
params: params,
|
110
|
+
opts: opts
|
111
|
+
)
|
112
|
+
end
|
113
|
+
|
114
|
+
def self.increment_authorization(intent, params = {}, opts = {})
|
115
|
+
request_stripe_object(
|
116
|
+
method: :post,
|
117
|
+
path: format("/v1/payment_intents/%<intent>s/increment_authorization", { intent: CGI.escape(intent) }),
|
118
|
+
params: params,
|
119
|
+
opts: opts
|
120
|
+
)
|
121
|
+
end
|
122
|
+
|
123
|
+
def self.verify_microdeposits(intent, params = {}, opts = {})
|
124
|
+
request_stripe_object(
|
125
|
+
method: :post,
|
126
|
+
path: format("/v1/payment_intents/%<intent>s/verify_microdeposits", { intent: CGI.escape(intent) }),
|
127
|
+
params: params,
|
128
|
+
opts: opts
|
129
|
+
)
|
130
|
+
end
|
131
|
+
|
132
|
+
def self.search(params = {}, opts = {})
|
133
|
+
_search("/v1/payment_intents/search", params, opts)
|
134
|
+
end
|
135
|
+
|
136
|
+
def self.search_auto_paging_each(params = {}, opts = {}, &blk)
|
137
|
+
search(params, opts).auto_paging_each(&blk)
|
138
|
+
end
|
42
139
|
end
|
43
140
|
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
# File generated from our OpenAPI spec
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
module Stripe
|
5
|
+
# A payment link is a shareable URL that will take your customers to a hosted payment page. A payment link can be shared and used multiple times.
|
6
|
+
#
|
7
|
+
# When a customer opens a payment link it will open a new [checkout session](https://stripe.com/docs/api/checkout/sessions) to render the payment page. You can use [checkout session events](https://stripe.com/docs/api/events/types#event_types-checkout.session.completed) to track payments through payment links.
|
8
|
+
#
|
9
|
+
# Related guide: [Payment Links API](https://stripe.com/docs/payment-links)
|
10
|
+
class PaymentLink < APIResource
|
11
|
+
extend Stripe::APIOperations::Create
|
12
|
+
extend Stripe::APIOperations::List
|
13
|
+
include Stripe::APIOperations::Save
|
14
|
+
|
15
|
+
OBJECT_NAME = "payment_link"
|
16
|
+
|
17
|
+
def list_line_items(params = {}, opts = {})
|
18
|
+
request_stripe_object(
|
19
|
+
method: :get,
|
20
|
+
path: format("/v1/payment_links/%<payment_link>s/line_items", { payment_link: CGI.escape(self["id"]) }),
|
21
|
+
params: params,
|
22
|
+
opts: opts
|
23
|
+
)
|
24
|
+
end
|
25
|
+
|
26
|
+
def self.list_line_items(payment_link, params = {}, opts = {})
|
27
|
+
request_stripe_object(
|
28
|
+
method: :get,
|
29
|
+
path: format("/v1/payment_links/%<payment_link>s/line_items", { payment_link: CGI.escape(payment_link) }),
|
30
|
+
params: params,
|
31
|
+
opts: opts
|
32
|
+
)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -2,6 +2,11 @@
|
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
4
|
module Stripe
|
5
|
+
# PaymentMethod objects represent your customer's payment instruments.
|
6
|
+
# You can use them with [PaymentIntents](https://stripe.com/docs/payments/payment-intents) to collect payments or save them to
|
7
|
+
# Customer objects to store instrument details for future payments.
|
8
|
+
#
|
9
|
+
# Related guides: [Payment Methods](https://stripe.com/docs/payments/payment-methods) and [More Payment Scenarios](https://stripe.com/docs/payments/more-payment-scenarios).
|
5
10
|
class PaymentMethod < APIResource
|
6
11
|
extend Stripe::APIOperations::Create
|
7
12
|
extend Stripe::APIOperations::List
|
@@ -9,13 +14,10 @@ module Stripe
|
|
9
14
|
|
10
15
|
OBJECT_NAME = "payment_method"
|
11
16
|
|
12
|
-
custom_method :attach, http_verb: :post
|
13
|
-
custom_method :detach, http_verb: :post
|
14
|
-
|
15
17
|
def attach(params = {}, opts = {})
|
16
18
|
request_stripe_object(
|
17
19
|
method: :post,
|
18
|
-
path:
|
20
|
+
path: format("/v1/payment_methods/%<payment_method>s/attach", { payment_method: CGI.escape(self["id"]) }),
|
19
21
|
params: params,
|
20
22
|
opts: opts
|
21
23
|
)
|
@@ -24,7 +26,25 @@ module Stripe
|
|
24
26
|
def detach(params = {}, opts = {})
|
25
27
|
request_stripe_object(
|
26
28
|
method: :post,
|
27
|
-
path:
|
29
|
+
path: format("/v1/payment_methods/%<payment_method>s/detach", { payment_method: CGI.escape(self["id"]) }),
|
30
|
+
params: params,
|
31
|
+
opts: opts
|
32
|
+
)
|
33
|
+
end
|
34
|
+
|
35
|
+
def self.attach(payment_method, params = {}, opts = {})
|
36
|
+
request_stripe_object(
|
37
|
+
method: :post,
|
38
|
+
path: format("/v1/payment_methods/%<payment_method>s/attach", { payment_method: CGI.escape(payment_method) }),
|
39
|
+
params: params,
|
40
|
+
opts: opts
|
41
|
+
)
|
42
|
+
end
|
43
|
+
|
44
|
+
def self.detach(payment_method, params = {}, opts = {})
|
45
|
+
request_stripe_object(
|
46
|
+
method: :post,
|
47
|
+
path: format("/v1/payment_methods/%<payment_method>s/detach", { payment_method: CGI.escape(payment_method) }),
|
28
48
|
params: params,
|
29
49
|
opts: opts
|
30
50
|
)
|