#Kiran-wallets

1 messages · Page 1 of 1 (latest)

misty rain
#

Kiran-wallets

#

You already used that token in an earlier Payment Intent - tokens are single-use only.

Here's the request ID where you used it earlier: req_ur8r2fKquEdsS4

dreamy shell
#

I am trying to save apple pay, Gpay tokens for future usage.
The scenario where I am using this is when I try to $1 pre auth the transactions , they fail as the apple pay token is integrated with Discover or Amex and are not supported for $1 pre auth feature, then I need to pre auth the transaction with original amount instead of dollar.

#

So I need to reuse the token. For this Stripe team gave us an option of saving those tokens for fututre usage.

misty rain
#

In the request you sent over (req_6LanJA86qNSy7t), you shouldn't be using the token ID (tok_xxx) again. You should be using the Payment Method that was generated from req_ur8r2fKquEdsS4, which is pm_1JyhlGJAWJAHRwsMSe33asWc.

dreamy shell
#

I'll try that.

misty rain
#

Hello!

dreamy shell
#

I am not able to save a token of Apple pay with setup future usage.

In this transaction Req id: req_XaoihSWlBz08hZ, I tried to authorize an apple pay token while attaching it to the customer but it fails as $1 pre auth is not supported. I am trying to reuse the token/payment method when I retry in request id req_gAsMQ2ibZq8iXy but it still fails with the below error "StripeInvalidRequestError: The provided PaymentMethod cannot be attached. To reuse a PaymentMethod, you must attach it to a Customer first."

misty rain
#

What happens if you try and attach pm_1Jz3YSJAWJAHRwsM6cWzjnZM to customer cus_KTSaNpcvbEwtiK?

dreamy shell
#

First trial payload to stripe:
{
amount: 100,
currency: 'usd',
capture_method: 'manual',
payment_method_data: { type: 'card', card: { token: 'tok_1Jz3YPJAWJAHRwsMKkJObAzx' } },
setup_future_usage: 'off_session',
customer: 'cus_KTSaNpcvbEwtiK',
payment_method_options: { card: { mcc: 5542 } },
confirm: true,
statement_descriptor: '7-11 10654 Manassas VA'
}

Second trial payload to Stripe:
{
amount: 9900,
currency: 'usd',
capture_method: 'manual',
customer: 'cus_KTSaNpcvbEwtiK',
payment_method_options: {
card: {
mcc: 5542
}
},
confirm: true,
statement_descriptor: '7-11 10654 Manassas VA',
off_session: true,
payment_method: 'pm_1Jz3YSJAWJAHRwsM6cWzjnZM'
}

#

I did not attach it to the customer by a seperate call but in the same auth call as I mentioned above in the first payload

#

by adding customer to authorization payload

misty rain
#

Yeah, I'm just wondering what will happen if you do try attach in a separate call now

dreamy shell
#

okay can I attach a token instead of a payment method as I don't have a payment method in the first call.

misty rain
#

I believe there are ways to accomplish that but before going into it, did you try what I mentioned earlier - just a one-off call to attach pm_1Jz3YSJAWJAHRwsM6cWzjnZM to customer cus_KTSaNpcvbEwtiK?

dreamy shell
#

let me try that

misty rain
#

@dreamy shell any updates?

dreamy shell
#

I could try it in my POC and it worked

#

But to implement in my code its taking time

dreamy shell
#

@misty rain I could authorize the transaction
First trial for $1 pre auth - req_bp81tBN9YYPxHN - failed as unsupported
Attached payment method to the customer
Second retry with updated amount - pi_3Jz5leJAWJAHRwsM1C7ddVnV - Worked as expected

hexed frigate
#

Hello! I'm taking over for @misty rain, let me catch up...

dreamy shell
#

sure

hexed frigate
#

Okay, I think I'm caught up. What you're seeing is expected as far as I can tell; the $1 authorizations you're trying to do are only supported on Visa and MasterCard, so the failures on Discover and American Express seem expected.

dreamy shell
#

No my original intent was to reuse the token whenever we get a failure as $1 authorization was not supported. But we could not do that in a few scenarios as token was not getting attached to the customer. But looks like this above workaround fixed this issue.

hidden canyon
#

OK great, glad to hear we were able to help you get this working 🙂