我正在使用一次性付款,我正在尝试为收费生成发票,我可以列出所有费用,但在那里我没有看到生成收费发票的方法。
以下是我如何收取费用。
\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));
答案 0 :(得分:0)
以这种方式使用Invoices
有点不寻常,在大多数情况下,它们与Stripe的订阅一起使用。如果你想为一系列物品收取一次性费用,你只需要为总金额收取一笔费用,然后将你身边/逻辑中的物品加起来。
\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_charge
// 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
));