Hi!
I am trying to get Stripe Connect working. Long story short, I have setup stripe accounts, and I am trying to get a token by submitting a POST request. I keep getting the following error:
RESPONSE: {
“error”: “invalid_request”,
“error_description”: “No grant type specified”
}
I know this might be a Stripe issue, but after doing research it might be a URL encode issue on the corona side. If it is a URL encode issue, what should my code look like?
I am pulling my hair out on this and would love some advice!
Here is my code:
=====================================================
api_key = “sk_test_4tLUxxxxxx” – I am using the real one
function networkListener( event )
if ( event.isError ) then
print( “Network error!” )
else
print( "RESPONSE: "…event.response )
end
end
local key = {[“Bearer”] = api_key}
local headers = {
[“Authorization”] ="Bearer "…api_key,
[“Content-Type”] = “application/x-www-form-urlencoded”,
[“client_secret”] = “sk_test_xxxx”, – I am using the real one
[“code”] = “ac_xxxx”, – I am using the real one
[“grant_type”] = “authorization_code”
}
local params = {}
params.headers = headers
local naw = network.request(“https://connect.stripe.com/oauth/token”, “POST”, networkListener, params)
print(naw)
======================
As a side note, here are the instructions from Stripe: (https://stripe.com/docs/connect/standalone-accounts#sample-code)
Using the code parameter, you should make a POST request to our access_token_url endpoint (also see thesample-code below for non-curl examples):
curl https://connect.stripe.com/oauth/token \
-d client_secret=sk_test_4txxxxxx \
-d code=AUTHORIZATION_CODE \
-d grant_type=authorization_code
Thanks!