英文:
Stripe: Creating invoice Item without invoice, adding invoice item into new invoice
问题
我使用以下代码创建了多个没有发票ID的发票项目。
const invoiceItem = await stripe.invoiceItems.create({
customer: customerId,
price,
});
现在我想发送一个包含所有已创建的发票项目的发票。
但是,我不能简单地创建一个发票并将我的发票项目更新为具有发票ID,因为Stripe不允许这样做。
以下是我在Stripe帐户中真正想要实现的内容(红色圆圈中的“立即发票”按钮):
如何编写“立即发票”按钮的代码? 我需要重新创建所有发票项目吗?
英文:
I created multiple invoice item without an invoice id with the following code.
const invoiceItem = await stripe.invoiceItems.create({
customer: customerId,
price,
});
Now I want to send an invoice that includes all the invoice item that was created.
however I can't simply create an invoice and update my invoice item with the invoice id as stripe does not allow that.
// ===== DOES NOT WORK =====
const invoice = await stripe.invoices.create({
customer: customerId,
collection_method: 'send_invoice',
days_until_due: 30,
});
await stripe.invoiceItems.update({
customer: customerId,
price,
invoice: invoice.id,
})
what I really want to achieve is actually the following in stripe account (button circle in red)
How do I code the "Invoice now" button? Do I need to re-create all the invoice item??
答案1
得分: 1
> 当参数被省略时,默认值为pending_invoice_items_behavior现在是排除。
因此,您想要指定pending_invoice_items_behavior为include
,以包括所有未处理的发票项目。
英文:
From API version 2022-08-01:
> When the parameter is omitted the default value of pending_invoice_items_behavior is now exclude.
So you want to specify pending_invoice_items_behavior to include
to include all the pending Invoice Items into it.
答案2
得分: 0
只需添加发票条目。这些将显示在客户端上。然后,发票现在会将所有未结发票条目并生成发票。
英文:
just add invoiceitems. those will appear on the client. Invoice now then takes all open invoiceitems and creates an invoice out of it
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论