Forum Academy Marketplace Showcase Pricing Features

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:
https://stripe.com/docs/api/authentication

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!

@addison1 thank u so much, do you know how I implement pay with Apple Pay?