#brambilla128

1 messages · Page 1 of 1 (latest)

opaque widgetBOT
wise lion
#

Hello, happy to help. What are you running in to?

pure crag
#

I'm don't know how to pass the theme corretly as a prop to the component cause I'm using jsx sintax, and I'm importing the PaymentElement from the lib, and not creating it in my code as I saw in the docs

#

Here is my git repository

#

This Stripe folder is where I'm trying to create the payment element, checkout form. The component is being used in the order page

#

Rocket-food-frontend\src\pages\order

wise lion
#

Gotcha, I'll take a look

pure crag
#

I know that u are busy, but did u have any tips how I can do it?

wise lion
#

Apologies for the delay, looking at your code now

#

I'm having trouble figuring out how to use the appearance API with the useElements hook, asking my colleagues and will get back to you shortly

#

You define the appearance settings in an options object and then provide it to the <Elements> tag

  mode: 'payment',
  amount: 1099,
  currency: 'usd',
  // Fully customizable with appearance API.
  appearance: {
    /*...*/
  },
};

const App = () => (
  <Elements stripe={stripePromise} options={options}>
    <CheckoutForm />
  </Elements>
);```
opaque widgetBOT
pure crag
#

Hey I kind solve it know

#

{clientSecret && stripePromise && (
<Elements stripe={stripePromise} options={{
clientSecret, appearance: {
theme: 'night'

      }
    }}>
      <CheckoutForm />
    </Elements>
  )}
pure crag
#

But for some reason I had to pass the appearance object dirrectly. I must pass the clientScrect together in the options

#

Passing the appearance as an const options was not working

#
    theme: 'stripe'
  }
  return (
    <>
      <h1>React Stripe and the Payment Element</h1>
      {clientSecret && stripePromise && (
        <Elements stripe={stripePromise} options={{
          clientSecret, appearance: testAppearance
        }}>
          <CheckoutForm />
        </Elements>
      )}
    </>
  );```
#

By naming the prop it worked

#

Thanks a lot 🥰

wise lion
#

Glad it is working! Good job figuring that last part out, I was still trying to figure that out on my side