Skip to content

Cannot finalize newly created invoice #173

Open
@adrianlungu

Description

Hello,

In this specific flow, the finalize seems to be behaving slightly different than what Stripe is doing:

  1. Create invoice items for a specific customer: stripeClient.InvoiceItems.New(params)
  2. Create the new invoice for the customer: stripeClient.Invoices.New(params)
  3. Finalize the invoice in order for Stripe to attempt payment:
        finalizeParams := &stripe.InvoiceFinalizeParams{}
	finalizeParams.AddExpand("payment_intent")
	invoice, err := stripeClient.Invoices.FinalizeInvoice(newInvoice.ID, finalizeParams)

These are the logs outlining the described steps:

localstripe_1  | ::ffff:172.23.0.5 [27/Jan/2021:20:14:54 +0000] "POST /v1/invoiceitems HTTP/1.1" 200 635 "-" "Stripe/v1 GoBindings/69.3.0"
localstripe_1  | ::ffff:172.23.0.5 [27/Jan/2021:20:14:54 +0000] "POST /v1/invoices HTTP/1.1" 200 3156 "-" "Stripe/v1 GoBindings/69.3.0"
localstripe_1  | ::ffff:172.23.0.5 [27/Jan/2021:20:28:34 +0000] "POST /v1/invoices/in_83vIseHK26CYkd/finalize HTTP/1.1" 404 172 "-" "Stripe/v1 GoBindings/69.3.0"
backend_1      | 2021/01/27 20:14:54 logger.go:34: create proration invoice error:  Couldn't deserialize JSON (response status: 404, body sample: '404: Not Found'): invalid character ':' after top-level value
localstripe_1  | ::ffff:172.23.0.5 [27/Jan/2021:20:28:34 +0000] "POST /v1/invoices/in_83vIseHK26CYkd/void HTTP/1.1" 400 253 "-" "Stripe/v1 GoBindings/69.3.0"

We attempt to void the invoice in case anything goes wrong, but that also returns a 404.

Am I understanding correctly that localstripe currently finalizes the invoice during the creation process ? I.e. in POST /v1/invoices ?

Thanks!

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions