in this case payment method was not deleted but got below mentioned error. I created a new order for a subscription and when automatic recurring payments of that subscription gave an error like the below-mention
Error
“Recurring payment for order failed. Reason: The provided PaymentMethod cannot be attached. To reuse a PaymentMethod, you must attach it to a Customer first.”
then I checked the stripe dashboard gave 400 error from
POST /v1/payment_intents request.
Request POST body
{
"mandate": "mandate_1OlSPKSI7QIB2Nsg5xop31kv",
"description": "Order 42 from trial original",
"shipping": {
"address": {
"line2": "",
"line1": "jjjjsss",
"state": "GJ",
"postal_code": "395010",
"city": "surat",
"country": "IN"
},
"name": "sd jasdd"
},
"metadata": {
"gateway_id": "stripe_cc",
"user_agent": "WordPress/6.4.3; https://localhost/trial",
"partner": "PaymentPlugins",
"user_id": "5",
"order_id": "42",
"product_18": "simple sub x 1",
"ip_address": "::1"
},
"confirm": "true",
"amount": "39900",
"payment_method_types": {
"0": "card"
},
"capture_method": "automatic",
"currency": "INR",
"customer": "cus_PadgwgdljsKHLy",
"off_session": "true",
"payment_method": "pm_1OlSP3SI7QIB2NsgD88yDaO0",
"confirmation_method": "manual",
"expand": {
"0": "payment_method",
"1": "charges.data.balance_transaction"
}
}
Response body
{
“error”: {
“message”: “The provided PaymentMethod cannot be attached. To reuse a PaymentMethod, you must attach it to a Customer first.”,
“request_log_url”: “https://dashboard.stripe.com/test/logs/req_UTH9qkftrlMSum?t=1708333260”,
“type”: “invalid_request_error”
}
}