繁体   English   中英

条纹创建收费发票

[英]Stripe create invoice/invoices for charges

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

以下是我如何收取费用。

\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的订阅一起使用。 如果您要一次性扣除一系列项目的费用,则只需为总金额创建费用,然后按照自己的逻辑/合计这些项目。

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
));

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM