#sajid_code
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/1234507703645372446
๐ Have more to share? Add more details, code, screenshots, videos, etc. below.
Hi ๐ can you tell me more about what you're hoping to see, and how what you have doesn't align with that?
I want to show all the payment methods i have enabled on my stripe to accept paymnet in stripe checkout. But it only shw card option
How are you creating the Payment Intent whose client secret you're using to initialize Elements?
The payment method types on that intent determine what the Payment Element will show with the flow you're showing.
my CheckoutForm.jsx file:
import {PaymentElement} from '@stripe/react-stripe-js';
import {loadStripe} from '@stripe/stripe-js';
const CheckoutForm = () => {
const stripe = loadStripe("{key}", {
betas: ['custom_checkout_beta_2'],
});
const clientSecret = stripe.client_secret;
const paymentElementOptions = {
layout: {
type: 'accordion',
defaultCollapsed: false,
radios: true,
spacedAccordionItems: false
}
};
return (
<form>
<PaymentElement stripe={stripe} id="payment-element" options={{clientSecret}} />
</form>
)
};
export default CheckoutForm;
It's your backend code I'm interested in. How are you creating the intent that you get the client secret from to pass to this line?
const clientSecret = stripe.client_secret;
frontend:
import {PaymentElement} from '@stripe/react-stripe-js';
import {loadStripe} from '@stripe/stripe-js';
import { useState,useEffect } from 'react';
const CheckoutForm = () => {
const stripe = loadStripe("{key}", {
betas: ['custom_checkout_beta_2'],
});
const [clientSecret, setClientSecret] = useState("");
useEffect(() => {
// Create PaymentIntent as soon as the page loads
fetch("http://localhost:4242/create-payment-intent", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ items: [{ id: "xl-tshirt" }] }),
})
.then((res) => {
if (!res.ok) {
throw new Error("Network response was not ok");
}
return res.json();
})
.then((data) => setClientSecret(data.clientSecret))
.catch((error) => console.error("Error:", error));
}, []);
const paymentElementOptions = {
layout: {
type: 'accordion',
defaultCollapsed: false,
radios: true,
spacedAccordionItems: false
}
};
return (
<form>
<PaymentElement stripe={stripe} id="payment-element" options={{clientSecret}} />
</form>
)
};
export default CheckoutForm;
Backend:
pp.post("/create-payment-intent", async (req, res) => {
const { items } = req.body;
// Create a PaymentIntent with the order amount and currency
const paymentIntent = await stripe.paymentIntents.create({
amount: calculateOrderAmount(items),
currency: "usd",
description: 'Software development services',
shipping: {
name: 'Jenny Rosen',
address: {
line1: '510 Townsend St',
postal_code: '98140',
city: 'San Francisco',
state: 'CA',
country: 'US',
},
},
transfer_data: {
destination: 'acct_1PA9YDR2bWiQvRfw',
},
application_fee_amount: 1400,
// In the latest version of the API, specifying the `automatic_payment_methods` parameter is optional because Stripe enables its functionality by default.
automatic_payment_methods: {
enabled: true,
},
});
res.send({
paymentIntent: paymentIntent,
clientSecret: paymentIntent.client_secret,
});
});
๐ stepping in
Catching up, one moment
Can you share a PaymentIntent ID that you tested with?
I don't get it. do you say stripe key i used?
I need a PaymentIntent ID -- looks like pi_xxxx
i have'nt used such id in code.
Are the other payment methods you're hoping to see Bancontact, EPS, giropay, and iDEAL?
I want to see all payment methods that i have enalbed in stripe connect settings.
@knotty oriole your backend creates a PaymentIntent via const paymentIntent = await stripe.paymentIntents.create({...
That paymentIntent.id is what I need
it is payment intent id: pi_3PAvBoJ1IZg6T88p1OOvht82
And can you show me a screenshot of what you see on your checkout page?
Does Cash App show up there?
That is because that isn't turned on in your Dashboard
You need to go to https://dashboard.stripe.com/settings/payment_methods
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
And turn on ACH Direct Debit
This is a destinatino charge, it uses your platform's set PaymentMethods
Not the Connected Account payment methods
What should i use Desitination charge or connected account payment methods?
You should be using Destination Charges, yes, since you are working with Custom Accounts
In the above screenshots you are also in live mode
Flip to test mode
where can i set these payment methods?
Where i can set payment methods for destination charge.
Thanks I got it it's working now.
I have one more question. I made transactions in seller connected account yesterday. it is showing it future payout. it is due to some issue or it is normal?
It is normal, see https://docs.stripe.com/payouts which talks about payout timing
Also when i initaite payout it says no external account connected whereas I have connected the external account:
response I'm getting:
Please redact your secret key above
Even though it is testmode this still gives access to your account and this is a public server
When you create that Payout you aren't passing the Stripe Account header like you do for the balance retrieval
You need to pass { stripeAccount: 'acct_1PA9YDR2bWiQvRfw', } for that request as well if you are attempting to create a Payout on the Connected Account
Thanks I resolved my Issues. Thanks for guiding me and helping me! I 'll catch up if I'll more assistance in future.
๐