#anrighiwr_api
1 messages · Page 1 of 1 (latest)
👋 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.
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?
client side, right now is like this: const allow_redisplay = cardData.allow_redisplay;
Could you share the full code?
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
In your code, I don't see where StripeJS functions is caleld. Which integration guide are you following? Could you share the link?
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
Thanks for sharing! The code is very helpful
Indeed that allow_redisplay is not being typed in the stripe-js: https://github.com/stripe/stripe-js/blob/master/types/api/payment-methods.d.ts
I'll share the feedback to the relevant team. Meanwhile, I'd recommend using // @ts-expect-error to get the information
ok thank you
the property is not typed, but can you confirm that it exists?
hence, it is expected to be present
Yes, the allow_redisplay property is expected to exist: https://docs.stripe.com/api/confirmation_tokens/object#confirmation_token_object-payment_method_preview-allow_redisplay
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.