#sajid_code

1 messages ยท Page 1 of 1 (latest)

drowsy anchorBOT
#

๐Ÿ‘‹ 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.

delicate minnowBOT
woven coral
#

Hi ๐Ÿ‘‹ can you tell me more about what you're hoping to see, and how what you have doesn't align with that?

knotty oriole
#

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

woven coral
#

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.

delicate minnowBOT
knotty oriole
#

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;

woven coral
#

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;

knotty oriole
#

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,
});
});

trim cloud
#

๐Ÿ‘‹ stepping in

#

Catching up, one moment

#

Can you share a PaymentIntent ID that you tested with?

knotty oriole
#

I don't get it. do you say stripe key i used?

trim cloud
#

I need a PaymentIntent ID -- looks like pi_xxxx

knotty oriole
#

i have'nt used such id in code.

woven coral
#

Are the other payment methods you're hoping to see Bancontact, EPS, giropay, and iDEAL?

knotty oriole
#

I want to see all payment methods that i have enalbed in stripe connect settings.

trim cloud
#

@knotty oriole your backend creates a PaymentIntent via const paymentIntent = await stripe.paymentIntents.create({...

#

That paymentIntent.id is what I need

knotty oriole
trim cloud
#

And can you show me a screenshot of what you see on your checkout page?

#

Does Cash App show up there?

knotty oriole
#

I dont see option for us banks with routing numbers and account numbers.

trim cloud
#

That is because that isn't turned on in your Dashboard

#

And turn on ACH Direct Debit

knotty oriole
#

It says on by default:

#

but these show active only:

trim cloud
#

This is a destinatino charge, it uses your platform's set PaymentMethods

#

Not the Connected Account payment methods

knotty oriole
#

What should i use Desitination charge or connected account payment methods?

trim cloud
#

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

knotty oriole
#

Where i can set payment methods for destination charge.

knotty oriole
#

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?

trim cloud
knotty oriole
#

Also when i initaite payout it says no external account connected whereas I have connected the external account:
response I'm getting:

trim cloud
#

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

knotty oriole
#

Thanks I resolved my Issues. Thanks for guiding me and helping me! I 'll catch up if I'll more assistance in future.

trim cloud
#

๐Ÿ‘