【发布时间】:2017-02-24 03:59:03
【问题描述】:
我刚开始在我的项目中使用条纹(使用 Laravel 框架),我想问一个问题。在 Stripe 付款后如何添加积分?
我什至发现我为积分系统打包,但我不知道付款后如何链接或触发事件。
我的想法是按照这个工作流程来实现 Stripe,但是之后的点我能做些什么呢? http://felicianoprochera.com/simple-payments-with-stripe-and-laravel/
所以...我要建立的是一个可充值的积分系统,所以在一定的收费后->对应一定数量的积分可以用来购买产品。我应该走什么“路”才能做到这一点?
编辑。为此,我决定更简单的方法是在我的 OrderController 中插入一些东西,在收费之后,这样我就可以添加点。为此,我可以在用户表中创建一个积分器并存储积分,并根据产品添加积分。或者我可以使用laravel-pointable包来加分。
这是我的OrderController,这是充电部分。
public function createStripeCharge($product_id, $product_price, $product_name, $customer)
{
try {
$charge = \Stripe\Charge::create(array(
"amount" => $product_price,
"currency" => "brl",
"customer" => $customer->id,
"description" => $product_name
));
} catch(\Stripe\Error\Card $e) {
return redirect()
->route('index')
->with('error', 'Your credit card was been declined. Please try again or contact us.');
}
return $this->postStoreOrder($product_name);
}
什么是最好和最简单的方法?
【问题讨论】:
-
对于要点没什么,因为我不知道该怎么做:)
标签: php laravel laravel-5 stripe-payments points