#beef_paymentelement-connect

1 messages ยท Page 1 of 1 (latest)

finite mountainBOT
plucky locustBOT
#

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.

finite mountainBOT
#

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

๐Ÿ“ Have more to share? Add more details, code, screenshots, videos, etc. below.

arctic nimbus
#

I got this error, but don't know what to do: Only Stripe Connect platforms can work with other accounts. If you specified a client_id parameter, make sure it's correct. If you need to setup a Stripe Connect platform, you can do so at https://dashboard.stripe.com/account/applications/settings.

#

I was inside the application settings, but what to do? I am using for the stripe promise the connected account (not the plattform account). Maybe that's the problem, but if I would use the plattform account the created payment intent (in the connectect account) can't be found.

fallow tendon
#

beef_paymentelement-connect

#

Hey @arctic nimbus! There are many ways to integrate Stripe Connect in the first place. So the first step is to explain what flow of funds exactly you are trying to use (Destination Charges, Direct Charges or Separate Charges and Transfers)? Also what type of connected account do you use?

arctic nimbus
fallow tendon
#

You are asking explicitly how to confirm a PaymentIntent on a connected account right? So you, as the platform, are actively charging a Customer for a certain amount and giving the funds to the connected account.

arctic nimbus
fallow tendon
#

Okay, so yes you as a platform collect payments. You said you don't but you do.

So now, how did you create the PaymentIntent, can you share the code?

arctic nimbus
#

The plattform account itself just handles the creation and confirmation. The money will only go on the connected account. Maybe I still collect payments but I guess that doesnt matter

#

The payment element is created inside the Elements

fallow tendon
#

yeah what matters is your integration. You as the platform collect payments. It's important since you will have more questions in the future based on past threads so try to be clear that you are a platform with Standard accounts and you use Direct Charges

finite mountainBOT
#

๐Ÿง‘โ€๐Ÿ’ป How to format code on Discord

Inline code: wrap in single backticks (`)

This:

The variable `foo` contains the value `bar`.

Will turn into this:

The variable foo contains the value bar.

Code blocks: wrap in three backticks (```)

Also, you can specify the language after the first three backticks to get syntax highlighting.

This:

```javascript
function foo() {
return 'bar';
}
```

Will turn into this:

function foo() {
  return 'bar';
}```

Notes about **code blocks**:
- Specifying the language is optional (e.g., you can omit `javascript` in the example above)
  - If you don't specify the language you won't get syntax highlighting
- When you're inside a code block (after you type \`\`\`) the `Return`/`Enter` key will add a new line instead of sending your message
  - Once you end the code block `Return`/`Enter` works normally again

You can [read more about message formatting on Discord's website.](https://support.discord.com/hc/en-us/articles/210298617)
arctic nimbus
fallow tendon
#

Please read the instruction above to format code that isn't just a picture

arctic nimbus
fallow tendon
#

I am using direct charges of 0 โ‚ฌ, because I don't charge anything, right?
PaymentIntents do not support amount: 0 and you said you use PaymentIntents, so that is impossible
Are you mixing up the words and using SetupIntents instead?

arctic nimbus
# fallow tendon Please read the instruction above to format code that isn't just a picture

New Method

const stripePromise = loadStripe(process.env.NEXT_PUBLIC_STRIPE_API_KEY!, {stripeAccount: process.env.NEXT_PUBLIC_STRIPE_USED_ACCOUNT_ID})

export default function NewMethod({amount}: {amount: number}) {
    const options = {
        mode: 'payment',
        currency: "eur",
        amount: amount,
        paymentMethodCreation: 'manual',
        paymentMethodTypes: ["sepa_debit"],
    } satisfies stripeJs.StripeElementsOptions;

    return <Elements stripe={stripePromise} options={options}>
        <CheckoutForm amount={amount}/>
    </Elements>
}

Checkoutform

        <form onSubmit={handleSubmit} className={"w-full"}>
            <PaymentElement />
            <LoadingButton type={"submit"} isLoading={!stripe || loading} className={"mt-6 w-full"}>
                {formatEuro(amount)} zahlen
            </LoadingButton>
            {errorMessage && <div>{errorMessage}</div>}
        </form>
fallow tendon
#

Okay what's the value of process.env.NEXT_PUBLIC_STRIPE_USED_ACCOUNT_ID right now?

arctic nimbus
# fallow tendon > I am using direct charges of 0 โ‚ฌ, because I don't charge anything, right? Pay...

Let me create a clear example. Imagine two persons: B33fb0n3 and Peter.

B33fb0n3 create a stripe plattform account and is a developer.
Peter asked B33fb0n3 how he can collect payments. B33fb0n3 said, that he can do it for him. Peter created and connected his account to B33fb0n3's plattform account.

B33fb0n3 now tries to create paymentintents via B33fb0n3's api keys and also confirms them. The payments automatically on Peters Stripe account and the payouts as well.

The paymentintent creation does not contain any charges for Peter:

    const intent = await stripe.paymentIntents.create({
        amount: amount,
        currency: 'eur',
        payment_method_types: ["sepa_debit"],
    });

Peter is now happy that everything works (future).

arctic nimbus
fallow tendon
arctic nimbus
fallow tendon
#

it doesn't, not with the code you shared

arctic nimbus
fallow tendon
#

ah my bad you hardcoded it in the client okay. Almost no one ever does that

arctic nimbus
#

oh I thought that would be the way to do it? Else the stripe (clientside) don't know where the paymentintent is created when not on plattform?

fallow tendon
#

yeah sorry I'm really strugling to follow you right now ๐Ÿ˜ฆ

#

Client-side code and server-side code are completely separate/unrelated. The way you initialize Stripe.js client-side is different from how you initialize the stripe-node SDK server-side.

arctic nimbus
fallow tendon
#

Can you give me an example PaymentIntent id I could look at to check? That'll be faster than the back and forth

arctic nimbus
#

Yes, this is a paymentintent on a connected account: pi_3PG0rnGFAsQSXF4n14Rcq0V4

fallow tendon
#

okay so it was created on the connected account so that worked fine.
So I guess now: what exactly is your issue?

arctic nimbus
fallow tendon
#

You mentioned this error when you started the thread
Only Stripe Connect platforms can work with other accounts. If you specified a client_id parameter, make sure it's correct. If you need to setup a Stripe Connect platform, you can do so at https://dashboard.stripe.com/account/applications/settings.
What exactly is causing this error?

#

what exact line of code is failing?

arctic nimbus
#

There is no line mentioned, but I still got a stacktrace:

TypeError: Cannot read properties of undefined (reading 'dispatch')
    at elementUnmounted (https://js.stripe.com/v3/fingerprinted/js/controller-8bd32ff63c911675aeb213bb7dc31161.js:1:688915)
    at https://js.stripe.com/v3/fingerprinted/js/controller-8bd32ff63c911675aeb213bb7dc31161.js:1:695955
    at n (https://js.stripe.com/v3/fingerprinted/js/controller-8bd32ff63c911675aeb213bb7dc31161.js:1:65184)
    at Generator._invoke (https://js.stripe.com/v3/fingerprinted/js/controller-8bd32ff63c911675aeb213bb7dc31161.js:1:64937)
    at Generator.next (https://js.stripe.com/v3/fingerprinted/js/controller-8bd32ff63c911675aeb213bb7dc31161.js:1:65366)
    at a (https://js.stripe.com/v3/fingerprinted/js/controller-8bd32ff63c911675aeb213bb7dc31161.js:1:70671)
    at o (https://js.stripe.com/v3/fingerprinted/js/controller-8bd32ff63c911675aeb213bb7dc31161.js:1:70843)
    at https://js.stripe.com/v3/fingerprinted/js/controller-8bd32ff63c911675aeb213bb7dc31161.js:1:70921
    at new Promise (<anonymous>)
    at e.<anonymous> (https://js.stripe.com/v3/fingerprinted/js/controller-8bd32ff63c911675aeb213bb7dc31161.js:1:70808)
#

It seems like it's coming from a load event of the payment element, because there is a message saying Unhandled payment Element loaderror

fallow tendon
#

Do you have a page I can look at directly?

arctic nimbus
# arctic nimbus It seems like it's coming from a load event of the payment element, because ther...

this is the full error:

error {
    "type": "invalid_request_error",
    "code": "platform_account_required",
    "doc_url": "https://stripe.com/docs/error-codes/platform-account-required",
    "message": "Only Stripe Connect platforms can work with other accounts. If you specified a client_id parameter, make sure it's correct. If you need to setup a Stripe Connect platform, you can do so at https://dashboard.stripe.com/account/applications/settings.",
    "status": 403
}
arctic nimbus
fallow tendon
#

yeah this error usually happens when you use the API key of an account that isn't a Connect platform

#

Are you sure you have the right Publishable key from your own Stripe account that is the platform?

fallow tendon
#

sure ngrok is fine

arctic nimbus
# arctic nimbus well, I do that ๐Ÿ™‚
const stripePromise = loadStripe(process.env.NEXT_PUBLIC_STRIPE_API_KEY!, {stripeAccount: process.env.NEXT_PUBLIC_STRIPE_USED_ACCOUNT_ID})

Because the stripeAccount is the one of the connected account ๐Ÿ™‚

arctic nimbus
fallow tendon
#

yep exactly what I said, you're using the wrong API key

#

You need the Publishable API key from your platform, the one that all the connected accounts are connected to. You mixed up your API keys so you get that error

arctic nimbus
#

ohhhh you are right ๐Ÿฅณ
Now it loads ^^

#

Thanks โค๏ธ

fallow tendon
#

Sure thing!