#RomanDEV
1 messages · Page 1 of 1 (latest)
Hi there!
Can you share the ID (req_xxx) of the failing API request?
https://support.stripe.com/questions/finding-the-id-for-an-api-request
Meanwhile, you can get the full app from this quickstart:
https://stripe.com/docs/payments/quickstart?platform=web&client=react&lang=node
req_vhJrfhzclQcoPC
In fact, you are calling the PaymentIntent create request API without sending the amount property:
https://dashboard.stripe.com/test/logs/iar_vhJrfhzclQcoPC
const amountInCent = parseInt(props.amount) * 100;
Here the amountInCent is not a props, you need to delay the parse and the conversion to sent until the call of the //create-paymentIntent . try to debug your frontend and backend and track amount and see when it's zero and when it's not set and when it's set
Thanks for your response. I added headers. I logged amountInCent in frontend and req.body.amount in backend. The value is there, but clicking the pay button I get this error in my console: Uncaught (in promise) undefined
m.stripe.network/inn…n=6&preview=false:1
Are there any logs in your Dashboard indicating that your API requests are succeeding (e.g. is it creating Payment Intents)? https://dashboard.stripe.com/logs
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
This URL is likely unrelated to the actual error. Which line in the code you shared is throwing/logging the error?
I logged now publishableKey and clientSecret, both are there so the API request is successfull. This url comes automatically when I press the paybutton. Logging the error gives back: raw: {
[0] code: 'parameter_missing',
[0] doc_url: 'https://stripe.com/docs/error-codes/parameter-missing',
[0] message: 'Missing required param: amount.',
[0] param: 'amount',
[0] request_log_url: 'https://dashboard.stripe.com/test/logs/req_vhJrfhzclQcoPC?t=1674466725',
[0] type: 'invalid_request_error',
[0] headers: {
[0] server: 'nginx',
[0] date: 'Mon, 23 Jan 2023 09:38:45 GMT',
[0] 'content-type': 'application/json',
[0] 'content-length': '332',
[0] connection: 'keep-alive',
[0] 'access-control-allow-credentials': 'true',
[0] 'access-control-allow-methods': 'GET, POST, HEAD, OPTIONS, DELETE',
[0] 'access-control-allow-origin': '*',
[0] 'access-control-expose-headers': 'Request-Id, Stripe-Manage-Version, X-Stripe-External-Auth-Required, X-Stripe-Privileged-Session-Required',
[0] 'access-control-max-age': '300',
[0] 'cache-control': 'no-cache, no-store',
[0] 'idempotency-key': '46de667f-347e-4301-886e-eb073e612c24',
[0] 'original-request': 'req_vhJrfhzclQcoPC',
[0] 'request-id': 'req_vhJrfhzclQcoPC',
[0] 'stripe-version': '2020-08-27',
[0] 'strict-transport-security': 'max-age=63072000; includeSubDomains; preload'
[0] },
[0] statusCode: 400,
[0] requestId: 'req_vhJrfhzclQcoPC'
[0] },
[0] rawType: 'invalid_request_error',
[0] code: 'parameter_missing',
[0] doc_url: 'https://stripe.com/docs/error-codes/parameter-missing',
[0] param: 'amount',
[0] detail: undefined,
[0] headers: {
[0] server: 'nginx',
[0] date: 'Mon, 23 Jan 2023 09:38:45 GMT',
[0] 'content-type': 'application/json',
[0] 'content-length': '332',
[0] connection: 'keep-alive',
[0] 'access-control-allow-credentials': 'true',
[0] 'access-control-allow-methods': 'GET, POST, HEAD, OPTIONS, DELETE',
[0] 'access-control-allow-origin': '*',
[0] 'access-control-expose-headers': 'Request-Id, Stripe-Manage-Version, X-Stripe-External-Auth-Required, X-Stripe-Privileged-Session-Required',
[0] 'access-control-max-age': '300',
[0] 'cache-control': 'no-cache, no-store',
[0] 'idempotency-key': '46de667f-347e-4301-886e-eb073e612c24',
[0] 'original-request': 'req_vhJrfhzclQcoPC',
[0] 'request-id': 'req_vhJrfhzclQcoPC',
[0] 'stripe-version': '2020-08-27',
[0] 'strict-transport-security': 'max-age=63072000; includeSubDomains; preload'
[0] },
[0] requestId: 'req_vhJrfhzclQcoPC',
[0] statusCode: 400,
[0] charge: undefined,
[0] decline_code: undefined,
[0] payment_intent: undefined,
[0] payment_method: undefined,
[0] setup_intent: undefined,
[0] source: undefined
[0] }
The error is right there:
message: 'Missing required param: amount.'
yes
You can see your API request isn't passing it: https://dashboard.stripe.com/test/logs/req_vhJrfhzclQcoPC
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
My guess is req.body.amount is undefined/falsy. The Node SDK removes undefined parameters from the request automatically
Can you try logging req.body?