【问题标题】:Add Points after Stripe Payment [Laravel 5.4]条纹支付后添加积分 [Laravel 5.4]
【发布时间】: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


【解决方案1】:

如果您使用laravel-pointable 之类的东西,我猜您会在成功充电后使用add points - 即,只要没有error

【讨论】:

  • 它可以是一种方式......例如在我的工作流程中有不同的功能。另一种可能性是在“postStoreOrder”函数中添加点(如果我尝试与帖子中的链接相同的工作流程)。所以在所有操作和成功消息之后,我也可以加分。也许它可以工作?
  • 唯一的方法就是测试它。
猜你喜欢
  • 1970-01-01
  • 2020-11-08
  • 2017-09-14
  • 2021-08-02
  • 2020-12-30
  • 2021-01-13
  • 2020-03-26
  • 1970-01-01
  • 2021-11-19
相关资源
最近更新 更多