gpt4 book ai didi

php - strip 创建发票/收费发票

转载 作者:行者123 更新时间:2023-12-01 13:48:10 32 4
gpt4 key购买 nike

我正在使用一次付款,并且尝试生成费用发票,我可以列出所有费用,但是我没有看到生成费用发票的方法。

以下是我如何收取费用。

\Stripe\InvoiceItem::create(array(
"customer" => $customer_id,
"amount" => $price,
"currency" => "aud",
"description" => $courseTitle)
);// creating invoice items here


$charges = \Stripe\InvoiceItem::all(array("customer" => $customer_id));

最佳答案

以这种方式使用Invoices有点不寻常,在大多数情况下,它们与Stripe的Subscriptions一起使用。如果您想一次性扣除一系列项目的费用,则只需为总金额创建费用,然后按照自己的逻辑/合计这些项目。

https://stripe.com/docs/api/php#create_charge

\Stripe\Charge::create(array(
"amount" => 2000,
"currency" => "usd",
"customer" => "cus_xxxyyyzz", // charge my existing customer
"description" => "Charge items"
));

如果您打算使用发票,则可以创建客户,添加发票项目,然后创建发票。

https://stripe.com/docs/api/php#create_invoice
// create customer
$customer = \Stripe\Customer::create(array(
"description" => "Jamie Smith",
"source" => "tok_mastercard" // normally obtained with Stripe.js
));

// create invoice items
\Stripe\InvoiceItem::create(array(
"customer" => $customer->id,
"amount" => 2500,
"currency" => "usd",
"description" => "One-time fee")
);

// pulls in invoice items
\Stripe\Invoice::create(array(
"customer" => $customer->id
));

关于php - strip 创建发票/收费发票,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50546076/

32 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com