#wrld - invoice
1 messages · Page 1 of 1 (latest)
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
You're trying to finalize an invoice item not an invoice
Invoice id's start with in_123
Not ii_123
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
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)
}
}```
Pass the invoice id
You don't create an invoice in your code it looks like
Just the invoice item
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
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")
}
}```
Read this guide
You're missing steps
Just go through it. You need both invoice item(s) and an invoice
Yes but you didn't have the invoice part
Now you have the invoice part but not the invoice items part
Lol
Just read the guide carefully and go through each step
okay let me add back