#Samsara

1 messages ยท Page 1 of 1 (latest)

pastel bayBOT
night yarrow
#

Hi ๐Ÿ‘‹ I believe this was recently changed or is planning to be changed soon, please bear with me while I double check the details of that.

elder elbow
#

Thanks!

night yarrow
#

Thank you for your patience, my understanding is that now if your Platform registers a domain it will be prepared for use in both Connect and non-Connect scenarios. This change is not retroactive and does not apply to previously registered domains, so you may need re-register previous domains to see this change in behavior. Please let us know if this doesn't align with the behavior you're seeing.

elder elbow
#

Ok so to clarify, does this mean we have don't have to do the step in the link above everytime we add a new connect account? As long as we have our domain registered at the platform level we're good and apple pay should show up? But for previously created connect accounts, I'll have to register those individually with the domain? And has this change gone into place already or is it a future update?

night yarrow
#

Ok so to clarify, does this mean we have don't have to do the step in the link above everytime we add a new connect account? As long as we have our domain registered at the platform level we're good and apple pay should show up?
Yes, that is my understanding, and as far as I'm aware this change is now live.

I don't think you need to re-register the domain with each Connected Account, just re-register the domain itself one time.

elder elbow
#

Or do I just need to run the the curl command with our domain is what you're saying?

#

I'm also confused, is adding a domain to the link above and running the curl command essentially the same thing?

night yarrow
#

When were you registering the domains, this was a very recent change that was implemented less than a month ago?

elder elbow
#

We registered our domains yesterday**

night yarrow
#

Hm, can you share the account IDs?

elder elbow
#

Of the connect accounts?

#

Or our platform account?

#

acct_1LnPzcIOjNfX5RUk
here's one of our connect accounts

#

acct_1LowvdDTwu9XYxBB

violet ocean
#

Hello ๐Ÿ‘‹
Taking over as toby needs to step away soon
Which one is the platform here?

elder elbow
#

Both are connect accounts

#

I'm not sure how to find the platform ID

violet ocean
elder elbow
#

acct_1L6JVvJlV60ASTL6

#

^^ platform id

violet ocean
#

and what domain are you specifically looking into?

#

As far as I can tell, all the domains you have on your platform are setup correctly for connect usecase

#

How exactly were you initialising Stripe.js?

elder elbow
#

So we registered all of those yesterday, but apple pay didn't show up until I went back and manually ran the curl commands to register those same domains with the old connect accounts we had

#

This is the line I'm using to initialize on the frontend:

    () =>
      loadStripe(stripeConfig.publicKey, {
        stripeAccount: getStripeAccountId(stripeConfig.accountId)
      }),
    [stripeConfig.accountId, stripeConfig.publicKey]
  );```
#

some of that is abstracted ^^ but its the example from the docs

violet ocean
#

yup basically passing the standard connected account ID

elder elbow
#

Yup

violet ocean
#

can you try without passing in the connected account ID?>

#

I suspect with the new approach, you might not need it anymore

elder elbow
#

Oh I see...how does stripe know which account to post charges to?

violet ocean
#

Good question, not sure! looking into it.

elder elbow
#

Thanks!

#

My assumption is it's all tied to the client secret?

#

Since we're doing this on the backend to send back the client secret to frontend

#
    stripeAccountId: string,
    amount: number,
    partnerName: string,
    email?: string,
  ): Promise<any> {
    try {
      const stripe = this.getStripeAccount(stripeAccountId);

      this.logger.log('pay amount', amount, 'partner', partnerName);

      // Include Stripe, create payment, send client secret to the front end
      const paymentIntent = await stripe.paymentIntents.create({
        amount: amount,
        currency: 'usd',
        receipt_email: email,
      });

      const clientSecret = paymentIntent.client_secret;

      return { client_secret: clientSecret };
    } catch (exception) {
      this.logger.error(exception);
      throw new InternalServerErrorException();
    }
  }```
#

wait nvm thats wrong code

violet ocean
#

Yup you're right since this is a direct charge, you'd need the correct connected account ID on the front-end
Also, I don't see you passing the connected account ID while creating the PaymentIntent

elder elbow
#

But we are doing this ``` async preAuthorizePaymentSecret(
amount: number,
partner: Partner,
email?: string,
): Promise<any> {
const accountId = await this.getStripeAccountId(partner);

// Empty Stripe Account means not set value
if (accountId === '') throw new BadRequestException();

try {
  const stripe = this.getStripeAccount(accountId);

  this.logger.log('pay amount', amount, 'partner', partner.partnerName);
  const data: Stripe.PaymentIntentCreateParams = {
    amount: amount,
    currency: 'usd',
    capture_method: 'manual',
    payment_method_types: ['card'],
  };
  if (email != null && email != '') {
    data['receipt_email'] = email;
  }
  // Setting capture method to "manual" here allows for us to capture it once order has finalized
  const paymentIntent = await stripe.paymentIntents.create(data);

  const clientSecret = paymentIntent.client_secret;

  return { client_secret: clientSecret };
} catch (exception) {
  this.logger.error(exception);
  throw new InternalServerErrorException();
}

}```

#

Ah okay so we do need to pass in the connect account

#

So I guess moving forward, I'm still wondering if individually registering new connect accounts with our domain for apple pay is needed or not? It's not a big deal to do it programmatically but I'm wondering if there's an easy way to check if a connect account is registered with our domain

violet ocean
#

As toby mentioned earlier, I don't think that's needed anymore since we've changed the flow.

#

Your server-side code at the moment is creating destination charges since you're not passing in a connected account ID

#

Which is why initializing Stripe.js with connected account ID might not be showing the Apple Pay button

elder elbow
#

We are, in the first line const stripe = this.getStripeAccount(accountId)

#

I didn't write it so I'm not entirely familiar with the API, but thats my understanding?

violet ocean
elder elbow
#

Ah I see. I believe we are passing in the account ID, and apple pay is showing up as expected ๐Ÿ™‚

#

Thanks for your help Hanzo