#Jose-setupintent

1 messages ยท Page 1 of 1 (latest)

primal gale
#

Hi! Can you share the request ID (req_xxx) that failed? Or the SetupIntent ID (seti_xxx)

cinder sedge
#

sure! this is the setupIntent: seti_1Klua8RJ0tBbJjUBsGBjOBh3

#

I'm not sure if is not being attached to the account

primal gale
#

I see the SetupIntent was created, but not confirmed. Can you show me the part of your code is generating the error you shared "This is not a valid LinkAccountSession client_secret"?

cinder sedge
#

it happens after step 4

#

the browser doesn't get to open the modal

#

only thing that the dev tools console log is the error calling that endpoint

#

and this error:

    at (index):1:210461
    at (index):1:211075```
#

and setupIntent was not confirmed because it didn't even open the modal to enter the user bank account

primal gale
cinder sedge
#

yeah, that's why I'm puzzled

#

there's nothing in the code that breaks about onboarding or account links

#

this are all the calls that are made in the page

#

the ones to /aws/api are ours

#

the rest are triggered by stripe.js

#

there's a link_account_session call triggered by stripe.js

#

and then the one that breaks

ionic cedar
#

Exactly what I was about to say, it looks like there is an earlier call that makes the account link session and then another call that gets the error.

#

So the collectBankAccountForSetup call itself throws the error aout type not being defined?

cinder sedge
#

yes

#

this is the Stripe wrapper, it's in an Ember.js Service but it should be quite transparent:

#
export default class StripeService extends Service {
  @service aplosRequest;
  stripe;

  initialize(connectedAccountId) {
    console.warn("Initializing Stripe account for connected account ===> ", connectedAccountId);
    return (this.stripe = Stripe(STRIPE_PUBLIC_KEY, {
      stripeAccount: connectedAccountId,
      apiVersion: API_VERSION
    }));
  }

  async getUserBankAccount(stripeConfig) {
    console.log("Starting with config", stripeConfig);
    try {
      if (!this.stripe) {
        await this.initialize(stripeConfig?.stripe_connect_account_id);
      }

      let setupIntent = await this.collectBankAccount(stripeConfig?.stripe_client_secret);

      if (setupIntent) {
        setupIntent = await this.confirmBankAccount(stripeConfig?.stripe_client_secret);
      }

      return setupIntent?.payment_method;
    } catch (error) {
      console.log("Error while trying to get the user account");
    }
  }

1/2
#
async collectBankAccount(clientSecret) {
    try {
      console.warn("Creating setupIntent with client secret ===> ", clientSecret);
      const response = await this.stripe.collectBankAccountForSetup({
        clientSecret: clientSecret,
        params: {
          payment_method_type: "us_bank_account",
          payment_method_data: {
            billing_details: {
              name: "Juan Smith"
            }
          }
        },
        expand: ["payment_method"]
      });

      console.log("bank account collected", response);

      if (response.error || response.setupIntent?.status !== "requires_confirmation") {
        console.log("bank account not collected", response);
        return false;
      } else {
        return response.setupIntent;
      }
    } catch (error) {
      console.error(error);
    }
  }

  async confirmBankAccount(clientSecret) {
    try {
      const response = await this.stripe.confirmUsBankAccountSetup(clientSecret);

      if (response.error || response.setupIntent.status !== "succeeded") {
        return false;
      } else {
        return response.setupIntent;
      }
    } catch (error) {
      console.error(error);
    }
  }
}

2/2
#

had to split the code in two because Discord didn't like that much code

#

it never gets to the console.log("bank account collected", response); line

ionic cedar
#

Thanks for the further info. Seeing what I can find on this error.

cinder sedge
#

thanks!

ionic cedar
#

Can you send me the account ID that you redacted from that URL?

#

If it is of the form acct_123 then it is safe to share on this public channel

#

I can look up info about it but anyone other than you or a Stripe employee will just see error messages

cinder sedge
#

is not in that form, but is a test account, anyway

#

acct_1KdHluRJ0tBbJjUB

ionic cedar
#

Bad wording on my part, I meant acct_ and then numbers and letters

#

Thank you!

cinder sedge
#

ah, understood ๐Ÿ™‚

ionic cedar
#

I am still looking but am having trouble finding more on this. I will reach out to some colleagues and possibly escalate this. To narrow down my searches a bit more, do you have the ID of a Setup Intent that this happened with? (set_123)?

cinder sedge
#

sure, just let me kick again the process

#

I can set the whole setupIntent

#

but, wait I wrote that before, didn't I?

#
{
  id: 'seti_1Klua8RJ0tBbJjUBsGBjOBh3',
  object: 'setup_intent',
  application: 'ca_L37tXMojz6Kkk2oMYdrOb5vOEDoxe2sY',
  attach_to_self: true,
  cancellation_reason: null,
  client_secret: 'seti_1Klua8RJ0tBbJjUBsGBjOBh3_secret_LSqGYCn9vzDcnSXFkPbaXCq2ZYYsRb7',
  created: 1649335020,
  customer: null,
  description: null,
  flow_directions: [ 'inbound', 'outbound' ],
  last_setup_error: null,
  latest_attempt: null,
  livemode: false,
  mandate: null,
  metadata: {},
  next_action: null,
  on_behalf_of: null,
  payment_method: null,
  payment_method_options: { us_bank_account: { verification_method: 'instant' } },
  payment_method_types: [ 'us_bank_account' ],
  single_use_mandate: null,
  status: 'requires_payment_method',
  usage: 'off_session'
}
#

anyway, there's the whole object

#

I have a question though, how can I know that the intent is attached to a stripe connect account?

ionic cedar
#

Oh thank you, I missed that the first time

cinder sedge
#

@ionic cedar and the question about knowing if the intent is attached to an account?

ionic cedar
#

Oh sorry missed that. Good question. You will get an error if you use it with the wrong account but I am unsure if you can check that for a specific setup intent other than just trying to retrieve it with that account's key

#

Are you double checkng that the account IDs line up between your client and server here?

cinder sedge
#

yes, I double and triple checked it ๐Ÿ˜‚

ionic cedar
#

Oh I just mean was that the context for that question?

cinder sedge
#

no, I mean for your last question, I spent a lot of time making sure that all the ids aligned

#

about the setupIntent I just checked that doing a GET for the intent withouth the account id in the header will return an error

#

so, it's definitely linked

#

oh, also, not sure if it makes any sense, but yesterday I was working on it and it was working well

#

has it there been any change?

ionic cedar
#

Not that I know of. Do you also have the ID of a setup intent that this succeeded with?

#

And I'm sure you would have mentioend it but has any of your code for this changed since yesterday?

cinder sedge
#

not to both...

ionic cedar
#

So I am still not finding enough on this and I think it will be best if we escalate to the engineering team that works with this.

cinder sedge
#

ok, hopefully they are able to help

ionic cedar
#

Definitely. Can you write in to our support with that code, error message, and screenshot? I can grab it and assosciate it with the ticket I am making now

cinder sedge
#

sure, is there an specific email?

ionic cedar
#

I think you can also go through this link https://support.stripe.com/?contact=true

#

DM me your email address when you send it and I can grab it right away

#

Also if you have timeframes on when this was working/stopped working, that may be helpful

cinder sedge
#

๐Ÿ‘

#

done

ionic cedar
#

I see your email and have grabbed the ticket. Thank you for your time today, sorry it took be a bit to realize that we should escalate. I will keep you updated in the ticket

cinder sedge
#

thanks for all the help!

#

have lovely day wherever you are located ๐Ÿ™‚

ionic cedar
#

Thanks, same to you!

cinder sedge
#

@ionic cedar could you let me know the ticket number? it doesn't show in the email and it seems like we have assigned dev support in Stripe so I can share with them

ionic cedar
#

Dev support was me grabbing it. You should be good for that, I think we have the info that we need now. I will let you know if our eng team needs more info

cinder sedge
#

no no, I mean we have specific Stripe eng people assigned to our company, and they asked to send the ticket to them

#

can I have the ticket number?

#

they are on our slack channel asking for it