#anrighiwr_api

1 messages · Page 1 of 1 (latest)

maiden cliffBOT
#

👋 Welcome to your new thread!

⏲️ 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.

⏱️ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.

🔗 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/1280426620804661288

📝 Have more to share? Add more details, code, screenshots, videos, etc. below.

safe forum
#

Where did you retrieve allow_redisplay from? StripeJS at client side or stripe-node at server side?

#

Could you share the code about your retrieval?

signal shard
#

client side, right now is like this: const allow_redisplay = cardData.allow_redisplay;

safe forum
#

Could you share the full code?

signal shard
#
  const buildPaymentMethodData = (id: string, cardData: { card?: PaymentMethod.Card }) => {
    let method = 'card';
    let cardIssuer = 'unknown';
    let wallet = null;
    let allow_redisplay = 'unspecified';

    if (cardData.card) {
      cardIssuer = cardData.card.brand;
      // @ts-expect-error - allow_redisplay is a property added in the beta, is not yet part of the standard PaymentMethod type
      allow_redisplay = cardData.allow_redisplay;

      if (cardData.card.wallet) {
        method = 'wallet';
        wallet = cardData.card.wallet;
      }
    }

    return { id, method, cardIssuer, wallet, allow_redisplay };
  };
#

i was working with elements_saved_payment_methods_beta_1 beta, now i'm trying to migrate to the stable version

safe forum
#

In your code, I don't see where StripeJS functions is caleld. Which integration guide are you following? Could you share the link?

signal shard
#

i pass to that function a ConfirmationToken object, from the same library

#
  const trackStripePayment = async () => {
    const paymentMethodData = buildPaymentMethodData(confirmationToken.id, confirmationToken.payment_method_preview);

    track('wishraiser.payment', {
      $insert_id: getInsertId(paymentMethodData.id),
      gateway: 'stripe',
      amount,
      donationType,
      payment_method: {
        type: paymentMethodData.method,
        card_issuer: paymentMethodData.cardIssuer,
        wallet: paymentMethodData.wallet,
        isSaved: paymentMethodData.allow_redisplay === 'always',
        wasAlreadySaved: isSavedPaymentMethod,
      },
    });
  };
#

i have multiple files, i can't share the full code

#

what i am trying to do, is to register in my analytics system (Mixpanel) if the user saved the payment method just used in the checkout

safe forum
#

Thanks for sharing! The code is very helpful

#

I'll share the feedback to the relevant team. Meanwhile, I'd recommend using // @ts-expect-error to get the information

signal shard
#

ok thank you

#

the property is not typed, but can you confirm that it exists?

#

hence, it is expected to be present

safe forum
signal shard
#

ok thank you

#

have a nice day