#valdozzz

1 messages · Page 1 of 1 (latest)

mint smeltBOT
velvet needle
#

Hello

brisk wind
#

Hi there!

velvet needle
#

If the Connected Account is a Standard Connected Account then you could connect the platform to it just like it is connected to the platform. So then you could clone platform --> Connected Account. But this isn't possible with Express/Custom accounts.

brisk wind
#

i dont get it, sorry!
let me show you our use case:

  1. we use connect to onboard ecommerces
  2. we create a payment to make a purchase from customers of a the connected account
  3. we would like to clone the customer and his payment method to the platform account so when a customer tries to make a purchase with another ecommerce thats in out network we can simplify the payment
velvet needle
#

What type of Connected Accounts are you working with?

brisk wind
#

standard

velvet needle
#

Okay yeah what you want isn't really possible. What you should be doing instead is creating the PaymentMethod on your Platform and cloning it to the Connected Account each time you take a payment. Then you can share across accounts.

#

So really you need to change your flow.

brisk wind
#

ok i thought about this!

i'm trying to use stripe elements using nextjs, i wanna use only the CardElement so i can tokenize the card and save it to the platform. but im having a lot of issues due to CSP, i've tried following ofc the docs, but it really doesnt work

#

can i build a form without using stripe elements to let users type their cc info and then send the data directly to stripe tokenize endpoint?

velvet needle
#

No you need to use Elements otherwise you will be responsible for a high PCI burden as you will be handling sensitive data.

#

What issues are you running into exactly?

brisk wind
#

as i thought pt.2

#

let me show you

#

Content-Security-Policy: The page's settings blocked the loading of a resource at inline ("style-src"). i get this error, and doesnt show the CardElement, but if i try with the Address element, it reders properly

velvet needle
#

Can you show me your code for how you are creating and mounting your Card Element?

brisk wind
#
import {loadStripe} from '@stripe/stripe-js';

// Make sure to call `loadStripe` outside of a component’s render to avoid
// recreating the `Stripe` object on every render.
const stripePromise = loadStripe("pk_test_....");


function CheckoutPage({ checkout }: Response) {
  return (
    <>
      <h1>TEST</h1>
      <Elements stripe={stripePromise} options={{}}>
        <CardElement />
        {/* <Address  Element options={{mode: 'shipping'}} /> */}
      </Elements>
    </>
  );
}

here you go

velvet needle
#

Okay and have you checked your CSP config?

brisk wind
#

nextjs doesn come with default CSP configuration.

but i've also tried to add middleware.ts endpoint to add the CSP header but nothing!

#

what im noticing is that the code is being pushed into the html node tree

steel mango
#

Can you see in your network requests what specifically is getting blocked and what the style-src directive in your CSP header was for that request?

#

And sorry, I'm not immediately following on what that HTML shows us. What should I be noticing?

brisk wind
#

sorry Pompey, i got some CSP errors in my console, and thought that where issues with the loading of stripe scripts! then i noticed that the stripe code was correctly injected, the only thing i didn't do was set the width and height of the CardElement component! by default it was a 0x0 box :/

steel mango
#

Wow, that is a surprising cause of this error. Good catch

brisk wind
steel mango
brisk wind
#

oh damn so that element doesn inherit any of the "themes"

steel mango
#

Correct, unfortunately not

brisk wind
#

any trick to get hte styles of the themes without copy pasting by hand?

steel mango
#

Good question checking in to that

brisk wind
#

thank you mate

#

really appreciate!

steel mango
#

Unfortunately it is looking like it isn't possible at the moment. I can put in a feature request, but for now coordinating these will be manual if you are only specifying a theme.
Not sure if you have already considered it but you can use the payment element and specify that only cards can show in it. That way it will just render as simple card inputs with no tabs. The Payment Element does support the Appearance API.

brisk wind
#

the issue here is that i need to setup a payment intent in ordfer to use the payment elements right?

#

because the thing i need to do is:

let the custoemr tokenize his cc, then i save the custoemr and his payment method in my platform account, then i clone the customer and pm to the connected account, then i make a direct charge from the customer to the connected account

#

i explain my use case at the top of the conversation

mint smeltBOT
rose cobalt
steel mango