#mohamad-setupintent-confirm

1 messages ยท Page 1 of 1 (latest)

hallow torrentBOT
peak owl
#

secret, should be clientSecret: secret right?

#

like the "magic" variable only works if your variable has the same name as the parameter

#

mohamad-setupintent-confirm

#
        elements, 
        secret,
        confirmParams: {
          return_url: 'http://.........',
        },
      });``` should be ```      const {error} = this.stripe.confirmSetup({
        elements, 
        clientSecret: secret,
        confirmParams: {
          return_url: 'http://.........',
        },
      });```
burnt dome
#

oh! let me try it! you are life saver!

peak owl
#

not entirely sure it's that, I'm an old school developer so I don't write the fancier Javascript magic

#

but thank you for asking a super clear question, you shared the exact code + context we needed, makes it super easy to help ๐Ÿ™‚

burnt dome
#

yes! it was the error! i am receiving this error now:

{
  "error": {
    "message": "Payment details were collected through Stripe Elements using automatic payment methods and cannot be confirmed with a Setup Intent configured with payment_method_types.",
    "request_log_url": "https://dashboard.stripe.com/test/logs/req_zKPXdemvt2DOff?t=1692827082",
    "setup_intent": {
      "id": "seti_1NiOr0CJRzpigsVa4TT22KTg",
      "object": "setup_intent",
      "automatic_payment_methods": null,
      "cancellation_reason": null,
      "client_secret": "seti_1NiOr0CJRzpigsVa4TT22KTg_secret_OVPg8LB8HiwcSB843MYgWjU40YZF8GD",
      "created": 1692827082,
      "description": null,
      "last_setup_error": null,
      "livemode": false,
      "next_action": null,
      "payment_method": null,
      "payment_method_types": [
        "card"
      ],
      "status": "requires_payment_method",
      "usage": "off_session"
    },
    "type": "invalid_request_error"
  }
}
#

do you think this might be the issue:

this.stripeElement = this.stripe.elements({
      mode: 'setup',
      currency: this.firm.currency.toLowerCase(),
      setupFutureUsage: 'off_session',
      loader: 'always',
      appearance: {
        theme: 'stripe'
      }
    });
#

or it is the backend when i am creating the SetupIntent, i removed this:

.setAutomaticPaymentMethods(            SetupIntentCreateParams.AutomaticPaymentMethods.builder().setEnabled(true).build())

from this:

post("/create-intent", (request, response) -> {
      SetupIntentCreateParams params =
        SetupIntentCreateParams
          .builder()
          .setCustomer(customer.getId())
          // In the latest version of the API, specifying the `automatic_payment_methods` parameter is optional because Stripe enables its functionality by default.
          .setAutomaticPaymentMethods(
            SetupIntentCreateParams.AutomaticPaymentMethods.builder().setEnabled(true).build()
          )
          .build();

      SetupIntent setupIntent = SetupIntent.create(params);

      Map<String, String> map = new HashMap();
      map.put("client_secret", setupIntent.getClientSecret());

      return map;
    }, gson::toJson);
  }
}
#

you will save my deadline if you could help me with this error!

peak owl
#

looking

#

// In the latest version of the API, specifying the `automatic_payment_methods` parameter is optional because Stripe enables its functionality by default. .setAutomaticPaymentMethods( SetupIntentCreateParams.AutomaticPaymentMethods.builder().setEnabled(true).build() ) .build();

#

your code says this but that's not really true, you are not using the latest API version because you're using an older version of stripe-java

#

so you need to make sure you keep that

burnt dome
#

oh! i thought we are using the latest! i configured it in our dashboard!
oh i forgot to check the gradle! i will check it now and either way i will add this to the setup intent creation.

thanks a lot!

peak owl
#

sure thing ๐Ÿ™‚

burnt dome
#

it was successful!!!!!!!!
thanks.

peak owl
#

congrats ๐Ÿ™‚