#jake-paymentlink-beta

1 messages ยท Page 1 of 1 (latest)

fathom sentinelBOT
elder hearth
#

@nimble hare I'm sorry for the confusion here, we do not help with betas on Discord so you should never have been sent here. Please go back to them for help directly instead

nimble hare
#

I see -- the issue started w/ the beta link being enabled, but at this point I cannot initialize the stripe SDK at all w/ my test key

#

i get the error above regardless of whether I include payment_links_restrictions_beta=v1 or not

#

Is that something that you can help with?

elder hearth
#

that account acct_1NxGZlJFgFBv6skz you're using has been deleted as far as I can tell

nimble hare
#

yes -- it has

#

but the key isn't under that account, its under acct_1M1YLzJwk1v6Ogjr

elder hearth
#

but your code must be passing that account id as the stripe_account header or something similar or the PaymentLink was associated with it. Sorry you gave no info beyond an error message

nimble hare
#

i am not -- we don't have the account id in our code base at all in fact

#

i even tried explicitly passing acct_1M1YLzJwk1v6Ogjr as the stripe account, but I still get that error

#

I deployed this same code -- using the same key -- to a staging environment, the key resulted in a different (but still incorrect) account being sent to stripe, this is the header the stripe SDK sent there stripe-account:"acct_1O0uzMGkrGddabXg"

elder hearth
#

I'm sorry, you're giving me nothing right now. There are dozens of ways to integrate Stripe. You must be doing or using something. Can you try and give me relevant details like what causes this error, what code you wrote, how I can reproduce, etc.

nimble hare
#

sure, let my paste in what i was emailing w/ your support before

#

Here's the code for our integration

#

const stripe = new Stripe(process.env.STRIPE_API_KEY!, {
apiVersion: '2023-08-16; payment_links_restrictions_beta=v1',
} as any);

const product = await stripe.products.create(
  {
    name: invoiceNumber,
  },
  {
    stripeAccount: stripeConnectedAccountId,
  }
);

if (!product || !product.id) {
  throw new Error('Stripe Payment Product creation failed');
}

const price = await stripe.prices.create(
  {
    currency: toLower(currency),
    unit_amount: balanceAmount,
    product: product.id,
  },
  {
    stripeAccount: stripeConnectedAccountId,
  }
);

if (!price || !price.id) {
  throw new Error('Price creation failed');
}

const lineItems = [
  {
    price: price.id,
    quantity: 1,
  },
];

const paymentLink = await stripe.paymentLinks.create(
  {
    line_items: lineItems,
    metadata: {
      invoiceId: invoiceId,
    },
    restrictions: {
      completed_sessions: {
        limit: 1,
      },
    },
    inactive_message: 'This invoice has already been paid.',
  } as any, 
  {
    stripeAccount: stripeConnectedAccountId,
  }
);
#

here's the error the stripe SDK is outputting

#

This was the original error before i deleted that acount, you can see the incorrect account being passed in the headers

#

after i deleted the account, it became the error i entered earlier

elder hearth
#

I'm super lost. Your code is literally passing that header in both sections

#

and you said you weren't passing it

nimble hare
#

My code? that error is from the stripe SDK

#

as well as that header, we have integrated by the SDK -- not a direct api integration

#

here's the test key i'm using STRIPE_API_KEY=sk_test_51M1YLzJwk1v6Ogjr1He...GztvReFE

#

you mean the beta header? i can remove that -- it generate sthe same error

#

if that would help youi

elder hearth
#

Please pause and read your code const product = await stripe.products.create( { name: invoiceNumber, }, { stripeAccount: stripeConnectedAccountId, } );

#

This code creates a Product via the API on a connected account with the id in stripeConnectedAccountId

nimble hare
#

that's our customer's account

elder hearth
#

all your code examples you dumped earlier are like that. And right now something in your code is passing the account id that is deleted, that's your bug.

nimble hare
#

ok... super helpful, let me see if we can figure out it on our own

elder hearth
#

Add logs before each call to log the account id to find where the acct_1NxGZlJFgFBv6skz comes from because you deleted that account

#

The first error you had before that person at Stripe gave you the beta was "you can't use this beta" and the second error is really "you're asking me to do something on acct_1NxGZlJFgFBv6skz but you don't have access to that account (because it's deleted)"

nimble hare
#

alright, i suspect the issue is related to connected accounts then

#

we've had the beta feature enabled on our account, since we're creating links on behalf of our customers the stripe code is blocking access

#

i'll email your other support team and see if they can help

elder hearth
#

@nimble hare the issue is 110% your own code

#

your code has an account id that is incorrect (deleted) and is passing it incorrectly when it shouldn't. That's what you need to fix (or your developer if you don't own the code yourself)

nimble hare
#

ya, the issue is clearly the stripe beta code, its gated on for our account, but we're using connected accounts and its blocking those accounts from getting this feature. you've been helpful despite everything

elder hearth
#

Right now the error you are getting that you shared is using the wrong account id.

#

If you are getting a different error now, I'm happy to look

nimble hare
#

that's a myopic interpretation

#

but its ok, i'm talking to the beta folks again

#

you were clear you are unable to help with that

elder hearth
#

๐Ÿ‘