[英]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.