stripe-node: Error payment_methods
Hello,
I am migrating from the charges API to the payment intent API for 3D Secure. I am using Stripe API 6.36.0 and node 8.4
Initial request from the Stripe Dashboard: POST Request /v1/payment_methods
{
"type": "card",
"card": {
"number": "424242******4242",
"cvc": "***",
"exp_month": "12",
"exp_year": "19"
},
"billing_details": {
"address": {
"postal_code": "75002"
}
},
"guid": "ed4e8e7e-bd47-4926-808d-1bf0813f4907",
"muid": "858fa8f7-c76d-441b-b62c-c848d12a825f",
"sid": "d9ddbd87-0747-49fb-ae61-30a5606983aa",
"pasted_fields": "number",
"payment_user_agent": "stripe.js/74d012ca; stripe-js-v3/74d012ca",
"key": "pk_test_********************n2re"
}
Response body:
{
"id": "pm_1EgTq0EqCinWwzYxBu1Za5g2",
"object": "payment_method",
"billing_details": {
"address": {
"city": null,
"country": null,
"line1": null,
"line2": null,
"postal_code": "75002",
"state": null
},
"email": null,
"name": null,
"phone": null
},
"card": {
"brand": "visa",
"checks": {
"address_line1_check": null,
"address_postal_code_check": "unchecked",
"cvc_check": "unchecked"
},
"country": "US",
"exp_month": 12,
"exp_year": 2019,
"funding": "credit",
"generated_from": null,
"last4": "4242",
"three_d_secure_usage": {
"supported": true
},
"wallet": null
},
"created": 1559382560,
"customer": null,
"livemode": false,
"metadata": {
},
"type": "card"
}
Followed by POST request /v1/payment_intents
{
"amount": "1900",
"currency": "eur",
"payment_method": "pm_1EgTq0EqCinWwzYxBu1Za5g2",
}
And 400 Response:
{
"error": {
"code": "resource_missing",
"doc_url": "https://stripe.com/docs/error-codes/resource-missing",
"message": "No such payment_method: pm_1EgTq0EqCinWwzYxBu1Za5g2",
"param": "payment_method",
"type": "invalid_request_error"
}
}
Can’t understand why the payment method is being denied since it’s confirmed just above. I am following your guide here: https://stripe.com/docs/payments/payment-intents/quickstart#manual-confirmation-flow
Thanks so much for your help
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 19 (5 by maintainers)
@tdamant this type of error is usually caused by accidentally using API keys from a different account, or if you’re using Connect, not authenticating as the relevant account. I’d suggest double- and triple-checking that you are using the same API keys from https://dashboard.stripe.com/test/apikeys across your frontend and backend. Sometimes if you copy an example from Stripe’s docs, they have dummy keys that don’t belong to your account and that can cause issues so it’s best to check everywhere you’re using an API key that it’s from the right account.
If you’re facing trouble, you can contact Stripe’s support team at https://support.stripe.com/email with a request ID from the failed request and as many other details at possible, and they’d be glad to help!
I don’t understand why exactly, but reading this: https://stripe.com/docs/payments/payment-intents/use-cases#connected-accounts
and trying with the second option (
on_behalf_ofandtransfer_data) instead of passing{ stripe_account: '{{CONNECTED_ACCOUNT_ID}}' },just works!
I believe the issue lies here
It says -
This does not mention anything that needs to be done on the clientside. However doing this results in the error
no such payment method: pm_xxxThe only workaround for this is to add the
CONNECTED_STRIPE_ACCOUNT_IDon the clientside. However this is not logical, as the clientside should not need to be aware of theCONNECTED_STRIPE_ACCOUNT_IDat allFor others who might face this issue as I did too on mkt place (stripe connect).
When you were using Destination with charges you need to use Transfer. With Transfer you also need to set onbehalfof field. If not, you get the error message about payment method. Not that for further Tranfers you get back the charge id from transferIntent.charges.data field
@karla-stripe - yeah that was it, double checked all the api keys and it’s working now. Thanks!