我使用Stripe使用此处的API https://github.com/myg0v/Simple-Bootstrap-Stripe-Payment-Form
在PHP中处理我的付款我使用以下代码发放付款:
$charge = Stripe_Charge::create(array("amount" => $amount,
"currency" => "$currency",
"card" => $stripetoken,
"description" => $email));
以下代码会检索charge_id并退还用户吗?
$charge_id = $charge->stripe_charge_id;
$refund = Stripe_Refund::create(array(
"charge" => "$charge_id"
));
答案 0 :(得分:1)
此语法适用于Stripe's PHP library(1.x)的旧版本。您应确保使用最新版本(目前为4.4.0)。
Stripe的API reference包含每个请求和语言的示例。您可以查看以下示例请求:
基本上:
$charge = \Stripe\Charge::create(array(
"amount" => $amount,
"currency" => $currency,
"source" = $token,
"description" => "Charge for $email"
));
$refund = \Stripe\Refund::create(array(
"charge" => $charge->id
));