#Shivam Kumar

1 messages · Page 1 of 1 (latest)

mint martenBOT
lapis pine
#

Hi! Let me help you with this.

#

What do you mean by make payment from customer side?
I general, please use PaymentIntent to collect payments.

meager jasper
#

i want to collect rental payment.

lapis pine
#

Please use PaymentIntent for that. Create Charge API is deprecated.

meager jasper
#

ok thank you.

lapis pine
#

Happy to help. Let me know if you have any other questions.

meager jasper
#

Please let me know, when it was deprecated?

hushed shell
meager jasper
#

can you help me ?
i create a payment Intent like this,
$payment = $stripe->paymentIntents->create([
'amount' => $request->rent*100,
'currency' => 'usd',
'customer' => $user->stripe_customer_id,
'automatic_payment_methods' => [
'enabled' => true,
],
]);
what I do next, I check docs, but in docs user make payment using payment element but in my case , I already attach a payment method so what I do next.

hushed shell
#

what I do next, I check docs, but in docs user make payment using payment element but in my case , I already attach a payment method so what I do next.
In the code you shared, I don't see any PaymentMethod attached.

meager jasper
#

i attach like this
$payment = $stripe->paymentIntents->create([
'amount' => $request->rent*100,
'currency' => 'usd',
'customer' => $user->stripe_customer_id,
'payment_method' => $request->payment_method_id,
'automatic_payment_methods' => [
'enabled' => true,
],
]);

hushed shell
meager jasper
#

thanks its works, we need to setup web hook for payment Intents ?

#

i use this code
$stripe = new \Stripe\StripeClient($stripe_secret_key);
try{
$payment = $stripe->paymentIntents->create([
'amount' => $request->rent*100,
'currency' => 'usd',
'customer' => $user->stripe_customer_id,
'payment_method' => $request->payment_method_id,
]);
$payment_confirm = $stripe->paymentIntents->confirm(
$payment->id,
);
}catch(\Stripe\Exception\CardException $e){
return back()->with('error',$e->getError()->message);
}
$payment_confirm = $stripe->paymentIntents->retrieve(
$payment_confirm->id
);

hushed shell
round dew
#

👋 taking over for my colleague. Let me know if there's any follow-up Qs I can answer!