#harcon_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/1268127754319040575
๐ Have more to share? Add more details, code, screenshots, videos, etc. below.
Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.
- harcon_api, 1 day ago, 16 messages
- harcon_harcon-reactnative-paymentmethod-allowredisplay, 5 days ago, 31 messages
Here is the code I added after talking to support last week, again - it is no longer getting called, but you can imagine why I thought it was causing the issue
async enableRedisplay(customer, paymentMethodId) {
const paymentMethod = await stripeLts.customers.retrievePaymentMethod(customer, paymentMethodId);
console.log('paymentMethod', paymentMethod);
if (paymentMethod && paymentMethod.allow_redisplay === 'unspecified') {
const res = await stripeLts.paymentMethods.update(paymentMethodId, { allow_redisplay: 'always' });
return res;
}
},
๐ happy to help
Thanks
would you mind sharing the request IDs?
sure, give me a minute
pi_3PiXvDGyjGYV1j4Z0AYeDmHv
This was a payment intent that used apple pay and created a new card
you're passing setup_future_usage: "off_session", when creating the PaymentIntent https://dashboard.stripe.com/test/logs/req_KHY6nu9JxQbzBz which is the reason why the confirmation request https://dashboard.stripe.com/test/logs/req_OReGlYQHhn9N4G is creating a new PM
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
actually wait I might be wrong give me a second
Apple pay should ignore setup_future_usage due to how it functions though, correct?
would you mind sharing both Payment Method Ids that way I could better understand the workflow here?
Apple pay: pm_1PiXx9GyjGYV1j4Zclkpv354
Card that was created: pm_1PiXuNGyjGYV1j4Zq9gA8z7K
There is also a card that was created which has the same ID as the payment method used during the payment intent with apple pay
take your time, understand it's a weird one
Hi. I see your app is sending 2 requests here to create the 2 payment methods:
https://dashboard.stripe.com/test/logs/req_5juPi8ldJke1UU
https://dashboard.stripe.com/test/logs/req_0cbB6EJzGuJivD
Are you sure there's nothing in your own code that does that?
I can't see anywhere we make a request to payment_methods - we should be letting stripe and the payment element/sheet handle that
Could you please share the relevant frontend code?
Initializing payment sheet:
const initializePaymentSheet = async () => {
if (addedPaymentIntent.paymentResponse.type === 'payment_intent') {
const { error } = await initPaymentSheet({
merchantDisplayName: 'Zark Parking',
customerId: addedPaymentIntent.paymentResponse.customer,
customerEphemeralKeySecret: addedPaymentIntent.paymentResponse.ephemeralKey,
paymentIntentClientSecret: addedPaymentIntent.paymentResponse.clientSecret,
// Set `allowsDelayedPaymentMethods` to true if your business can handle payment
//methods that complete payment after a delay, like SEPA Debit and Sofort.
allowsDelayedPaymentMethods: true,
defaultBillingDetails: {
name: 'Jane Doe',
},
applePay: {
merchantCountryCode: 'US',
},
});
if (error) {
console.error('ERROR:', error);
setReservationError(error.message);
}
} else if (addedPaymentIntent.paymentResponse.type === 'setup_intent') {
const { error } = await initPaymentSheet({
merchantDisplayName: 'Zark Parking',
customerId: addedPaymentIntent.paymentResponse.customer,
customerEphemeralKeySecret: addedPaymentIntent.paymentResponse.ephemeralKey,
setupIntentClientSecret: addedPaymentIntent.paymentResponse.clientSecret,
// Set `allowsDelayedPaymentMethods` to true if your business can handle payment
//methods that complete payment after a delay, like SEPA Debit and Sofort.
allowsDelayedPaymentMethods: true,
defaultBillingDetails: {
name: 'Jane Doe',
},
applePay: {
merchantCountryCode: 'US',
},
});
if (error) {
console.error('ERROR:', error);
setReservationError(error.message);
}
}
};
Here is where we check the payment was confirmed, and we send a req to our API to handle
const openPaymentSheet = async () => {
const { error } = await presentPaymentSheet();
if (error) {
Alert.alert(error.message);
} else {
const reservationId = addedPaymentIntent.pendingReservation.id;
await handleReservationConfirm(reservationId, addedPaymentIntent.paymentResponse.paymentIntent);
}
};
I wouldn't recommend sending requests after payment sheet confirmation, and using webhooks instead. Otherwise, a customer can complete the payment and then close the app.
I see that these 2 requests are 3 minutes apart so it doesn't seem like the app is sending double requests on a single confirmation. What actually happened during that time?
Okay i will look into that
I would have created another payment intent for a new reservation
and payed with apple pay
So did you actually make 2 payments?
yes for two separate reservations
each one creating a new card method from apple pay
That's normal actually. Did you expect it would reuse the same PaymentMethod?
I would expect that apple pay obsfucates my card details enough that stripe doesnt create a new one, the whole purpouse of apple pay right?
I dont want my user seeing a new method every time they use apple pay
like it's creating new methods for the same card
Not really. Choosing Apple Pay or any other payment method type is still bringing in a new PaymentMethod object externally to Stripe. You only reuse Stripe PaymentMethods when you charge them off-session. Otherwise a new one is always created.
yeah but it's creating multiple methods for the same card, that can't be correct
The same card will have multiple PaymentMethods.
But you can use fingerprint to tell if card details are the same: https://docs.stripe.com/api/payment_methods/object#payment_method_object-card-fingerprint
Yes, that's expected behavior.
so if my user makes 100 reservations with apple pay then they will see 100 of the same card in the element...
it might be expected but that's whack
Yes, that's correct.
You can proactively delete the copies by fingerprint, or re-display the PMs, then they wouldn't need to use Apple Pay.
Is there somewhere that I can contact the product team to make feature requests
I don't mean to be rude but I just don't understand why apple pay functions this way with stripe
it's a very bad user experience - when I use apple pay on any other service such as Uber eats for example, i don't see a new card created - especially not for the same card
Can you see why i'm frustrated?
That's all I need... thank you for your help
I'm working on a solution now where i'm trying to get a customers payment methods and delete the ones with the same fingerprint
but the method to list a customers payment methods doesn't return the finger print in the response....
am i using the wrong request?
what method/request are you using?
const paymentMethods = await stripe.customers.listPaymentMethods(customer);
then for example paymentMethods.data[0].card.fingerprint should have a value(assuming it's a type:"card" PaymentMethod), what do you actually see?
my bad I wasn't accessing the card object and couldn't see it in my logs
also worth reading https://support.stripe.com/questions/how-do-card-numbers-work-with-apple-pay-and-google-pay-and-what-is-dynamic-last4 I think(I found this randomly, it's adapated from a KB article my team had, I didn't realise it was public as well)