---
title: Subscriptions. Payment details
slug: hyper-portal/subscriptions-payment-details
docTags: 
createdAt: 2023-04-27T08:30:44.000Z
---

All information that we managed on `Payment details` page is not stored locally in our database..
The **payment microservice** is responsible for this page and it acts as a <u>proxy service</u> with data conversion into the required formats for HyperPortal and the Stripe service

## Contact information

First you need to fill in contact information, which is required for further payments.

![](https://api.archbee.com/api/optimize/5goaGPkGyPYxtK7K75CEC/GHSN8RB6rrIKQ-DycOo7M_screenshot-2023-04-27-at-175114.png)

This information is added to the Stripe service for the **`customer`** object.

::Image[]{src="https://api.archbee.com/api/optimize/5goaGPkGyPYxtK7K75CEC/dJJlXtbyoRpWr9yRhBYQd_screenshot-2023-04-27-at-180030.png" size="40" width="702" height="1710" position="center" darkWidth="702" darkHeight="1710" showCaption="false"}

When HyperPortal add a customer to a Stripe, it ***save the `tenant_id` key in the&#x20;***<u>***metadata***</u>***, so we have a portal tenant connection and a Stripe customer.*** According to this metada, the portal will search for a customer, if it does not find it, it adds a new one, otherwise it edits it. The customer can be added both through the portal interface and through the Stripe interface - it doesn't matter how it's done.

After there is a customer in the Stripe for the tenant, you can add payment cards or choose a pricing plan.



## Payment cards

Stripe allows to add multiple cards for payment and choose the default card that will be used for automatic payment. You can always delete a card and change the default one through the portal interface.

![](https://api.archbee.com/api/optimize/5goaGPkGyPYxtK7K75CEC/4jsIZD03WlRuZBs2L5Zaw_screenshot-2023-04-27-at-181615.png)

Radio button on the right side for the **choose default card** and delete button for **delete card**. Default card cannot be deleted.

Cards store the customer id to which they belong (`cus_MNL0qWGr2Zodgs` from customer screenshot above), and their list can also be viewed in the customer card on the Stripe.

<u>**If you do not add a card or do not select by default, invoices will be sent to the mail.**</u>



## Pricing plans

<u>Pricing plans</u> on the HyperPortal **are** formed from **products and prices in Stripe**. Pricing plans can only be added/changed via the Stripe GUI by adding products and prices with the necessary metadata.

Let's look at an example `Pro plan new`

::Image[]{src="https://api.archbee.com/api/optimize/5goaGPkGyPYxtK7K75CEC/_xP1PCaVmhBwI5mt79rDf_screenshot-2023-04-27-at-183048.png" size="40" width="546" height="902" position="center" darkWidth="546" darkHeight="902" showCaption="false"}

<u>what should we do in the Stripe system to make such a pricing plan appear on the tenant for selection?</u>

- create product with title `Pro plan new` and a description listing the benefits of the subscription, separated by commas `10 users included, 15 GB tenant file storage included, 1.000 e-mails per month, *3 custom domains included`, so that they are then displayed on the HyperPortal as seen in the screenshot above.
- add a `price` to a product. The price in the **default** status will be displayed **for all tenants**. If you want to add an **individual price**, add a new price here in the product with **metadata**` {tenantId}: 1` (there can be several such keys if several tenants have the same individual price)

::Image[]{src="https://api.archbee.com/api/optimize/5goaGPkGyPYxtK7K75CEC/sSjwl_6Zmxd9MUx0pidjl_screenshot-2023-04-28-at-120723.png" size="60" width="1394" height="588" position="center" darkWidth="1394" darkHeight="588" showCaption="false"}

- in order for the product to be defined as a **price plan** and <u>displayed on the HyperPortal</u>, you need to add a **metadata:&#x20;**
  - `all: 1` - pricing plan for all tenants
  - `{tenantId}: 1` format - individual pricing plan&#x20;

That's it, the pricing plan has been created and will be displayed on the portal. But, now we need to add **extra subscriptions** for the current plan, this is when the limit of what is indicated in the plan description is exceeded. *These subscriptions will not be displayed on the portal, but will be included in the invoice*.
For this, the same products are created, but <u>no metadata</u> is indicated for them, which will<u> mean that this is not a price plan</u>.&#x20;
**The title of the product will be displayed on the invoice.**

For example, sms service:

::Image[]{src="https://api.archbee.com/api/optimize/5goaGPkGyPYxtK7K75CEC/9afDafejCSz3TzvSOc0p-_screenshot-2023-04-28-at-124149.png" size="76" width="1924" height="1488" position="center" darkWidth="1924" darkHeight="1488" showCaption="false"}

inside the product, we create price lists with prices for price plans. To **attach an extra price to our price plan**, you need to **add data to metadata** in the format `plan: {productId of price plan}` and add a unique identifier for this price: `key: {uniqueId}` - <u>**both of these parameters are required for correct working. Also, use this key to send statistics for the desired price.**</u>
Here in prices, you can also use metadata logic `all: 1` and `{tenantId}: 1`, to create individual prices.

::Image[]{src="https://api.archbee.com/api/optimize/5goaGPkGyPYxtK7K75CEC/V-esNc4INVDJK0GDCxntr_screenshot-2023-04-28-at-124223.png" size="72" width="1912" height="1212" position="center" darkWidth="1912" darkHeight="1212" showCaption="false"}

