Hi there,
I’m currently facing an issue while trying to tokenize my customer’s credit card using Stripe Terminal. After successfully creating a setup_intent for my customer, I attempt to create a payment_intent to charge the customer. However, I encounter the following error:
“The provided PaymentMethod was previously used with a PaymentIntent without Customer attachment, shared with a connected account without Customer attachment, or was detached from a Customer. It may not be used again. To use a PaymentMethod multiple times, you must attach it to a Customer first.”
I’m calling the endpoints in the following order:
1- Create Customer
curl --location 'https://api.stripe.com/v1/customers' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--header 'Authorization: Bearer sk_test_test' \
--data-urlencode 'email=pourra...@gmail.com' \
--data-urlencode 'name=jacob pourrahman'
2- Create Setup Intent
curl --location 'https://api.stripe.com/v1/setup_intents' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--header 'Authorization: Bearer sk_test_test' \
--data-urlencode 'payment_method_types%5B%5D=card_present' \
--data-urlencode 'customer=cus_RicfigndVS4XQu' \
--data-urlencode 'usage=off_session'
3- Process Setup Intent On Terminal To Collect Credit Card Payment Method
curl --location 'https://api.stripe.com/v1/terminal/readers/tmr_test/process_setup_intent' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--header 'Authorization: Bearer sk_test_test \
--data-urlencode 'customer_consent_collected=true' \
--data-urlencode 'setup_intent=seti_1QpCqmKXNWYR2BxYs7uKm2jJ'
After thsetup_intent is successfully completed (succeed), I am attempting to charge my customers
4- Create Payment Intent
curl --location 'https://api.stripe.com/v1/payment_intents' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--header 'Authorization: Bearer sk_test_abDo85626hOE5cAHPFQgTJ2Z' \
--data-urlencode 'amount=50' \
--data-urlencode 'currency=CAD' \
--data-urlencode 'capture_method=automatic' \
--data-urlencode 'customer=cus_RieY9OTPB3Ot7J' \
--data-urlencode 'payment_method=pm_1QpD07KXNWYR2BxY5jJthlVA' \
--data-urlencode 'confirm=true' \
--data-urlencode 'payment_method_types%5B%5D=card'
I faced this error:
{
"error": {
"message": "The provided PaymentMethod was previously used with a PaymentIntent without Customer attachment, shared with a connected account without Customer attachment, or was detached from a Customer. It may not be used again. To use a PaymentMethod multiple times, you must attach it to a Customer first.",
"request_log_url": "https://dashboard.stripe.com/test/logs/req_65361Smcf1Rcu1?t=1738781331",
"type": "invalid_request_error"
}
}
Could you please help me understand why this error is occurring and how I can resolve it? Specifically, I’d like to know the correct way to attach the PaymentMethod to a Customer to avoid this issue.
To unsubscribe from this group and stop receiving emails from it, send an email to api-discuss...@lists.stripe.com.
Thanks, Remi!
Your explanation about the reusable pm_ABC from generated_card cleared up my confusion—appreciate the detailed guidance and the effort to improve the error messaging!
Best, Jacob