# Hotmart

> Connect Hotmart to your Cademí: the product ID or offer code, the authentication token and the version 2.0 webhook that grants access on each purchase.

Connect Hotmart to your Cademí so each approved purchase gives the student access on its own. You need the product ID (or the offer code), the token of your Hotmart account and a webhook pointing to Cademí.

## 1. Create the delivery in Cademí

1. In the Cademí dashboard, open **Sales > Deliveries** and add a delivery.
2. In **Select a Gateway**, pick **Hotmart**.
3. In **Delivery Name**, enter a name that helps you recognize it later.
4. In **Sales Mode**, choose **One-time sale** or **Subscription**, matching the product on Hotmart.
5. The **Gateway connection** section shows the **Product ID** and **Token** fields and the **Postback URL**.

Keep the delivery open: you come back to it in the next steps.

## 2. Find the product ID or the offer code

1. In the Hotmart dashboard, open **Produtos > Sou Produtor(a)** (Products > I am a producer).
2. To use the whole product, copy the ID shown below the product name in the list.
3. To use a specific offer, open the product, go to the **Precificação e Ofertas** tab (Pricing and Offers; **Cupons** for subscriptions) and copy the value in the **Código** (Code) column.
4. Paste the value into **Product ID** in the Cademí delivery.

**Product or offer:** when a sale carries both, Cademí first looks for a delivery with the offer code and, if there is none, uses the one with the product ID. So a delivery per offer gives each offer its own access, and a delivery with the product ID covers the offers that have no delivery of their own.

## 3. Copy the token

If you already registered your Hotmart token in another delivery, pick it in **Use an already registered token** and go to step 4.

1. In the Hotmart dashboard, open **Ferramentas > Webhook (API e Notificações)** (Tools > Webhook).
2. On the **Autenticação** (Authentication) tab, click **Mostrar Token** (Show token).
3. Copy the token and paste it into **Token** in the Cademí delivery.

## 4. Set up the webhook

1. Still in **Ferramentas > Webhook (API e Notificações)**, click **Nova Configuração** (New configuration).
2. In **Nome da Configuração** (Configuration name), enter "Cademí".
3. In **Produtos** (Products), choose all of them or only the ones you deliver through Cademí.
4. In **URL**, paste the **Postback URL** of the delivery.
5. In **Versão** (Version), choose **2.0**.
6. Select the events: Compra aprovada, Compra completa, Compra cancelada, Compra reembolsada, Chargeback, Pedido de reembolso, Compra atrasada, Cancelamento de assinatura and Troca de plano (approved, completed, canceled and refunded purchase, chargeback, refund request, late purchase, subscription cancellation and plan change).
7. Save the configuration and, in Cademí, save the delivery.

**If you chose only some products:** each time you start delivering a new product through Cademí, add it to this webhook configuration.

## Good to know

- **Purchase with another email and the same CPF.** If the purchase email has no account yet, Cademí looks for a student with the same CPF and grants the access to that student. The student keeps signing in with the old email. Only the CPF is used in this lookup, not the CNPJ.
