Stripe API - How to connect directly to stripe EZ without a plugin! solution for x-www-form-urlencoded

If your trying to connect to stripe directly via API and avoid plugins, this is for you! I felt inclined to share this with the community here to save you a lot of time and headaches lol, as i have recently spent the last few days on figuring this out due to challenges with using stripe plugins and errors. Hopefully this makes a difference for someone out there. Cheers to you friends.

Quick side note: Before you dive in, You can remove the headers
Key: Content-Type // Value: “multipart/form-data; boundary={boundary string}”
if you get an error and use Stripe-Account // acct_xxxxxxxx instead.

Attached below are images, code, and steps.

Just literally copy and paste the xform code into the body of your API call’s (make sure the API call is using RAW form not json…and NO spaces) or it will throw an error) The value fields will auto populate once you paste this code into your body, and you can figure it out from there it’s actually pretty cake.

MAIN API HEADER SETUP:
Image of the main initial API Connector header setup - For creating the Call
Note: your stripe secret key goes into the username field! No password is needed. (this is via stripe documentation)

attached link below:

CREATING A CUSTOMER:
Child api connector under the main to make the call:

Setting up the call:

TYPE = POST
URL = https://api.stripe.com/v1/customers

Headers:
Key: Content-Type // Value: “application/x-www-form-urlencoded”
Key: Accept: // Value: asterisk/asterisk (look at the picture)
Key:Authorization // Value: “Basic (your api key)”
Key: Content-Type // Value: “multipart/form-data; boundary={boundary string}”

BODY:

name=name&email=email&phone=phone&description=description&address[city=city&address[country=country&address[line1=line1&address[line2=line2&address[postal_code=postal_code&address[state=state&

Copy and paste ^^^

Drumroll…

NEXT: CREATING A CARD TOKEN: (to submit payment securly)

And this is the API setup for Creating a Token (which is needed in order to send stripe credit card information)… Same initial API header. The card number i am using is a dummy card # from stripe. You can use 4242-4242-4242-4242 and any 3 digit cvvc, and any fake year as long as it isn’t considered expired.

BODY:
card[exp_month=exp_month&card[exp_year=exp_year&card[number=number&card[cvc=cvc&card[name=name&

Copy & Paste ^^

And Viola! the returned call =D Cheers.

Url link to stripe with documentation below:
https://stripe.com/docs/api/tokens/create_card

Hope this helps!

3 Likes

Thank you. This worked for me with some modification, to create dynamic promotional codes automatically (which allowed me to avoid using the plugin to create 1000 different coupons).

I had to delete the last two header key/values to make it work (the “Key:Authorization // Value: ‘Basic (your api key)’
Key: Content-Type // Value: ‘multipart/form-data; boundary={boundary string}’”). Also, I had no success attempting to use “Raw,” but it worked fine for me when I switched to json and selected “queryst.”

Thank you, This worked better than a lot of the paid plugins. I was able to get it to work for Onboarding Marketplace Connect. It took me longer because there were “ENUM” values that needed to be directly in the body without the _*_. I didn’t get it at first and had to google the difference between Enum values and String.
Example:
For enum values
Correct: type=value
Incorrect: type=_*_value_*_

The reverse is true for string values