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();
}
@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."
]);
sir i tried it already its showing error Stripe\Exception\InvalidRequestException
This value must be greater than or equal to 1.
@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.
Please or to participate in this conversation.