#wojtek-issuing-connect
1 messages · Page 1 of 1 (latest)
I'm using this code on the server side:
Here's a full error
type: 'StripeInvalidRequestError',
raw: {
code: 'resource_missing',
doc_url: 'https://stripe.com/docs/error-codes/resource-missing',
message: "No such issuing card: 'ic_1K6CnFQ9DTJCEgzcrDT6UNgc'",
param: 'issuing_card',
request_log_url: 'https://dashboard.stripe.com/test/logs/req_pV4Iy5ttC1ru5f?t=1669139927',
type: 'invalid_request_error',
wojtek-issuing-connect
The card is on the connected account and that request is made on the platform so it's expected it wouldn't work
you need to pass the stripeAccount option on that call too
I followed this tutorial: https://stripe.com/docs/issuing/elements
Alright, let me see
is it stripeAccount or stripe_account ?
Do you have some docs where do I need to pass that option? Creating stripe instance, generating ephemeralKey or where?
I can't control the headers from stripe API, do I? I tried to set it on the client side, same error
Did you read the doc I linked you to?
It explains exactly how to set the Stripe-Account header both client-side and server-side to indicate which account you are making a request on
Yup, I can't set a server-side headers, because I don't control the call - I use your SDK, so bullet nr 1 doesn't work for me. I went with the bullet nr 2 - client side: https://stripe.com/docs/connect/authentication#adding-the-connected-account-id-to-a-client-side-application
Although via npm module you don't have Stripe function, you have loadStripe method. So I passed the connected account id, TS has the definition for this option. It still returns resource not found though
I'm using this, and it doens't work
I don't get it
why are you looking at client-side
Sorry I'm just not following what's going on. I gave you the exact URL/section link with the exact bit of code you need
there's a language choice for every language, above that section you took a picture from
the EphemeralKey is created on the server not the client
I know that. Let's take a step back
load https://stripe.com/docs/connect/authentication#stripe-account-header and look at the Node code
I'm following the tutorial in your docs: https://stripe.com/docs/issuing/elements
Step 1 create secure endpoint, I do have that. Same code but in nextjs, I can't specify headers here
Because the SDK creates the API call, I don't have any control over that
Step 2
Web API integration
CLIENT-SIDE
This is why I'm doing client side stuff
stop
stop stop
Step 1: create the secure endpoint
=> That is where the bug is
nonce: nonce,
issuing_card: card_id,
}, { apiVersion: '2022-11-15' });```
How can I set a header there?
that's the code you seem to have. Which is for an Issuing Card on your own account
What you need to do is create the EphemeralKey for a card on a connected account
Can you share the exact code you used to create that Issuing Card on the connected account?
I don't have it, another team does that
Can I call this endpoint manually? Without your SDK?
oh boy
I'm sorry, I'm trying to help you understand all of this but you are going a bit too fast and ignoring some crucial parts of your integration
It's really importnat to not just rush through the code and to understand the whole thing
When your team created the Issuing Card, they use the Create Issuing Card API: https://stripe.com/docs/api/issuing/cards/create. But they wanted the Card to be created on the connected account. So your team's developer read https://stripe.com/docs/connect/authentication#authentication-via-the-stripe-account-header to understand how you can indicate to our API "this API request I am making is not for my own platform it's for a specific connected account acct_123456". This uses the Stripe-Account header feature. But since they likely used one of our official server-side libraries, they made sure to use the relevant option that is explained in that doc linked above
Assuming you/they use Node.js they did const card = await stripe.issuing.cards.create({ cardholder: 'ich_1M05212eZvKYlo2COOthYoW2', currency: 'usd', type: 'virtual', },{ stripeAccount: 'acct_1234', });
This is how you pass the option on Node. And so you need to so a similar thing in your own code which creates an EphemeralKey for that Card
And so you need to set that option for all the calls if they happen on a connected account
and you also need to make sure that client-side Stripe.js is initialized with the right option (the section you found earlier which is subtly different)
Does that make sense now?
Sorry it can be tricky when multiple developers own different parts of a Connect integration
that subtle "stripeAccount" feature is simple once you get it but it's super confusing if you have never seen it