#wrld - invoice

1 messages · Page 1 of 1 (latest)

fast turtle
#

What issues?

finite dirge
#

I keep getting this when trying to send an invoice in golang

#
Sent Invoice 0```
#

I looked at the doc but I am sending the ID in the params

fast turtle
#

You're trying to finalize an invoice item not an invoice

#

Invoice id's start with in_123

#

Not ii_123

finite dirge
#

Ah

#

What should I refer to? This is from the docs

fast turtle
finite dirge
#
        Customer: stripe.String(createCus.ID),
          Price: stripe.String("price_1LQcoSD6yTzA8Nx6TCGJOS2p"),
    }
    createInv, err := invoiceitem.New(&createInvParams)
    if err != nil {
        fmt.Println("Unable to make invoice.")
    }
    if createInv.ID != "" {
    sendParam :=  &stripe.InvoiceFinalizeParams{};
    result, _ := invoice.FinalizeInvoice(createInv.ID, sendParam);
    fmt.Println("Sent Invoice", result.AmountRemaining)
    }

}```
fast turtle
#

Pass the invoice id

finite dirge
#

okay let me check

#

Brb

fast turtle
#

You don't create an invoice in your code it looks like

#

Just the invoice item

finite dirge
#

I was following the docs i mustve misread am checking now

#

So whats the algorithm for this

#

I just want to create an invoice and send. I already have the products id

#
        Name: stripe.String("john doe"),
        Email: stripe.String("johndoe@gmail.com"),
        Description: stripe.String("My first invoice."),
    }
    createCus, err := customer.New(custParams)
    if err != nil {
        fmt.Println("Unable to make customer")
    }
    createINVOICE(createCus)
    

}

func createINVOICE(createCus *stripe.Customer) {
    
    createInv := &stripe.InvoiceParams{
        Customer: &createCus.ID,
      }
      in, _ := invoice.New(createInv)
    if in.ID != "" {
    fmt.Println("Sent Invoice")
    }

}```
fast turtle
#

Read this guide

#

You're missing steps

#

Just go through it. You need both invoice item(s) and an invoice

finite dirge
#

okay I had invoice items before

#

but okay

fast turtle
#

Yes but you didn't have the invoice part

#

Now you have the invoice part but not the invoice items part

finite dirge
#

Lol

fast turtle
#

Just read the guide carefully and go through each step

finite dirge
#

okay let me add back