# My Store: Sell physical products with Bravo and Stripe

In this tutorial, we'll show how to create an e-commerce app to sell physical products, using our [Payment with Stripe](../../../integrations/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](https://stripe.com/es) account, and have an **Bravo Solo plan**.

![](https://1444025092-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MXpqEanvOhm8vMtIH8i%2F-Mj3XZeOXA_ftHQYqsv1%2F-Mj3_bBphNQWuqMM6Zvq%2F462879f0-7fd0-480d-8803-94e6bc0caa0e.gif?alt=media\&token=9fce61f2-6419-45a6-8687-db3c9828d5e6)

{% hint style="info" %}
If you are new to Bravo, we recommend you check out [this page](broken-reference) before following this tutorial, to get some knowledge on how to use the Bravo **Data Library** and **Data Binding**.
{% endhint %}

## 💎 Resources <a href="#resources" id="resources"></a>

**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](https://www.countrycode.org/)).
* 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](../../../integrations/payment-with-stripe).

{% @figma/embed fileId="VrG3LALLpvxnnkyISR6fJv" nodeId="9500:0" url="https://www.figma.com/file/VrG3LALLpvxnnkyISR6fJv?node-id=9500:0" %}

**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.

{% embed url="https://airtable.com/shrnTCTCNZvuJoYLO" %}

## 🚧 Creating the API requests in the Data Library

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.

### &#x20;   1. **`List`** **request**

This 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:

![](https://1444025092-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MXpqEanvOhm8vMtIH8i%2F-Mj3XZeOXA_ftHQYqsv1%2F-Mj3cLWw64BWEX6fUk4P%2Flist_data.gif?alt=media\&token=d9aaca22-ee8c-4b9a-b463-06ab65869b0c)

### &#x20;   2. **`Detail`** **request**

This 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:

```
https://api.airtable.com/v0/BASE_ID/TABLE_NAME/${ID}
```

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:

![](https://1444025092-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MXpqEanvOhm8vMtIH8i%2F-Mj3XZeOXA_ftHQYqsv1%2F-Mj3cjvifSZGKkTZdVZy%2Fdetail_data.gif?alt=media\&token=1ea6b066-a584-482c-a095-5ba3a77a4409)

As indicated before, you can change the name of the data items on the `Selected Data` panel.

## 📲 Binding the data to the app UI

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` screen**

This screen will display the list of products available in our e-commerce app. We'll bind the UI elements to the data as follows:

![](https://1444025092-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MXpqEanvOhm8vMtIH8i%2F-Mj3XZeOXA_ftHQYqsv1%2F-Mj3eCdBqmV_QaFQ5Cb_%2FList_Screen.gif?alt=media\&token=13aeb5b6-fcab-48ca-80c2-40fe6e51a0a7)

### **`Product Detail` screen**

On 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:

![](https://1444025092-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MXpqEanvOhm8vMtIH8i%2F-Mj3XZeOXA_ftHQYqsv1%2F-Mj3eLfw1KZPKKrvkirF%2FDetail_screen.gif?alt=media\&token=1c41b5ad-d1a3-4cd5-87b9-66e468b10bf6)

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.

## 💰 Connect your Stripe account

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.

![](https://1444025092-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MXpqEanvOhm8vMtIH8i%2F-Mj3XZeOXA_ftHQYqsv1%2F-Mj3eeMsJgCxvLvs0hK2%2Fimagen.png?alt=media\&token=928db92b-7d55-4652-ad27-294049133106)

Congrats! You can now test your e-commerce app in Bravo Vision, and send real payments to your Stripe account.

Happy Bravorizing! 🥳

