#Wojtek

1 messages ยท Page 1 of 1 (latest)

polar leafBOT
crimson hawk
jaunty cove
#

I'll be stepping away and my coworker @heavy isle will be taking over

crimson hawk
#

Thanks

crimson hawk
#

Hello?

round cypress
#

Hi! I'm taking over this thread.

crimson hawk
#

Hey hey ๐Ÿ˜„

round cypress
#

Sorry for the delay, Discord is busy right now.

#

Do you get any error message in your browser console?

#

Also can you share your code?

crimson hawk
#

I don't get any errors unfortunately

#
const stripe = require('stripe')('sk_test_Zbi06DLYODWXoEsQ0QTSIfRA');

export default async function handler(
  req: NextApiRequest,
  res: NextApiResponse<Data>
) {
  const { cardId, nonce } = JSON.parse(req.body);

  const ephemeralKey = await stripe.ephemeralKeys.create({
    nonce: nonce,
    issuing_card: cardId,
  }, {
    stripeAccount: 'acct_1JjpDMQ9DTJCEgzc',
    apiVersion: '2020-03-02'
  });

  res.json({
    ephemeralKeySecret: ephemeralKey.secret,
  });
}

#

This is the server part โฌ†

#
 const stripeRef = useRef<any>(null)
  useEffect(() => {
    const init = async () => {
      const stripe = await loadStripe('pk_test_adtMGXLLkiUBWa5xTpC2NRXJ', {
        stripeAccount: 'acct_1JjpDMQ9DTJCEgzc'
      });
      stripeRef.current = stripe
    }
    init()
  }, [])

Loading stripe

#
async () => {
          const nonceResult = await stripeRef.current.createEphemeralKeyNonce({
            issuingCard: cardId,
          });
          const nonce = nonceResult.nonce;
          const ephemeralKeyResult = await fetch('/api/ephemeral-keys', {
            method: 'POST',
            body: JSON.stringify({ cardId, nonce }),
          });
          const ephemeralKeyResponse = await ephemeralKeyResult.json();
          const ephemeralKeySecret = ephemeralKeyResponse.ephemeralKeySecret;
          const pinElement = stripeRef.current.elements().create('issuingCardPinDisplay', {
            issuingCard: cardId,
            nonce,
            ephemeralKeySecret: ephemeralKeySecret,
          });
          pinElement.mount('#card-pin');
          pinElement.on('change', (event: any) => {
            console.log(event)
          })
        }

And here is the mount

#

Something different that I do compared to the tutorial is passing the stripeAccount. I have to do it because the card belongs to a connected account

#

Otherwise that issuing card is not found

#

Oh, btw, I just write this code to check if my PIN update works. If there is another possibility to get the PIN (for example via dashboard) that would be enough ๐Ÿ˜„

delicate mantle
#

sorry, would it be possible to write to https://support.stripe.com/?contact=true? none of us have worked on this so it would take a long time for us to build an integration to get to the point where you are at and be able to offer meaningful help, so it will have to be an async email support thread.

crimson hawk
#

I could share the GH repo with you if that helps

#

I just have this bit here, this is a PoC

#

It works for me in a deprecated mode - but it returns 0000 PIN at all times

#

Is it expected?

delicate mantle
#

yep please write in and share the repo, that would help

delicate mantle
# crimson hawk Is it expected?

not sure, nobody on my team has built this Issuing integration so we don't really know anything about it and can't offer much deep advice. There's a wide range of Stripe products and integrations so some of them fall through the cracks for us, sorry

crimson hawk
#

Alright, no worries

#

I'll write to the support ๐Ÿ˜„