#shahzaib_terminal-reusable

1 messages ¡ Page 1 of 1 (latest)

stoic mantleBOT
#

👋 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/1296503769344901202

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

peak crane
#

shahzaib_terminal-reusable

ashen basin
#

Basically In my application, I am handling subscription manually meaning I just store customerId and paymentMehtodId and when time comes for payment, I use them to do a payment. I am successfully doing that with other payment methods but "card_present" is giving me this error "The provided PaymentMethod type (card_present) cannot be reused. You may only use this PaymentMethod type by providing it via payment_method_data on a new PaymentIntent."

peak crane
ashen basin
#

I am doing that still, we use payment method id get above mention error

#

And you check my request "req_vYEsGfWnE1VZ4J"

peak crane
#

You aren't doing that if you are passing the card_present PaymentMethod id though

#

The doc I shared explains this clearly when it says

To save a card from a Terminal PaymentIntent, attach the generated_card PaymentMethod to a Customer.

#

you are misunderstanding how this works. You have a PaymentIntent pi_123 that is paid with Terminal and gives you the PaymentMethod pm_ABC with type: 'card_present'
What it does is create a separate PaymentMethod pm_XYZ that has type: 'card' and that's the id you need to use for future payments
Does that make sense?

ashen basin
#

Yes, meaning I will use "pm_XYZ" with payment method type "card"

peak crane
#

yes, and right now you are using pm_ABC

ashen basin
#

how can I get pm_XYZ from intent
here is intentId "pi_3QAIBSCLCRxVyViw01DMLsfA"

#

const paymentMethodDetails = paymentIntentObject.data.object.charges.data[0].payment_method_details;

const savedPaymentMethod = paymentMethodDetails.card_present.generated_card;
peak crane
#

ah you figured it out

ashen basin
#

Yeah thanks I understand now, I should used "pm_1QAIBYCLCRxVyViwe0w6OVHw" instead of "pm_1QAIBXCLCRxVyViwuCwqVelY"

#

Just one last question in "payment_method_types" of intent should I use "card" or "card_present"

peak crane
#

yes!

#

card_present for in-person payments and card for others

ashen basin
#

Meaning for first transaction "card_present" but when next payment of subscription comes then "card"