我刚开始在我的项目中使用条带(使用Laravel Framework),我想问一个问题。如何在Stripe中付款后添加一些积分?
我甚至发现我为积分系统打包,但在付款后我不知道如何链接或触发事件。
我的想法是遵循这个工作流来实现Stripe,但是我可以为之后的点做些什么呢? http://felicianoprochera.com/simple-payments-with-stripe-and-laravel/
所以...我必须建立的是一个可充电点系统,因此在一定费用之后 - >对应一定数量的积分用于产品。我应该采取什么“道路”才能做到这一点?
EDIT。为此,我决定更简单的方法是在收费后在我的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);
}
哪种方法最好也最简单?