#RomanDEV

1 messages · Page 1 of 1 (latest)

leaden dustBOT
heady swan
loud pawn
#

req_vhJrfhzclQcoPC

heady swan
#

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

loud pawn
#

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

green salmon
green salmon
loud pawn
#

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',

Learn more about error codes and how to resolve them.

#

[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] }

green salmon
#

The error is right there:
message: 'Missing required param: amount.'

loud pawn
#

yes

green salmon
#

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?

loud pawn
#

req.body.amount is the value of amountInCent. log req.body: [0] { amount: 500 }
log req.body.amount: [0] 500

#

Okay, it should not be in res.send. The last payment was successfull. I hope now I've got it. 🙂 Thanks