stripe 10.5.0.pre.beta.1 → 10.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (73) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +43 -249
  3. data/OPENAPI_VERSION +1 -1
  4. data/README.md +0 -11
  5. data/VERSION +1 -1
  6. data/lib/stripe/api_operations/request.rb +1 -2
  7. data/lib/stripe/api_version.rb +0 -1
  8. data/lib/stripe/object_types.rb +0 -20
  9. data/lib/stripe/resources/account.rb +8 -0
  10. data/lib/stripe/resources/apps/secret.rb +2 -0
  11. data/lib/stripe/resources/charge.rb +10 -0
  12. data/lib/stripe/resources/checkout/session.rb +8 -0
  13. data/lib/stripe/resources/climate/order.rb +8 -0
  14. data/lib/stripe/resources/credit_note.rb +4 -0
  15. data/lib/stripe/resources/customer.rb +16 -0
  16. data/lib/stripe/resources/dispute.rb +6 -0
  17. data/lib/stripe/resources/financial_connections/account.rb +10 -3
  18. data/lib/stripe/resources/identity/verification_session.rb +44 -0
  19. data/lib/stripe/resources/invoice.rb +20 -21
  20. data/lib/stripe/resources/issuing/authorization.rb +17 -0
  21. data/lib/stripe/resources/issuing/card.rb +8 -0
  22. data/lib/stripe/resources/issuing/dispute.rb +2 -0
  23. data/lib/stripe/resources/issuing/transaction.rb +4 -0
  24. data/lib/stripe/resources/payment_intent.rb +118 -0
  25. data/lib/stripe/resources/payment_link.rb +2 -0
  26. data/lib/stripe/resources/payment_method.rb +28 -0
  27. data/lib/stripe/resources/payment_method_domain.rb +12 -0
  28. data/lib/stripe/resources/payout.rb +8 -0
  29. data/lib/stripe/resources/quote.rb +12 -94
  30. data/lib/stripe/resources/refund.rb +8 -0
  31. data/lib/stripe/resources/review.rb +2 -0
  32. data/lib/stripe/resources/setup_intent.rb +36 -0
  33. data/lib/stripe/resources/source.rb +2 -0
  34. data/lib/stripe/resources/subscription.rb +14 -0
  35. data/lib/stripe/resources/subscription_schedule.rb +4 -18
  36. data/lib/stripe/resources/tax/calculation.rb +2 -0
  37. data/lib/stripe/resources/tax/transaction.rb +4 -0
  38. data/lib/stripe/resources/terminal/reader.rb +12 -54
  39. data/lib/stripe/resources/test_helpers/test_clock.rb +2 -0
  40. data/lib/stripe/resources/topup.rb +2 -0
  41. data/lib/stripe/resources/treasury/financial_account.rb +4 -0
  42. data/lib/stripe/resources/treasury/inbound_transfer.rb +8 -0
  43. data/lib/stripe/resources/treasury/outbound_payment.rb +8 -0
  44. data/lib/stripe/resources/treasury/outbound_transfer.rb +8 -0
  45. data/lib/stripe/resources/treasury/received_credit.rb +1 -0
  46. data/lib/stripe/resources/treasury/received_debit.rb +1 -0
  47. data/lib/stripe/resources.rb +0 -19
  48. data/lib/stripe/stripe_client.rb +28 -62
  49. data/lib/stripe/stripe_configuration.rb +1 -2
  50. data/lib/stripe/util.rb +1 -8
  51. data/lib/stripe/version.rb +1 -1
  52. data/lib/stripe.rb +0 -46
  53. metadata +4 -24
  54. data/lib/stripe/request_signing_authenticator.rb +0 -79
  55. data/lib/stripe/resources/account_notice.rb +0 -14
  56. data/lib/stripe/resources/capital/financing_offer.rb +0 -32
  57. data/lib/stripe/resources/capital/financing_summary.rb +0 -12
  58. data/lib/stripe/resources/capital/financing_transaction.rb +0 -13
  59. data/lib/stripe/resources/confirmation_token.rb +0 -13
  60. data/lib/stripe/resources/customer_session.rb +0 -12
  61. data/lib/stripe/resources/financial_connections/account_inferred_balance.rb +0 -13
  62. data/lib/stripe/resources/gift_cards/card.rb +0 -25
  63. data/lib/stripe/resources/gift_cards/transaction.rb +0 -56
  64. data/lib/stripe/resources/invoice_payment.rb +0 -11
  65. data/lib/stripe/resources/issuing/credit_underwriting_record.rb +0 -69
  66. data/lib/stripe/resources/issuing/personalization_design.rb +0 -77
  67. data/lib/stripe/resources/issuing/physical_bundle.rb +0 -13
  68. data/lib/stripe/resources/margin.rb +0 -14
  69. data/lib/stripe/resources/order.rb +0 -89
  70. data/lib/stripe/resources/quote_phase.rb +0 -29
  71. data/lib/stripe/resources/quote_preview_invoice.rb +0 -42
  72. data/lib/stripe/resources/quote_preview_subscription_schedule.rb +0 -10
  73. data/lib/stripe/resources/tax/form.rb +0 -39
@@ -14,6 +14,11 @@ module Stripe
14
14
 
15
15
  OBJECT_NAME = "charge"
16
16
 
17
+ # Capture the payment of an existing, uncaptured charge that was created with the capture option set to false.
18
+ #
19
+ # Uncaptured payments expire a set number of days after they are created ([7 by default](https://stripe.com/docs/charges/placing-a-hold)), after which they are marked as refunded and capture attempts will fail.
20
+ #
21
+ # Don't use this method to capture a PaymentIntent-initiated charge. Use [Capture a PaymentIntent](https://stripe.com/docs/api/payment_intents/capture).
17
22
  def capture(params = {}, opts = {})
18
23
  request_stripe_object(
19
24
  method: :post,
@@ -23,6 +28,11 @@ module Stripe
23
28
  )
24
29
  end
25
30
 
31
+ # Capture the payment of an existing, uncaptured charge that was created with the capture option set to false.
32
+ #
33
+ # Uncaptured payments expire a set number of days after they are created ([7 by default](https://stripe.com/docs/charges/placing-a-hold)), after which they are marked as refunded and capture attempts will fail.
34
+ #
35
+ # Don't use this method to capture a PaymentIntent-initiated charge. Use [Capture a PaymentIntent](https://stripe.com/docs/api/payment_intents/capture).
26
36
  def self.capture(charge, params = {}, opts = {})
27
37
  request_stripe_object(
28
38
  method: :post,
@@ -23,6 +23,9 @@ module Stripe
23
23
 
24
24
  OBJECT_NAME = "checkout.session"
25
25
 
26
+ # A Session can be expired when it is in one of these statuses: open
27
+ #
28
+ # After it expires, a customer can't complete a Session and customers loading the Session see a message saying the Session is expired.
26
29
  def expire(params = {}, opts = {})
27
30
  request_stripe_object(
28
31
  method: :post,
@@ -32,6 +35,7 @@ module Stripe
32
35
  )
33
36
  end
34
37
 
38
+ # When retrieving a Checkout Session, there is an includable line_items property containing the first handful of those items. There is also a URL where you can retrieve the full (paginated) list of line items.
35
39
  def list_line_items(params = {}, opts = {})
36
40
  request_stripe_object(
37
41
  method: :get,
@@ -41,6 +45,9 @@ module Stripe
41
45
  )
42
46
  end
43
47
 
48
+ # A Session can be expired when it is in one of these statuses: open
49
+ #
50
+ # After it expires, a customer can't complete a Session and customers loading the Session see a message saying the Session is expired.
44
51
  def self.expire(session, params = {}, opts = {})
45
52
  request_stripe_object(
46
53
  method: :post,
@@ -50,6 +57,7 @@ module Stripe
50
57
  )
51
58
  end
52
59
 
60
+ # When retrieving a Checkout Session, there is an includable line_items property containing the first handful of those items. There is also a URL where you can retrieve the full (paginated) list of line items.
53
61
  def self.list_line_items(session, params = {}, opts = {})
54
62
  request_stripe_object(
55
63
  method: :get,
@@ -12,6 +12,10 @@ module Stripe
12
12
 
13
13
  OBJECT_NAME = "climate.order"
14
14
 
15
+ # Cancels a Climate order. You can cancel an order within 30 days of creation. Stripe refunds the
16
+ # reservation amount_subtotal, but not the amount_fees for user-triggered cancellations. Frontier
17
+ # might cancel reservations if suppliers fail to deliver. If Frontier cancels the reservation, Stripe
18
+ # provides 90 days advance notice and refunds the amount_total.
15
19
  def cancel(params = {}, opts = {})
16
20
  request_stripe_object(
17
21
  method: :post,
@@ -21,6 +25,10 @@ module Stripe
21
25
  )
22
26
  end
23
27
 
28
+ # Cancels a Climate order. You can cancel an order within 30 days of creation. Stripe refunds the
29
+ # reservation amount_subtotal, but not the amount_fees for user-triggered cancellations. Frontier
30
+ # might cancel reservations if suppliers fail to deliver. If Frontier cancels the reservation, Stripe
31
+ # provides 90 days advance notice and refunds the amount_total.
24
32
  def self.cancel(order, params = {}, opts = {})
25
33
  request_stripe_object(
26
34
  method: :post,
@@ -12,6 +12,7 @@ module Stripe
12
12
 
13
13
  OBJECT_NAME = "credit_note"
14
14
 
15
+ # Marks a credit note as void. Learn more about [voiding credit notes](https://stripe.com/docs/billing/invoices/credit-notes#voiding).
15
16
  def void_credit_note(params = {}, opts = {})
16
17
  request_stripe_object(
17
18
  method: :post,
@@ -21,6 +22,7 @@ module Stripe
21
22
  )
22
23
  end
23
24
 
25
+ # 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
26
  def self.list_preview_line_items(params = {}, opts = {})
25
27
  request_stripe_object(
26
28
  method: :get,
@@ -30,6 +32,7 @@ module Stripe
30
32
  )
31
33
  end
32
34
 
35
+ # Get a preview of a credit note without creating it.
33
36
  def self.preview(params = {}, opts = {})
34
37
  request_stripe_object(
35
38
  method: :get,
@@ -39,6 +42,7 @@ module Stripe
39
42
  )
40
43
  end
41
44
 
45
+ # Marks a credit note as void. Learn more about [voiding credit notes](https://stripe.com/docs/billing/invoices/credit-notes#voiding).
42
46
  def self.void_credit_note(id, params = {}, opts = {})
43
47
  request_stripe_object(
44
48
  method: :post,
@@ -19,6 +19,9 @@ module Stripe
19
19
  nested_resource_class_methods :cash_balance_transaction, operations: %i[retrieve list]
20
20
  nested_resource_class_methods :tax_id, operations: %i[create retrieve delete list]
21
21
 
22
+ # Retrieve funding instructions for a customer cash balance. If funding instructions do not yet exist for the customer, new
23
+ # funding instructions will be created. If funding instructions have already been created for a given customer, the same
24
+ # funding instructions will be retrieved. In other words, we will return the same funding instructions each time.
22
25
  def create_funding_instructions(params = {}, opts = {})
23
26
  request_stripe_object(
24
27
  method: :post,
@@ -28,6 +31,7 @@ module Stripe
28
31
  )
29
32
  end
30
33
 
34
+ # Removes the currently applied discount on a customer.
31
35
  def delete_discount(params = {}, opts = {})
32
36
  request_stripe_object(
33
37
  method: :delete,
@@ -37,6 +41,7 @@ module Stripe
37
41
  )
38
42
  end
39
43
 
44
+ # Returns a list of PaymentMethods for a given Customer
40
45
  def list_payment_methods(params = {}, opts = {})
41
46
  request_stripe_object(
42
47
  method: :get,
@@ -46,6 +51,7 @@ module Stripe
46
51
  )
47
52
  end
48
53
 
54
+ # Retrieves a PaymentMethod object for a given Customer.
49
55
  def retrieve_payment_method(payment_method, params = {}, opts = {})
50
56
  request_stripe_object(
51
57
  method: :get,
@@ -55,6 +61,9 @@ module Stripe
55
61
  )
56
62
  end
57
63
 
64
+ # Retrieve funding instructions for a customer cash balance. If funding instructions do not yet exist for the customer, new
65
+ # funding instructions will be created. If funding instructions have already been created for a given customer, the same
66
+ # funding instructions will be retrieved. In other words, we will return the same funding instructions each time.
58
67
  def self.create_funding_instructions(customer, params = {}, opts = {})
59
68
  request_stripe_object(
60
69
  method: :post,
@@ -64,6 +73,7 @@ module Stripe
64
73
  )
65
74
  end
66
75
 
76
+ # Removes the currently applied discount on a customer.
67
77
  def self.delete_discount(customer, params = {}, opts = {})
68
78
  request_stripe_object(
69
79
  method: :delete,
@@ -73,6 +83,7 @@ module Stripe
73
83
  )
74
84
  end
75
85
 
86
+ # Returns a list of PaymentMethods for a given Customer
76
87
  def self.list_payment_methods(customer, params = {}, opts = {})
77
88
  request_stripe_object(
78
89
  method: :get,
@@ -82,6 +93,7 @@ module Stripe
82
93
  )
83
94
  end
84
95
 
96
+ # Retrieves a PaymentMethod object for a given Customer.
85
97
  def self.retrieve_payment_method(customer, payment_method, params = {}, opts = {})
86
98
  request_stripe_object(
87
99
  method: :get,
@@ -109,6 +121,7 @@ module Stripe
109
121
  search(params, opts).auto_paging_each(&blk)
110
122
  end
111
123
 
124
+ # Retrieves a customer's cash balance.
112
125
  def self.retrieve_cash_balance(customer, params = {}, opts = {})
113
126
  request_stripe_object(
114
127
  method: :get,
@@ -118,6 +131,7 @@ module Stripe
118
131
  )
119
132
  end
120
133
 
134
+ # Changes the settings on a customer's cash balance.
121
135
  def self.update_cash_balance(customer, params = {}, opts = {})
122
136
  request_stripe_object(
123
137
  method: :post,
@@ -134,6 +148,7 @@ module Stripe
134
148
  class TestHelpers < APIResourceTestHelpers
135
149
  RESOURCE_CLASS = Customer
136
150
 
151
+ # Create an incoming testmode bank transfer
137
152
  def self.fund_cash_balance(customer, params = {}, opts = {})
138
153
  request_stripe_object(
139
154
  method: :post,
@@ -143,6 +158,7 @@ module Stripe
143
158
  )
144
159
  end
145
160
 
161
+ # Create an incoming testmode bank transfer
146
162
  def fund_cash_balance(params = {}, opts = {})
147
163
  @resource.request_stripe_object(
148
164
  method: :post,
@@ -13,6 +13,9 @@ module Stripe
13
13
 
14
14
  OBJECT_NAME = "dispute"
15
15
 
16
+ # 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.
17
+ #
18
+ # The status of the dispute will change from needs_response to lost. Closing a dispute is irreversible.
16
19
  def close(params = {}, opts = {})
17
20
  request_stripe_object(
18
21
  method: :post,
@@ -22,6 +25,9 @@ module Stripe
22
25
  )
23
26
  end
24
27
 
28
+ # 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.
29
+ #
30
+ # The status of the dispute will change from needs_response to lost. Closing a dispute is irreversible.
25
31
  def self.close(dispute, params = {}, opts = {})
26
32
  request_stripe_object(
27
33
  method: :post,
@@ -6,12 +6,10 @@ module Stripe
6
6
  # A Financial Connections Account represents an account that exists outside of Stripe, to which you have been granted some degree of access.
7
7
  class Account < APIResource
8
8
  extend Stripe::APIOperations::List
9
- extend Stripe::APIOperations::NestedResource
10
9
 
11
10
  OBJECT_NAME = "financial_connections.account"
12
11
 
13
- nested_resource_class_methods :inferred_balance, operations: %i[list]
14
-
12
+ # Disables your access to a Financial Connections Account. You will no longer be able to access data associated with the account (e.g. balances, transactions).
15
13
  def disconnect(params = {}, opts = {})
16
14
  request_stripe_object(
17
15
  method: :post,
@@ -21,6 +19,7 @@ module Stripe
21
19
  )
22
20
  end
23
21
 
22
+ # Lists all owners for a given Account
24
23
  def list_owners(params = {}, opts = {})
25
24
  request_stripe_object(
26
25
  method: :get,
@@ -30,6 +29,7 @@ module Stripe
30
29
  )
31
30
  end
32
31
 
32
+ # Refreshes the data associated with a Financial Connections Account.
33
33
  def refresh_account(params = {}, opts = {})
34
34
  request_stripe_object(
35
35
  method: :post,
@@ -39,6 +39,7 @@ module Stripe
39
39
  )
40
40
  end
41
41
 
42
+ # Subscribes to periodic refreshes of data associated with a Financial Connections Account.
42
43
  def subscribe(params = {}, opts = {})
43
44
  request_stripe_object(
44
45
  method: :post,
@@ -48,6 +49,7 @@ module Stripe
48
49
  )
49
50
  end
50
51
 
52
+ # Unsubscribes from periodic refreshes of data associated with a Financial Connections Account.
51
53
  def unsubscribe(params = {}, opts = {})
52
54
  request_stripe_object(
53
55
  method: :post,
@@ -57,6 +59,7 @@ module Stripe
57
59
  )
58
60
  end
59
61
 
62
+ # Disables your access to a Financial Connections Account. You will no longer be able to access data associated with the account (e.g. balances, transactions).
60
63
  def self.disconnect(account, params = {}, opts = {})
61
64
  request_stripe_object(
62
65
  method: :post,
@@ -66,6 +69,7 @@ module Stripe
66
69
  )
67
70
  end
68
71
 
72
+ # Lists all owners for a given Account
69
73
  def self.list_owners(account, params = {}, opts = {})
70
74
  request_stripe_object(
71
75
  method: :get,
@@ -75,6 +79,7 @@ module Stripe
75
79
  )
76
80
  end
77
81
 
82
+ # Refreshes the data associated with a Financial Connections Account.
78
83
  def self.refresh_account(account, params = {}, opts = {})
79
84
  request_stripe_object(
80
85
  method: :post,
@@ -84,6 +89,7 @@ module Stripe
84
89
  )
85
90
  end
86
91
 
92
+ # Subscribes to periodic refreshes of data associated with a Financial Connections Account.
87
93
  def self.subscribe(account, params = {}, opts = {})
88
94
  request_stripe_object(
89
95
  method: :post,
@@ -93,6 +99,7 @@ module Stripe
93
99
  )
94
100
  end
95
101
 
102
+ # Unsubscribes from periodic refreshes of data associated with a Financial Connections Account.
96
103
  def self.unsubscribe(account, params = {}, opts = {})
97
104
  request_stripe_object(
98
105
  method: :post,
@@ -21,6 +21,9 @@ module Stripe
21
21
 
22
22
  OBJECT_NAME = "identity.verification_session"
23
23
 
24
+ # A VerificationSession object can be canceled when it is in requires_input [status](https://stripe.com/docs/identity/how-sessions-work).
25
+ #
26
+ # Once canceled, future submission attempts are disabled. This cannot be undone. [Learn more](https://stripe.com/docs/identity/verification-sessions#cancel).
24
27
  def cancel(params = {}, opts = {})
25
28
  request_stripe_object(
26
29
  method: :post,
@@ -30,6 +33,25 @@ module Stripe
30
33
  )
31
34
  end
32
35
 
36
+ # Redact a VerificationSession to remove all collected information from Stripe. This will redact
37
+ # the VerificationSession and all objects related to it, including VerificationReports, Events,
38
+ # request logs, etc.
39
+ #
40
+ # A VerificationSession object can be redacted when it is in requires_input or verified
41
+ # [status](https://stripe.com/docs/identity/how-sessions-work). Redacting a VerificationSession in requires_action
42
+ # state will automatically cancel it.
43
+ #
44
+ # The redaction process may take up to four days. When the redaction process is in progress, the
45
+ # VerificationSession's redaction.status field will be set to processing; when the process is
46
+ # finished, it will change to redacted and an identity.verification_session.redacted event
47
+ # will be emitted.
48
+ #
49
+ # Redaction is irreversible. Redacted objects are still accessible in the Stripe API, but all the
50
+ # fields that contain personal data will be replaced by the string [redacted] or a similar
51
+ # placeholder. The metadata field will also be erased. Redacted objects cannot be updated or
52
+ # used for any purpose.
53
+ #
54
+ # [Learn more](https://stripe.com/docs/identity/verification-sessions#redact).
33
55
  def redact(params = {}, opts = {})
34
56
  request_stripe_object(
35
57
  method: :post,
@@ -39,6 +61,9 @@ module Stripe
39
61
  )
40
62
  end
41
63
 
64
+ # A VerificationSession object can be canceled when it is in requires_input [status](https://stripe.com/docs/identity/how-sessions-work).
65
+ #
66
+ # Once canceled, future submission attempts are disabled. This cannot be undone. [Learn more](https://stripe.com/docs/identity/verification-sessions#cancel).
42
67
  def self.cancel(session, params = {}, opts = {})
43
68
  request_stripe_object(
44
69
  method: :post,
@@ -48,6 +73,25 @@ module Stripe
48
73
  )
49
74
  end
50
75
 
76
+ # Redact a VerificationSession to remove all collected information from Stripe. This will redact
77
+ # the VerificationSession and all objects related to it, including VerificationReports, Events,
78
+ # request logs, etc.
79
+ #
80
+ # A VerificationSession object can be redacted when it is in requires_input or verified
81
+ # [status](https://stripe.com/docs/identity/how-sessions-work). Redacting a VerificationSession in requires_action
82
+ # state will automatically cancel it.
83
+ #
84
+ # The redaction process may take up to four days. When the redaction process is in progress, the
85
+ # VerificationSession's redaction.status field will be set to processing; when the process is
86
+ # finished, it will change to redacted and an identity.verification_session.redacted event
87
+ # will be emitted.
88
+ #
89
+ # Redaction is irreversible. Redacted objects are still accessible in the Stripe API, but all the
90
+ # fields that contain personal data will be replaced by the string [redacted] or a similar
91
+ # placeholder. The metadata field will also be erased. Redacted objects cannot be updated or
92
+ # used for any purpose.
93
+ #
94
+ # [Learn more](https://stripe.com/docs/identity/verification-sessions#redact).
51
95
  def self.redact(session, params = {}, opts = {})
52
96
  request_stripe_object(
53
97
  method: :post,
@@ -40,21 +40,10 @@ module Stripe
40
40
  extend Stripe::APIOperations::List
41
41
  extend Stripe::APIOperations::Search
42
42
  include Stripe::APIOperations::Save
43
- extend Stripe::APIOperations::NestedResource
44
43
 
45
44
  OBJECT_NAME = "invoice"
46
45
 
47
- nested_resource_class_methods :payment, operations: %i[retrieve list]
48
-
49
- def attach_payment_intent(params = {}, opts = {})
50
- request_stripe_object(
51
- method: :post,
52
- path: format("/v1/invoices/%<invoice>s/attach_payment_intent", { invoice: CGI.escape(self["id"]) }),
53
- params: params,
54
- opts: opts
55
- )
56
- end
57
-
46
+ # Stripe automatically finalizes drafts before sending and attempting payment on invoices. However, if you'd like to finalize a draft invoice manually, you can do so using this method.
58
47
  def finalize_invoice(params = {}, opts = {})
59
48
  request_stripe_object(
60
49
  method: :post,
@@ -64,6 +53,7 @@ module Stripe
64
53
  )
65
54
  end
66
55
 
56
+ # Marking an invoice as uncollectible is useful for keeping track of bad debts that can be written off for accounting purposes.
67
57
  def mark_uncollectible(params = {}, opts = {})
68
58
  request_stripe_object(
69
59
  method: :post,
@@ -73,6 +63,7 @@ module Stripe
73
63
  )
74
64
  end
75
65
 
66
+ # Stripe automatically creates and then attempts to collect payment on invoices for customers on subscriptions according to your [subscriptions settings](https://dashboard.stripe.com/account/billing/automatic). However, if you'd like to attempt payment on an invoice out of the normal collection schedule or for some other reason, you can do so.
76
67
  def pay(params = {}, opts = {})
77
68
  request_stripe_object(
78
69
  method: :post,
@@ -82,6 +73,9 @@ module Stripe
82
73
  )
83
74
  end
84
75
 
76
+ # Stripe will automatically send invoices to customers according to your [subscriptions settings](https://dashboard.stripe.com/account/billing/automatic). However, if you'd like to manually send an invoice to your customer out of the normal schedule, you can do so. When sending invoices that have already been paid, there will be no reference to the payment in the email.
77
+ #
78
+ # Requests made in test-mode result in no emails being sent, despite sending an invoice.sent event.
85
79
  def send_invoice(params = {}, opts = {})
86
80
  request_stripe_object(
87
81
  method: :post,
@@ -91,6 +85,7 @@ module Stripe
91
85
  )
92
86
  end
93
87
 
88
+ # Mark a finalized invoice as void. This cannot be undone. Voiding an invoice is similar to [deletion](https://stripe.com/docs/api#delete_invoice), however it only applies to finalized invoices and maintains a papertrail where the invoice can still be found.
94
89
  def void_invoice(params = {}, opts = {})
95
90
  request_stripe_object(
96
91
  method: :post,
@@ -100,15 +95,7 @@ module Stripe
100
95
  )
101
96
  end
102
97
 
103
- def self.attach_payment_intent(invoice, params = {}, opts = {})
104
- request_stripe_object(
105
- method: :post,
106
- path: format("/v1/invoices/%<invoice>s/attach_payment_intent", { invoice: CGI.escape(invoice) }),
107
- params: params,
108
- opts: opts
109
- )
110
- end
111
-
98
+ # Stripe automatically finalizes drafts before sending and attempting payment on invoices. However, if you'd like to finalize a draft invoice manually, you can do so using this method.
112
99
  def self.finalize_invoice(invoice, params = {}, opts = {})
113
100
  request_stripe_object(
114
101
  method: :post,
@@ -118,6 +105,7 @@ module Stripe
118
105
  )
119
106
  end
120
107
 
108
+ # When retrieving an upcoming invoice, you'll get a lines property containing the total count of line items and the first handful of those items. There is also a URL where you can retrieve the full (paginated) list of line items.
121
109
  def self.list_upcoming_line_items(params = {}, opts = {})
122
110
  request_stripe_object(
123
111
  method: :get,
@@ -127,6 +115,7 @@ module Stripe
127
115
  )
128
116
  end
129
117
 
118
+ # Marking an invoice as uncollectible is useful for keeping track of bad debts that can be written off for accounting purposes.
130
119
  def self.mark_uncollectible(invoice, params = {}, opts = {})
131
120
  request_stripe_object(
132
121
  method: :post,
@@ -136,6 +125,7 @@ module Stripe
136
125
  )
137
126
  end
138
127
 
128
+ # Stripe automatically creates and then attempts to collect payment on invoices for customers on subscriptions according to your [subscriptions settings](https://dashboard.stripe.com/account/billing/automatic). However, if you'd like to attempt payment on an invoice out of the normal collection schedule or for some other reason, you can do so.
139
129
  def self.pay(invoice, params = {}, opts = {})
140
130
  request_stripe_object(
141
131
  method: :post,
@@ -145,6 +135,9 @@ module Stripe
145
135
  )
146
136
  end
147
137
 
138
+ # Stripe will automatically send invoices to customers according to your [subscriptions settings](https://dashboard.stripe.com/account/billing/automatic). However, if you'd like to manually send an invoice to your customer out of the normal schedule, you can do so. When sending invoices that have already been paid, there will be no reference to the payment in the email.
139
+ #
140
+ # Requests made in test-mode result in no emails being sent, despite sending an invoice.sent event.
148
141
  def self.send_invoice(invoice, params = {}, opts = {})
149
142
  request_stripe_object(
150
143
  method: :post,
@@ -154,10 +147,16 @@ module Stripe
154
147
  )
155
148
  end
156
149
 
150
+ # At any time, you can preview the upcoming invoice for a customer. This will show you all the charges that are pending, including subscription renewal charges, invoice item charges, etc. It will also show you any discounts that are applicable to the invoice.
151
+ #
152
+ # Note that when you are viewing an upcoming invoice, you are simply viewing a preview – the invoice has not yet been created. As such, the upcoming invoice will not show up in invoice listing calls, and you cannot use the API to pay or edit the invoice. If you want to change the amount that your customer will be billed, you can add, remove, or update pending invoice items, or update the customer's discount.
153
+ #
154
+ # You can preview the effects of updating a subscription, including a preview of what proration will take place. To ensure that the actual proration is calculated exactly the same as the previewed proration, you should pass a proration_date parameter when doing the actual subscription update. The value passed in should be the same as the subscription_proration_date returned on the upcoming invoice resource. The recommended way to get only the prorations being previewed is to consider only proration line items where period[start] is equal to the subscription_proration_date on the upcoming invoice resource.
157
155
  def self.upcoming(params = {}, opts = {})
158
156
  request_stripe_object(method: :get, path: "/v1/invoices/upcoming", params: params, opts: opts)
159
157
  end
160
158
 
159
+ # Mark a finalized invoice as void. This cannot be undone. Voiding an invoice is similar to [deletion](https://stripe.com/docs/api#delete_invoice), however it only applies to finalized invoices and maintains a papertrail where the invoice can still be found.
161
160
  def self.void_invoice(invoice, params = {}, opts = {})
162
161
  request_stripe_object(
163
162
  method: :post,
@@ -14,6 +14,8 @@ module Stripe
14
14
 
15
15
  OBJECT_NAME = "issuing.authorization"
16
16
 
17
+ # [Deprecated] Approves a pending Issuing Authorization object. This request should be made within the timeout window of the [real-time authorization](https://stripe.com/docs/issuing/controls/real-time-authorizations) flow.
18
+ # This method is deprecated. Instead, [respond directly to the webhook request to approve an authorization](https://stripe.com/docs/issuing/controls/real-time-authorizations#authorization-handling).
17
19
  def approve(params = {}, opts = {})
18
20
  request_stripe_object(
19
21
  method: :post,
@@ -23,6 +25,8 @@ module Stripe
23
25
  )
24
26
  end
25
27
 
28
+ # [Deprecated] Declines a pending Issuing Authorization object. This request should be made within the timeout window of the [real time authorization](https://stripe.com/docs/issuing/controls/real-time-authorizations) flow.
29
+ # This method is deprecated. Instead, [respond directly to the webhook request to decline an authorization](https://stripe.com/docs/issuing/controls/real-time-authorizations#authorization-handling).
26
30
  def decline(params = {}, opts = {})
27
31
  request_stripe_object(
28
32
  method: :post,
@@ -32,6 +36,8 @@ module Stripe
32
36
  )
33
37
  end
34
38
 
39
+ # [Deprecated] Approves a pending Issuing Authorization object. This request should be made within the timeout window of the [real-time authorization](https://stripe.com/docs/issuing/controls/real-time-authorizations) flow.
40
+ # This method is deprecated. Instead, [respond directly to the webhook request to approve an authorization](https://stripe.com/docs/issuing/controls/real-time-authorizations#authorization-handling).
35
41
  def self.approve(authorization, params = {}, opts = {})
36
42
  request_stripe_object(
37
43
  method: :post,
@@ -41,6 +47,8 @@ module Stripe
41
47
  )
42
48
  end
43
49
 
50
+ # [Deprecated] Declines a pending Issuing Authorization object. This request should be made within the timeout window of the [real time authorization](https://stripe.com/docs/issuing/controls/real-time-authorizations) flow.
51
+ # This method is deprecated. Instead, [respond directly to the webhook request to decline an authorization](https://stripe.com/docs/issuing/controls/real-time-authorizations#authorization-handling).
44
52
  def self.decline(authorization, params = {}, opts = {})
45
53
  request_stripe_object(
46
54
  method: :post,
@@ -57,6 +65,7 @@ module Stripe
57
65
  class TestHelpers < APIResourceTestHelpers
58
66
  RESOURCE_CLASS = Authorization
59
67
 
68
+ # Capture a test-mode authorization.
60
69
  def self.capture(authorization, params = {}, opts = {})
61
70
  request_stripe_object(
62
71
  method: :post,
@@ -66,6 +75,7 @@ module Stripe
66
75
  )
67
76
  end
68
77
 
78
+ # Create a test-mode authorization.
69
79
  def self.create(params = {}, opts = {})
70
80
  request_stripe_object(
71
81
  method: :post,
@@ -75,6 +85,7 @@ module Stripe
75
85
  )
76
86
  end
77
87
 
88
+ # Expire a test-mode Authorization.
78
89
  def self.expire(authorization, params = {}, opts = {})
79
90
  request_stripe_object(
80
91
  method: :post,
@@ -84,6 +95,7 @@ module Stripe
84
95
  )
85
96
  end
86
97
 
98
+ # Increment a test-mode Authorization.
87
99
  def self.increment(authorization, params = {}, opts = {})
88
100
  request_stripe_object(
89
101
  method: :post,
@@ -93,6 +105,7 @@ module Stripe
93
105
  )
94
106
  end
95
107
 
108
+ # Reverse a test-mode Authorization.
96
109
  def self.reverse(authorization, params = {}, opts = {})
97
110
  request_stripe_object(
98
111
  method: :post,
@@ -102,6 +115,7 @@ module Stripe
102
115
  )
103
116
  end
104
117
 
118
+ # Capture a test-mode authorization.
105
119
  def capture(params = {}, opts = {})
106
120
  @resource.request_stripe_object(
107
121
  method: :post,
@@ -111,6 +125,7 @@ module Stripe
111
125
  )
112
126
  end
113
127
 
128
+ # Expire a test-mode Authorization.
114
129
  def expire(params = {}, opts = {})
115
130
  @resource.request_stripe_object(
116
131
  method: :post,
@@ -120,6 +135,7 @@ module Stripe
120
135
  )
121
136
  end
122
137
 
138
+ # Increment a test-mode Authorization.
123
139
  def increment(params = {}, opts = {})
124
140
  @resource.request_stripe_object(
125
141
  method: :post,
@@ -129,6 +145,7 @@ module Stripe
129
145
  )
130
146
  end
131
147
 
148
+ # Reverse a test-mode Authorization.
132
149
  def reverse(params = {}, opts = {})
133
150
  @resource.request_stripe_object(
134
151
  method: :post,
@@ -18,6 +18,7 @@ module Stripe
18
18
  class TestHelpers < APIResourceTestHelpers
19
19
  RESOURCE_CLASS = Card
20
20
 
21
+ # Updates the shipping status of the specified Issuing Card object to delivered.
21
22
  def self.deliver_card(card, params = {}, opts = {})
22
23
  request_stripe_object(
23
24
  method: :post,
@@ -27,6 +28,7 @@ module Stripe
27
28
  )
28
29
  end
29
30
 
31
+ # Updates the shipping status of the specified Issuing Card object to failure.
30
32
  def self.fail_card(card, params = {}, opts = {})
31
33
  request_stripe_object(
32
34
  method: :post,
@@ -36,6 +38,7 @@ module Stripe
36
38
  )
37
39
  end
38
40
 
41
+ # Updates the shipping status of the specified Issuing Card object to returned.
39
42
  def self.return_card(card, params = {}, opts = {})
40
43
  request_stripe_object(
41
44
  method: :post,
@@ -45,6 +48,7 @@ module Stripe
45
48
  )
46
49
  end
47
50
 
51
+ # Updates the shipping status of the specified Issuing Card object to shipped.
48
52
  def self.ship_card(card, params = {}, opts = {})
49
53
  request_stripe_object(
50
54
  method: :post,
@@ -54,6 +58,7 @@ module Stripe
54
58
  )
55
59
  end
56
60
 
61
+ # Updates the shipping status of the specified Issuing Card object to delivered.
57
62
  def deliver_card(params = {}, opts = {})
58
63
  @resource.request_stripe_object(
59
64
  method: :post,
@@ -63,6 +68,7 @@ module Stripe
63
68
  )
64
69
  end
65
70
 
71
+ # Updates the shipping status of the specified Issuing Card object to failure.
66
72
  def fail_card(params = {}, opts = {})
67
73
  @resource.request_stripe_object(
68
74
  method: :post,
@@ -72,6 +78,7 @@ module Stripe
72
78
  )
73
79
  end
74
80
 
81
+ # Updates the shipping status of the specified Issuing Card object to returned.
75
82
  def return_card(params = {}, opts = {})
76
83
  @resource.request_stripe_object(
77
84
  method: :post,
@@ -81,6 +88,7 @@ module Stripe
81
88
  )
82
89
  end
83
90
 
91
+ # Updates the shipping status of the specified Issuing Card object to shipped.
84
92
  def ship_card(params = {}, opts = {})
85
93
  @resource.request_stripe_object(
86
94
  method: :post,