#zombiewa
1 messages · Page 1 of 1 (latest)
I don't see loadStripe in the docs you're following. Are you getting that from somewhere else? Additionally, can you copy/paste the code you're running?
in the save and reuse page, if you select custom payment workflow and select react for CollectPaymentDetails section you should see the method being used
const stripePromise = loadStripe(ApiKeyStore.get("stripe"));
export default function StripePaymentElement(props: Props): React.Node {
const setupIntentResult = …
if (!setupIntentResult.success) {
showToast({
intent: "danger",
message: setupIntentResult.errors[0],
});
return <div />;
}
const options = {
clientSecret: setupIntentResult.secret,
};
return (
<Elements stripe={stripePromise} options={options}>
<form>
<PaymentElement />
</form>
</Elements>
);
}
If there are alternate instructions for react integration feel free to let me know as well
I assume you're importing loadStripe somewhere in the code as well?
import {loadStripe} from '@stripe/stripe-js';
Yeah
have these imports
import {Elements, PaymentElement} from "@stripe/react-stripe-js";
import {loadStripe} from "@stripe/stripe-js";
any suggestions reg what i should be doing differently?
i'd suggest downloading this quickstart guide sample : https://stripe.com/docs/payments/quickstart?client=react updating it to use your secret and publishable keys, then compare it against what you have
that guide should definitely work. Although it's for PaymentIntents, it should help you with analyzing what's wrong with your current setup
Will set it up, but the only differeces in the guide and what i have are within the "Checkout form", which controls setting up the PaymentsELement, and the error reg the loadStripe being undefined is being raied at a level above
The part that is erroring out is the same in the example and my code
Copying over code from the example into my app still gives the same error: Error: Invalid prop stripe supplied to Elements. We recommend using the loadStripe utility from @stripe/stripe-js.