#bachir_error

1 messages ยท Page 1 of 1 (latest)

frigid rockBOT
#

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

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

signal storm
sharp steppeBOT
runic sky
#

Do you have the ID of a time that this succeeded? As far as I know, you should need to verify the accounts each time

signal storm
runic sky
#

It does look like that PM was created and attached similarly to the request that you sent before, looking in to what the difference is

#

Can you send me your code for setting up the payment element and creating the payment method?

signal storm
#

sure

#

I truncated what I could - code is way more complex so I hope this is helpful:

client:

  import { PaymentElement as StripePaymentElement } from "@stripe/react-stripe-js";
  const stripePaymentMethodTypes = listPaymentMethods(...)
  const options: StripeElementsOptions = {
    mode: stripeRecurrenceInterval ? ("subscription" as const) : ("payment" as const),
    amount: displayedFormAmountWithTip || 100,
    currency,
    appearance: {},
    paymentMethodTypes: stripePaymentMethodTypes,
    // setupFutureUsage: "off_session" as const,
    paymentMethodOptions: {
      us_bank_account: {
        financial_connections: { permissions: ["payment_method" as const] },
      },
    },
    paymentMethodCreation: "manual" as const,
    setupFutureUsage: isPadOrAch ? ("off_session" as const) : undefined,
  };
return(
    <Elements key={locale} stripe={stripeInstance} options={options}>
    <StripePaymentElement
      id="payment-element"
      // When have a handler on our custom accordion, so this one becomes redundant
      onChange={showCustomAccordion ? undefined : handleStripePaymentMethodChange}
      options={paymentMethodOptions}
      onLoaderStart={onLoaderStart}
      onReady={onReady}
    />
</Elements>)

server:

    this.getStripeProvider(organizationCountry).paymentMethods.attach(stripePaymentMethodId, {
      customer: stripeCustomerId,
    });

    return this.getStripeProvider(country).subscriptions.create(params);
#

wait, I didn't send the create payment method part on the frontend

#

client (code is triggered on form submit):

    const elements = useElements();

    const res = await elements?.submit();
    if (res.error) {
      return;
    }

    const billing_details = getBillingDetails(submitCommandInput.paymentInput, organization);

    let paymentMethod: StripePaymentMethod | null = null;
      // Create the PaymentMethod using the details collected by the Payment Element
      const { error, paymentMethod: paymentMethod } = await stripe.createPaymentMethod({
        elements,
        params: {
          billing_details,
        },
       })

      if (error) {
        return;
      }
    
     // This calls the server and attaches the PM + creates the subscription when recurrent payment
    const submitResponse = await handleSubmitCommand({
      ...submitCommandInput,
      stripePaymentMethodId: paymentMethod.id,
    });
frigid rockBOT
quick beacon
#

Hello! I'm taking over and catching up...

signal storm
#

Hi!

How can we enforce instant verification ?

#

if possible

quick beacon
#

That's not really recommended; it's going to prevent some people from paying (the ones who can't instantly verify their account).

signal storm
#

They already can't pay because of the error I sent ๐Ÿ˜… Or do you recommend another way for these users ?

quick beacon
#

Your integration should account for manual verification that takes several days to happen.