How API Works?
API (Application Programming Interface) is an abstract term (a.k.a. tech jargon) that IT professionals use to specify how systems talk. But how does it actually look like, and how does it work?
In this article, we aim to break down what API is, and how it works – for the lay person. We’ll use a Stripe Test API to showcase this behaviour.
Table of contents
Pre-requisite
To be able to follow this article, you’ll need a few things setup:
- A Stripe Test Account. See the Stripe Docs for details on how to create one.
- Postman Installed. You can download and install it here!
Stripe API
Now, the Stripe API that we are going to access is the “Checkout Session” API. This basically creates a checkout session. The flow is as follows:
- We (or an application) will make a request to Stripe
- Stripe returns the relevant detail, and also the “Checkout Session”
- The Checkout Session can then be used by the end user to make payment.
Configuring Postman
No Stripe account setup? Don’t worry – I’ll share my creds here lol. It’s terrible practice, but it’s a test account, so I don’t really care.
I have prepared a postman collection, for you to test it out. Click in the link below to download the postman collection prepared.
Download the postman collection here!
Load the Postman Collection
- Open postman and hit
Import
- Select the postman collection that you downloaded
- The collection will be imported, and click into the
New Request
to see the configuration that has been imported
API Anatomy (viewed from Postman)
So, every API has these “features”:
- A URL, it’s basically the location of the target resource is located. ![image of url in postman]](../../parent-page-tech-adventures/child-page-5-third-party-integrations/grandchild-page-3-how-api-works/Screenshot 2025-07-27 at 9.54.22 PM.png)
- The URL is unique, and will need to be provided by the “target application” the app the is exposing the resource
- In our case, we want to create a stripe checkout session
- So Stripe needs to tell us, where to call to create this checkout session
- And you can find the location in Stripe Documentation here
-
Next, we need to send the request body. These are a bunch of key value pairs that Stripe expects - In this example, Stripe expects a key
mode
with a valuepayment
- Each record is it’s own key value pair that Stripe expects -
To have a better picture of what key value pair looks like, we will now initiate the request by hitting
Send
-
When you send a request, you will get a response. In Postman, the response is displayed here – now you know what an API response looks like. Just a bunch of key value pairs:
- Scroll down, and you will see a checkout session URL
- Copy and paste this URL into your browser’s address bar and hit
Enter
. It brings you to the checkout page- Notice now that the details in the checkout page, actually matches what we send Stripe when we hit
Send
in step #3 - Now, we go back to what the request looks like. To do that, we can check the logs in postman:
- Click into
console
in postman - Next expand the latest request (in our case, we only have one)
- You can see that the reqeust from step #3, is sent in the request body.
- The request is what we send stripe. And the response is what stripe returns back to us
- Click into
- Now you can test and fiddle with the different properties that we send Stripe - For example, uncheck
PayNow
and hitSend
- You can see now that the
PayNow
option in the stripe UI is gone
Next
Didn’t have time to finish everything, but next we can go into
- Fiddling with different properties of the request body
- Understand what’s in the reqeust header
- Including the authorisation header, etc.