# GoHighLevel

> Connect GoHighLevel to your Cademí: the product ID, the beta gateway notice and the workflow with the payment received and refund webhooks.

Connect GoHighLevel to your Cademí so each approved purchase gives the student access on its own and a refund takes it away. You need the product ID and a GoHighLevel workflow that notifies Cademí by webhook. GoHighLevel does not ask for a token.

## 1. Create the delivery in Cademí

1. In the Cademí dashboard, open **Sales > Deliveries** and add a delivery.
2. In **Select a Gateway**, pick **GoHighLevel**. The screen shows the notice **This gateway is in the beta implementation phase, but you can already use it**: carry on as usual.
3. In **Delivery Name**, enter a name that helps you recognize it later.
4. **Sales Mode** shows only **One-time sale**: a GoHighLevel delivery has no **Subscription** option.
5. The **Gateway connection** section shows the **Product ID** field and the **Postback URL**.

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

## 2. Find the product ID

1. In the GoHighLevel dashboard, click **Payments** in the side menu and then **Products**.
2. Click the product and, in the **Additional Information** section, copy the value of **Internal Product Id**.
3. Paste the ID into **Product ID** in the Cademí delivery.

## 3. Create the workflow

The workflow listens to GoHighLevel payments: an approved payment gives the student access, and a refund takes it away.

1. In the side menu, click **Automation** and, in the top right corner, **Create Workflow**.
2. Choose **Start from Scratch** and name the workflow "Cademí".
3. Click **Add New Trigger**, pick the **Payment Received** event and, in **Filters**, set **Payment Status** **is** **Success**. Save the trigger.
4. Click **Add New Trigger** again, pick the **Refund** event and, in **Filters**, set **Status** **is** **Success**. Save the trigger.
5. Below the triggers, click **+** and add the **Condition** action, checking the **Workflow Trigger** field.
6. In the condition, create two branches: **Approved**, when the trigger is **Payment Received**, and **Canceled**, when it is **Refund**. The **None** branch, when it is neither, has no action.

## 4. Add the webhooks

The webhooks are the actions that notify Cademí. Without them, the workflow runs in GoHighLevel and Cademí receives nothing.

In the **Approved** branch:

1. Click **+** below the branch and pick the **Webhook** action.
2. In **Action Name**, enter "Approved". In **Method**, choose **POST**. In **URL**, paste the **Postback URL** of the delivery.
3. Leave **Custom Data** and **Headers** blank and click **Save Action**.

In the **Canceled** branch:

1. Click **+** below the branch and pick the **Custom Webhook** action.
2. In **Action Name**, enter "Canceled". In **Event**, choose **CUSTOM**; in **Method**, **POST**; in **URL**, paste the **Postback URL** of the delivery; in **Authorization**, **None**.
3. Leave **Headers** and **Query Parameters** blank. In **Content-Type**, choose `application/json`.
4. In **Raw Body**, select **Custom Values** and paste this code exactly:

```json
{
  "payment_status": "canceled",
  "transaction_id": "{{refund.transaction.id}}",
  "user_email": "{{contact.email}}",
  "user_name": "{{contact.name}}"
}
```

5. Click **Save Action**.

Finally, click **Publish** to publish the workflow and, in Cademí, save the delivery.

**Attention:** a draft workflow sends nothing. If you do not publish it, Cademí does not receive your sales.
