首页 文章

Laravel应用程序中的条带集成

提问于
浏览
0

我正在尝试将Stripe集成到我的Laravel应用程序中 . 我正在尝试使用条纹的this(付卡)服务 .

我从Stripe重定向后使用下面的代码

try {
            $charge = Charge::create([
                'amount'          => $price * 100,
                'currency'        => 'gbp',
                'source'          => $request->stripeToken,
                'application_fee' => 123,          // Here is the issue , if I remove this line it works fine.
            ], [
                'stripe_account' => $stripe_id,
            ]);
        } catch (Exception $e) {
            return back()->withError('Something went wrong while processing your payment.');
        }

我收到了以下错误

enter image description here

UPDATE

现在我使用下面的代码 .

try {
        $charge = Charge::create([
            'amount'      => $price * 100,
            'currency'    => 'gbp',
            'source'      => $request->stripeToken,
            "destination" => array(
                "amount"  => 877,
                "account" => "ca_CxKfJvDzUYe3NUpOYZcRofjlZzE8OYCq",
            ),
        ], [
            'stripe_account' => $stripe_id,
        ]);
    } catch (Exception $e) {
        return back()->withError('Something went wrong while processing your payment.');
    }

我收到了以下错误

enter image description here

1 回答

  • 0

    这可能对你有所帮助 . 这对我来说很好 . 首先创建客户并获得客户ID并收取费用这是一步 . 任何其他问题..然后在这里ping

    $customer = \Stripe\Customer::create(array(
                            "email" => $cus_email,
                            "source" => $token,
                        ));
                        $charge = \Stripe\Charge::create(array(
                            "amount" => $TotalAmountPayment,
                            "currency" => "usd",
                            "customer" => $customer->id
                        ));
                         $customer_payamt=($charge->amount)/100;;
                         $customer_id=$charge->customer;
                         $balance_transaction_id=$charge->balance_transaction;
                         $payment_status_resp=$charge->outcome['seller_message'];
                         $cardlast4=$charge->source['last4'];
    

相关问题