Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

redroseamit's avatar

how to get default amount from existing form by using stripe

here 15000 is set in controller how can i get this amount value from payment form there amount is added.


      public function startpay(Request $request)
    {



 
Stripe\Stripe::setApiKey('XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX');
        Stripe\Charge::create ([

                "amount" => 100 * 15000,
                "currency" => "inr",
                "source" => $request->stripeToken,
                "description" => "test payment." 
        ]);
  
        Session::flash('success', 'Payment has been successfully processed.');
          
        return back();
    }





0 likes
3 replies
fylzero's avatar

@redroseamit If I understand the question... pass it through the request?

Stripe\Charge::create ([
    "amount" => 100 * $request->amount,
    "currency" => "inr",
    "source" => $request->stripeToken,
    "description" => "test payment." 
]);
redroseamit's avatar

sir i tried it already its showing error Stripe\Exception\InvalidRequestException This value must be greater than or equal to 1.

fylzero's avatar
fylzero
Best Answer
Level 67

@redroseamit You need the form to pass an amount field. Stripe is telling you that you cant' create a transaction with a 0 amount.

Try dd'ing your $request->amount

dd($request->amount);

This needs to not be 0 or null.

1 like

Please or to participate in this conversation.