diff --git a/OPENAPI_VERSION b/OPENAPI_VERSION index 1b60cdbc5..404e303af 100644 --- a/OPENAPI_VERSION +++ b/OPENAPI_VERSION @@ -1 +1 @@ -v1156 \ No newline at end of file +v1165 \ No newline at end of file diff --git a/lib/stripe/resources/invoice.rb b/lib/stripe/resources/invoice.rb index 03dfefd48..1067e7612 100644 --- a/lib/stripe/resources/invoice.rb +++ b/lib/stripe/resources/invoice.rb @@ -70,6 +70,50 @@ def self.add_lines(invoice, params = {}, opts = {}) ) end + # Attaches a PaymentIntent or an Out of Band Payment to the invoice, adding it to the list of payments. + # + # For Out of Band Payment, the payment is credited to the invoice immediately, increasing the amount_paid + # of the invoice and subsequently transitioning the status of the invoice to paid if necessary. + # + # For the PaymentIntent, when the PaymentIntent's status changes to succeeded, the payment is credited + # to the invoice, increasing its amount_paid. When the invoice is fully paid, the + # invoice's status becomes paid. + # + # If the PaymentIntent's status is already succeeded when it's attached, it's + # credited to the invoice immediately. + # + # See: [Create an invoice payment](https://stripe.com/docs/invoicing/payments/create) to learn more. + def attach_payment(params = {}, opts = {}) + request_stripe_object( + method: :post, + path: format("/v1/invoices/%s/attach_payment", { invoice: CGI.escape(self["id"]) }), + params: params, + opts: opts + ) + end + + # Attaches a PaymentIntent or an Out of Band Payment to the invoice, adding it to the list of payments. + # + # For Out of Band Payment, the payment is credited to the invoice immediately, increasing the amount_paid + # of the invoice and subsequently transitioning the status of the invoice to paid if necessary. + # + # For the PaymentIntent, when the PaymentIntent's status changes to succeeded, the payment is credited + # to the invoice, increasing its amount_paid. When the invoice is fully paid, the + # invoice's status becomes paid. + # + # If the PaymentIntent's status is already succeeded when it's attached, it's + # credited to the invoice immediately. + # + # See: [Create an invoice payment](https://stripe.com/docs/invoicing/payments/create) to learn more. + def self.attach_payment(invoice, params = {}, opts = {}) + request_stripe_object( + method: :post, + path: format("/v1/invoices/%s/attach_payment", { invoice: CGI.escape(invoice) }), + params: params, + opts: opts + ) + end + # Attaches a PaymentIntent to the invoice, adding it to the list of payments. # When the PaymentIntent's status changes to succeeded, the payment is credited # to the invoice, increasing its amount_paid. When the invoice is fully paid, the