My Store: Sell physical products with Bravo and Stripe
Last updated
Last updated
In this tutorial, we'll show how to create an e-commerce app to sell physical products, using our Payment with Stripe feature. We'll retrieve the products data from Airtable, and create a personalised checkout page for each product.
In order to implement this app case, you'll need to set up a Stripe account, and have an Bravo Solo plan.
If you are new to Bravo, we recommend you check out this page before following this tutorial, to get some knowledge on how to use the Bravo Data Library and Data Binding.
Design file: Figma
This Figma file is bravorized (i.e. ready to be imported into Bravo). If you want to customize it, duplicate it in Figma and make your changes, but make sure to not remove Bravo elements such as containers and tags.
The Figma file includes two screens: one to show all the available products on a list, and another one to buy a product from the list, containing a checkout form. In this form, the user will introduce the following information:
Full name.
Email address.
Phone number (the user will need to add the +XXX specific country code).
Credit card details.
Additional comments.
Our Figma file includes all the tags needed to implement the Stripe Payment feature, and to collect the data indicated above in your Stripe account. In this case, we're using hidden input fields to be able to bind the price of each product with the data stored in Airtable. You can check out all the information regarding the payment-related Bravo Tags here.
Data source: Airtable
Open the Airtable and click Copy Base
to duplicate to your account.
Includes
A table with three physical products, containing a product name, price, and picture.
First, we'll create the API requests needed to connect our Airtable database to Bravo. In the Data Library, click on Create New Collection
and use the Airtable wizard. This will generate two API requests (list and detail) for our product table.
List
requestThis request will list all the products from the table. We'll use it later to display a list of the available products on the home screen.
To select the necessary data, hit Send
and make sure that, at least, the following items are selected:
Detail
requestThis request will list one item of the table, based on the item ID passed as a query string parameter in the URL. If you used the Airtable wizard to setup the requests, the URL for the "detail" request will look like this:
The ID parameter is introduced as a Bravo Variable in the URL, and needs to have the same name and spelling as the ID value on the "Selected Data" panel of the "List" request - this way, Bravo will know to bind the two requests.
Similar to what we did with the "List" request, we need to select the data items that will later be used when binding the UI elements. In order to do that, we need to perform a request by clicking Send
. As the URL contains a Bravo variable, we need to specify a temporary value for it, so the request retrieves a real item from the table.
Go to the "List" request, and on the Received Data
tab, copy the ID value of one list element (the string to the left of the .data.records[].id
path).
In the "Detail" request, go to the Parameters tab, set ID
as the key (same spelling as the Bravo variable on the URL), and the copied ID string as the value.
Then, hit Send
and make sure that, at least, the following items are selected:
As indicated before, you can change the name of the data items on the Selected Data
panel.
After setting up the API requests and selecting the data items in the Data Library, it's time to bind the app screens to the data!
We have two screens in our design: one to list all the items on our table, and another one to display a custom checkout page for each of the items. In this screen, the app users will introduce their personal and credit card data to purchase a physical product.
Product List
screenThis screen will display the list of products available in our e-commerce app. We'll bind the UI elements to the data as follows:
Product Detail
screenOn this screen, besides the product name and image, we'll bind the price (stored in our Airtable) to the hidden input field defined in the design file. This hidden input field will be linked to the product price, so when submitting the payment form, the amount indicated there will be charged to the user.
Bind the UI elements to the data as follows:
Finally, on the Response Actions
panel, select Go to page
and Product List
, so the user is redirected here after the purchase. You can also create a confirmation page to redirect the user.
Finally, you'll need to connect your Stripe account on the "Settings" panel inside your Bravo project. Go to the Stripe
tab, click on Connect
, and then log in to your Stripe account.
Congrats! You can now test your e-commerce app in Bravo Vision, and send real payments to your Stripe account.
Happy Bravorizing! 🥳