#notlit - tokens
1 messages · Page 1 of 1 (latest)
Hi
First off all we don't recommend to use this API directly
But, can you share the ID (req_xxx) of the failing API request?
https://support.stripe.com/questions/finding-the-id-for-an-api-request
i was using it for testing purposes.
wait
Response Code : 400Response message : b'{\n "error": {\n "code": "parameter_missing",\n "doc_url": "https://stripe.com/docs/error-codes/parameter-missing",\n "message": "You must supply either a card, customer, PII data, bank account, or account legal entity to create a token. If you\'re making this request with a library, be sure to pass all of the required parameters for creating a token. If you\'re making this request manually, be sure your POST parameters begin with the token type. For example, a PII token would require `pii[personal_id_number]`, while an account token would require a parameter beginning with `account[legal_entity]`. See the API reference for more information: https://stripe.com/docs/api#token_object",\n "type": "invalid_request_error"\n }
wasn't able to find it here
@placid wedge
don't know why i used to find it for other requests but for this one I'm unable to find
👋 taking over for my colleague. Let me catch up.
@unkempt sun without the request Id I don't have a lot to go on to be able to help you out
try to replicate the request
and in all cases if you could share your code, that would also be helpful
Wait I'll share the code
if you could do both that would be great
im only able to share the code at the moment
'authority': 'api.stripe.com',
'Authorization' : "Bearer *************",
"method" : "POST",
"path" : "/v1/tokens",
"scheme" : "https",
"accept": "application/json",
"accept-encoding" : "gzip, deflate, br",
"accept-language" : "en-US,en;q=0.9",
"content-length" : "372",
"content-type": "application/x-www-form-urlencoded",
"sec-fetch-dest" : "empty",
"sec-ch-ua-platform" : "Windows",
"origin": "https://js.stripe.com",
"referer": "https://js.stripe.com/",
"sec-ch-ua" : """Chromium";v="104", " Not A;Brand";v="99", "Google Chrome";v="104""",
"sec-ch-ua-mobile" : "?0",
"sec-fetch-mode": "cors",
"sec-fetch-site" : "same-site",
"sec-gpc" : "1",
"user-agent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.0.4606.81 Safari/537.36",
}
data3 = {
'card[number]': "401658046*****",
'card[cvc]': "830",
'card[exp_month]': 12,
'card[exp_year]': 2026,
"guid" : "c41fef4d-8d1a-4227-9677-3f7519ec54cd139d59",
"muid" : "37891b00-d82d-46eb-9b68-1be0ad9b6c52120605",
"sid" : "f6348c08-1d56-4f87-b67b-965427db91cf24812d",
"payment_user_agent" : "stripe.js/6994360f1;+stripe-js-v3/6994360f1",
"time_on_page" : "1627872",
"key" : "key",
"pasted_fields" : "number"
}
src3 = requests.post("https://api.stripe.com/v1/tokens",headers=headers3, json=data3)
print("Response Code : " + str(src3.status_code) + " Response message : " + str(src3.content))```
@placid wedge here.
ok
why are you sending extra params?
and in all cases we don't accept json data
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
It only accepts form-encoded request bodies
im confused what parms is missing so i put the all i found from different places
ok
req_9qMmNO6zQk24up
the req id
but it seems to detect my api key
authrization key
yes the headers are correct
oh the params sry nvm
it's only a matter of passing a JSON body that makes your request unparsable by our server
works now, thank you for the help.
let me know if you need any more help