data := invoice.CreateParams{
ExternalID: sop.ID,
Amount: sop.TotalAmount,
PayerEmail: sop.AccountID,
Description: fmt.Sprintf("Invoice #%s", sop.ID),
InvoiceDuration: int(expiredAt.Sub(time.Now()).Seconds()),
}
resp, e := invoice.Create(&data)
if e != nil {
return e
}
{
"error_code": "API_VALIDATION_ERROR",
"message": "There was an error with the format submitted to the server.",
"errors": [
{
"field": [
"invoice_duration"
],
"location": "body",
"messages": [
"\"invoice_duration\" must be greater than 0"
],
"types": [
"number.greater"
]
}
]
}
It will good if we also got error details in response. it will saving more time for debugging what's wrong with it