#notlit - tokens

1 messages · Page 1 of 1 (latest)

placid wedge
#

Hi
First off all we don't recommend to use this API directly

unkempt sun
#

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

wintry glade
#

👋 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

unkempt sun
wintry glade
#

if you could do both that would be great

unkempt sun
#
        '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.

wintry glade
#

my colleague is no longer available

#

I'm helping you at the moment

unkempt sun
#

ok

wintry glade
#

why are you sending extra params?

#

and in all cases we don't accept json data

#

It only accepts form-encoded request bodies

unkempt sun
#

im confused what parms is missing so i put the all i found from different places

#

ok

#

req_9qMmNO6zQk24up

wintry glade
#

if you post in JSON form the request wouldn't have a body

#

for us

unkempt sun
unkempt sun
#

authrization key

wintry glade
#

yes the headers are correct

unkempt sun
#

oh the params sry nvm

wintry glade
#

it's only a matter of passing a JSON body that makes your request unparsable by our server

unkempt sun
#

works now, thank you for the help.

wintry glade
#

let me know if you need any more help