#Mahesh K
1 messages · Page 1 of 1 (latest)
Hello alex
i am getting the above error while creating an invoice in the stripe
and the following is the code that i written to create an invoice in stripe
async function createInvoice(obj, accountID, amountTotal) {
let modified_obj = {
customer: obj.p_stripe_id,
amount : amountTotal * 100,
collection_method: 'send_invoice',
currency: 'usd',
customer_email : obj.contact_email,
application_fee_amount : 500
}
let invoice = await stripe.invoices.create(modified_obj, { stripeAccount: accountID })
return invoice
}
can you share the request id?
there's no such parameter customer_email and amount
you shouldn't be passing in those two parameters
i suggest you go through https://stripe.com/docs/invoicing/integration for a step by step on how to create an Invoice via the API
suggest me a way to pass this values
yes i have read the above document. in that they are adding the invoice items to a draft invoice.
but here we have more than 100 items
the email of the customer should be provided when you're creating the customer : https://stripe.com/docs/api/customers/create#create_customer-email
If you're looking to just charge the total to the customer, then you can just create a single Price for the total in-line : https://stripe.com/docs/api/invoiceitems/create#create_invoiceitem-price_data
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
if i run a loop to for the items then my system is crashing
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_email parameter is having
that's the parameters that you can see on the invoice object. You need to look at this page for what parameters you can pass in when creating the invoice : https://stripe.com/docs/api/invoices/create
const price = await stripe.prices.create({
unit_amount: 2000,
currency: 'usd',
});
will it generate the charge??
Prices define the unit cost, currency, and (optional) billing cycle for both recurring and one-time purchases of products. It doesn't generate a charge by itself
add up all your items price then pass in the values into the required fields in price_data when creating an Invoice Item : https://stripe.com/docs/api/invoiceitems/create#create_invoiceitem-price_data
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
here product id is required field
what can i show there
you need to have already created a product
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
then there is no way to add the amount for an invoice while creating it??
am i correct?
you can add the amount to the invoice item when creating an invoice item
ok alex