#vibha-sharma_api
1 messages ¡ Page 1 of 1 (latest)
đ Welcome to your new thread!
â˛ď¸ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.
âąď¸ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.
đ This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1288441595099746318
đ Have more to share? Add more details, code, screenshots, videos, etc. below.
Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.
- vibha-sharma_api, 2 days ago, 23 messages
- vibha-sharma_api, 4 days ago, 26 messages
Hi, let me help you with this.
What have you tried already?
Generally, you can follow this guide which supports all payment method types: https://docs.stripe.com/payments/accept-a-payment
In this doc we can achieve this using session
can you please guide me alternate way ?
I would like to do with custom form
You can select the type of integration you're looking for here:
with this method how can we link payment intent with bank account details?
It will create a payment method for this automatically ?
What do you mean by "link payment intent with bank account details"?
I have created payment intent using api and frontend developer have ha client secret key in the response of that api
after that a form will open for taking account number and other details ryt?
Yes, are you seeing a different behavior?
no I am following this link
https://docs.stripe.com/payments/accept-a-payment?platform=web&ui=elements#web-collect-payment-details
Securely accept payments online.
Please try to implement this following the guide and let me know if you run into any issues.
I have created payment indent like that
$paymentIntent = $this->stripe->paymentIntents->create([
'customer' => $customer->id,
'amount' => $request['amount'] * 100, // Amount in the smallest currency unit
'currency' => $request['currency_code'],
'payment_method_types' => ['customer_balance'],
'payment_method_options' => [
'customer_balance' => [
'funding_type' => 'bank_transfer',
'bank_transfer' => [
'type' => 'gb_bank_transfer',
],
],
],
'description' => 'Payment for Order #1234', // Optional description
]);
$paymentIntent = $this->stripe->paymentIntents->retrieve($paymentIntent->id);
$confirmedPaymentIntent = $paymentIntent->confirm();
and returning $confirmedPaymentIntent
Is it the correct way??
for bacs payment for UK
You have to enable BACS debit in your Dashboard and remove payment_method_types and payment_method_options. This way you will control the available payment method types via Dashboard.
$paymentIntent = $this->stripe->paymentIntents->create([
'customer' => $customer->id,
'amount' => $request['amount'] * 100, // Amount in the smallest currency unit
'currency' => $request['currency_code'],
'description' => 'Payment for Order #1234', // Optional description
]);
$paymentIntent = $this->stripe->paymentIntents->retrieve($paymentIntent->id);
$confirmedPaymentIntent = $paymentIntent->confirm();
now Its fine?
Does it work?
const handleSubmit = async (e) => {
e.preventDefault();
if (!stripe || !elements) {
return; // Stripe.js has not yet loaded.
}
setIsLoading(true);
try {
const { error, paymentIntent } = await stripe.confirmPayment({
elements,
confirmParams: {
return_url: `${window.location.origin}/new-order-stripe`,
},
});
console.log("PAYMENTINTENT", paymentIntent, error);
if (error) {
setMessage(error.message || "An unexpected error occurred.");
} else if (paymentIntent) {
switch (paymentIntent.status) {
case "succeeded":
setMessage("Payment successful! Thank you!");
break;
case "requires_action":
case "requires_confirmation":
setMessage("Payment requires additional confirmation.");
break;
case "processing":
setMessage("Payment is processing. Please wait.");
break;
case "requires_payment_method":
setMessage(
"Payment failed. Please try a different payment method."
);
break;
default:
setMessage("Payment status unknown. Please contact support.");
}
}
} catch (err) {
console.error("Unexpected error:", err);
setMessage("An unexpected error occurred.");
} finally {
setIsLoading(false);
}
};
ConfirmPayment api is showing that failed to load response: connection is closed, cant dispatch pending call to network.getResponseBody
Using paymentElement
That error seems totally unrelated to Bacs payment method really. What is happening when that error is thrown?
When the api confirmPayment is called, it is not showing any response
and directly it is redirecting to returnUrl without any confirmation
What's the pi_xxx ID?
Payment intent id
Yes
pi_3Q2sQ9IE5Vvk0efG14iq3z10
OK, so confirmation was attempted and succeeded: https://dashboard.stripe.com/test/logs/req_2nYNogXqRrTfcI
So not sure what the issue is?
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
Sounds like whatever error you're seeing is being triggered on your return URL page
Yes
Hard to know what the issue could be without seeing the code from that page. But I suspect it's unrelated to Stripe
http://localhost:3000/new-order-stripe?payment_intent=pi_3Q2sQ9IE5Vvk0efG14iq3z10&payment_intent_client_secret=pi_3Q2sQ9IE5Vvk0efG14iq3z10_secret_Kp7haZABezXnL3iIXygUPFn3s&redirect_status=succeeded I am getting this in return url so this working fine ]
but i want to know that
useEffect(() => {
if (!stripePromise) return;
stripePromise.then(async (stripe) => {
const url = new URL(window.location);
const clientSecret = url.searchParams.get("payment_intent_client_secret");
if (clientSecret) {
const { error, paymentIntent } = await stripe.retrievePaymentIntent(
clientSecret
);
if (paymentIntent) {
placeOrder(paymentIntent);
}
}
});
}, [stripePromise]);
Without this code, will this confirmPayment api not work?
Yes as at that point you're just retrieving the intent post-confirmation. They're completely unrelated really and not required
So now tell me then what is the issue, i have given you code
Or let me give you my whole code
Seems like there is code on your return_url that is calling confirmPayment again?