#aaroninbound

1 messages · Page 1 of 1 (latest)

untold trenchBOT
true marsh
stark phoenix
true marsh
#

Have you tested it out? what error did you see?

stark phoenix
true marsh
stark phoenix
#

But confirmCardSetup also gave another error

#

and confirmSetup is from the official documentation example

true marsh
#

Show me your code?

stark phoenix
#

`const AddPayment = (props: any) => {
const { clientSecret } = props;
const submitRef = useRef<HTMLButtonElement>(null);

return (
<div className={classNames(styles.pageContainer)}>
<PageHeader title="Add Payment Method" nextPath="/mypage" isFixed/>
{clientSecret && (
<Elements
stripe={stripePromise}
options={{ clientSecret: clientSecret }}
>
<PaymentCheckoutForm
submitRef={submitRef}
/>
{/* <PaymentSetupForm /> */}

      <PaymentStatus />
    </Elements>
  )}
  <Button block color="primary" onClick={() => submitRef.current!.click()}>
    Add Payment
  </Button>
</div>

);
};`

#

In PaymentCheckoutForm:

`
const stripe = useStripe();
const elements = useElements();
if (!elements) {
return;
}

const { error } = await stripe!.confirmSetup({
elements,
confirmParams: {
return_url: "http://localhost:3000/url",
},
});

if (error) {
setErrorMessage(error.message);
}`

true marsh
#

Where do you use <CardElement>?

stark phoenix
#

It works when we do the stripe payment

#

but it doesn't work if we save the card for future payment

true marsh
#

I don't see it in the code that you pasted earlier.

#

Anyway what's the error when you call stripe.confirmCardSetup?

stark phoenix
#

wait I am trying to rewrite it

#

Oh it seems to work. The payment method is submitted. But I can't use stripe.retrieveSetupIntent to get the setupIntent status now even if I provide a return_url.
If I use PaymentElement it will display the status after I setup the payment method.

#

This approach completely varies from the example provided by the official documentation.

true marsh
#

That's two different integration path. The doc that you are reading is for PaymentElement, but you are integrating a CardElement.

stark phoenix
#

Thanks. Where is the CardElement setup documentation?

true marsh
stark phoenix
true marsh
#

I'm unable to find the page anymore, using cardElement is no longer the recommended integration path