#ardis_error

1 messages ยท Page 1 of 1 (latest)

burnt jungleBOT
#

๐Ÿ‘‹ Welcome to your new thread!

โฑ๏ธ We automatically close idle threads, which makes them read-only. Make sure you stick around to chat in realtime!

๐Ÿ”— 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/1212021513314635826

๐Ÿ“ Have more to share? You can add more detail below, including code, screenshots, videos, etc.

โฒ๏ธ 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. Thank you for your patience!

fluid vesselBOT
grizzled mauve
#

๐Ÿ‘‹ happy to help

#

would you mind sharing your account ID?

hollow garnet
#

yes , here is : acct_1OmchvByUmQCNP4b

#

this my merchant id , connected account id

#

I've created the client secret using connected account id and try to load payment elements , it gives like this error

#

var elements = stripe.elements({
locale: elementsLocale,
loader: "always",
clientSecret,
appearance,
});

grizzled mauve
#

just give me a second to try to look at your account

hollow garnet
#

okey

grizzled mauve
#

how are you initializing the Stripe instance on the frontend?

hollow garnet
#

default is
stripe = Stripe(wpfsFormSettings.stripeKey)

#

but i tried also with stripeAccount

#

like

stripe = Stripe(wpfsFormSettings.stripeKey, {
stripeAccount: 'acct_1OmchvByUmQCNP4b'
});

grizzled mauve
#

you need to pass in the platform Stripe publishable key

hollow garnet
#

yes, passing

#

wpfsFormSettings.stripeKey is pk

grizzled mauve
#

I wasn't able to find a pmc_1Omci1ByUmQCNP4blPJcfMQf on your platform account

#

are you creating a Direct or a Destination Charge?

hollow garnet
#

direct charge

grizzled mauve
#

not on the Connect account

hollow garnet
#

How can I manage the pmc ?

#

I create a payment intent on cloud functions

#

and get the client_secret to pass payment element

grizzled mauve
hollow garnet
#

I see , but I mean , how can I pass to stripe , or why don't take itself

#

I have to pass seperately ?

grizzled mauve
hollow garnet
#

export const createTestPaymentIntent = async (
req: Request,
res: Response
): Promise<void> => {
try {
leaveBreadcrumb(
"Initiating createTestPaymentIntent",
"createTestPaymentIntent",
{
query: req.query,
body: req.body,
}
);
const accountId = req.query.accountId as string;
const {
amount,
currency,
confirm,
customer,
payment_method,
automatic_payment_methods,
expand,
description,
capture_method,
receipt_email,
metadata,
validLicense,
} = req.body;

var params: any = {
  amount,
  currency,
  confirm,
  customer,
  payment_method,
  automatic_payment_methods,
  expand,
};

if (description) {
  params = {
    ...params,
    description,
  };
}

if (capture_method) {
  params = {
    ...params,
    capture_method,
  };
}

if (receipt_email) {
  params = {
    ...params,
    receipt_email,
  };
}

if (metadata) {
  params = {
    ...params,
    metadata,
  };
}

if (!validLicense) {
  const customer = await stripeTest.accounts.retrieve(accountId);
  const applicationFeeAmount = getApplicationFeeAmount(
    customer,
    amount,
    "test"
  );

  params = {
    ...params,
    application_fee_amount: applicationFeeAmount,
  };
}
leaveBreadcrumb(
  "Creating test payment intent with params: ",
  "createTestPaymentIntent",
  {
    params,
  }
);
const paymentIntent = await stripeTest.paymentIntents.create(params, {
  stripeAccount: accountId,
});
res.json(paymentIntent);

} catch (error: any) {
logError(error.message, "createTestPaymentIntent", {
error_code: error.code,
});
res.status(500).send(error.message);
}
};

#

here is my function to create payment intent

grizzled mauve
#

do you have the PI ID that was generated?

hollow garnet
#

yes

grizzled mauve
#

would you mind sharing it please?

hollow garnet
#

seti_1OoQY3ByUmQCNP4bkmze1gy1

#

it is setup intent

grizzled mauve
# hollow garnet

it seems you're using the API publishable key of the Connected Account

#

and not the Platform's

#

you need to use the Platform's publishable key with the StripeAccount header for the Connected Account

hollow garnet
#

I am connecting using oauth to stripe and using connected account's pk to load payment elements

grizzled mauve
#

no that's wrong

#

you always use the Platform keys

#

and if you're doing Direct you add the Stripe-Account header

hollow garnet
#

front side ?

grizzled mauve
#

yes

#

you're doing that on the backend side now

#

they both need to match

hollow garnet
#

i need connect account's pk in any case ?

#

or in this case , I will always use the platform's pk ?

grizzled mauve
grizzled mauve
hollow garnet
#

it is usefull when using stripe sdk ?

#

because our platform also support sdk version

grizzled mauve
#

yes

#

always regardless how you integrate

hollow garnet
#

let me try it