# GoGift: Send digital gift cards automatically

URL: https://help.hubhus.com/kb/setting-up-gogift-integration-with-oauth-2-0
Category: Integrations / Gifts
Updated: 2026-09-28T14:41:07.629+00:00

Summary: Create one OAuth 2.0 Client Credentials connection in Hubhus using your GoGift credentials. Then create three HTTP requests - each must have the OAuth connection selected under Connection / Authentication . Do not set an Authorization header manually. Use %lead_id% as the basket reference. Production productId for The Global Gift Card DKK Email: 256472009205907456 , SKU: FF79DB80 .

Connect Hubhus to GoGift's gift card API using OAuth 2.0 to automatically send digital gift cards as part of your lead flows. Once configured, Hubhus handles authentication and executes three HTTP requests - create basket, update basket, and finalize - without any manual token management.

## Get started in 5 steps

1. **Create an OAuth 2.0 connection**. Go to **Account → Integrations & API → Connections** and create a new connection. Set Auth type to **OAuth 2.0 - Client Credentials**. Enter the production Token URL `https://auth.gogift.io/connect/token` and your GoGift Client ID and Client Secret. Leave Scopes, Audience, and Custom token params empty. Save - Hubhus will show **Connected** when the token exchange succeeds.
2. **Step 1 - Create basket (POST)**. Create an HTTP request: **POST** to `https://api.gogift.io/baskets`. Under **Connection / Authentication**, select the GoGift OAuth connection. Add headers `Accept: application/json` and `Content-Type: application/json`. Body: `{"salesChannelId": "109"}`. In the JSON property map, map `id` → `{{basketid}}`.
3. **Step 2 - Update basket (PUT)**. Create an HTTP request: **PUT** to `https://api.gogift.io/baskets`. Select the GoGift OAuth connection. Set `id` to `{{basketid}}` and `reference` to `%lead_id%`. Include buyer details and the product with `productId: 256472009205907456`, `stockKeepingUnit: FF79DB80`, and a `giftcardValue` of at least 50 (multiples of 10).
4. **Step 3 - Finalize basket (POST)**. Create an HTTP request: **POST** to `https://api.gogift.io/baskets/finalize`. Select the GoGift OAuth connection. Body: `{"basketId": "{{basketid}}", "paymentMethod": "InvoiceByFinance", "countryCode": "DK"}`. This finalizes the order with GoGift.
5. **Test with a real lead**. Trigger the automation on a test lead and verify that all three HTTP requests return success. Confirm in your GoGift account that the order has been created with the correct recipient email and gift card value.

**Auth type:** OAuth 2.0 - Client Credentials · **Production token URL:** `https://auth.gogift.io/connect/token` · **Production productId:** `256472009205907456` · **SKU:** `FF79DB80`

**Read more**

### OAuth connection - field reference

| Field | Production value | Sandbox value |
| --- | --- | --- |
| Auth type | OAuth 2.0 - Client Credentials |
| Token URL | `https://auth.gogift.io/connect/token` | `https://auth-pre.gogift.io/connect/token` |
| Discovery URL | Leave empty |
| Client ID | From GoGift |
| Client Secret | From GoGift - keep confidential |
| Scopes | Leave empty |
| Audience | Leave empty |
| Custom token params | Leave empty |

When the connection is saved successfully, Hubhus shows status **Connected**. You do not need to add an `Authorization` header on any HTTP request - Hubhus injects the Bearer token automatically when the OAuth connection is selected.

### Step 1 - Create basket: full request

**Method:** POST **URL:** `https://api.gogift.io/baskets`

**Headers:**

```
Accept: application/json
Content-Type: application/json
```

**Body:**

```
{
  "salesChannelId": "109"
}
```

**JSON property map:**

```
id  →  {{basketid}}
```

The response contains the GoGift basket ID. Mapping `id` to `{{basketid}}` makes it available in the following requests.

### Step 2 - Update basket: full request

**Method:** PUT **URL:** `https://api.gogift.io/baskets`

**Body:**

```
{
  "id": "{{basketid}}",
  "paymentCurrency": "DKK",
  "doClearProducts": false,
  "reference": "%lead_id%",
  "buyer": {
    "accountId": "328685355341950976",
    "accountType": "B2BDepartment",
    "name": "YourCompany A/S",
    "email": "contact@yourcompany.dk",
    "phone": "+4500000000",
    "address": {
      "line1": "Street 1",
      "city": "City",
      "countryCode": "DK",
      "postCode": "0000"
    }
  },
  "addProducts": [
    {
      "deliveryMethod": "Email",
      "recipientName": "%lead_name%",
      "recipientEmail": "%lead_email%",
      "stockKeepingUnit": "FF79DB80",
      "productId": "256472009205907456",
      "quantity": 1,
      "giftcardValue": 50,
      "valueCurrency": "DKK"
    }
  ]
}
```

**id vs. reference:** `id` is the GoGift basket ID from Step 1. `reference` is your internal order/lead reference - always set this to `%lead_id%`. Production GoGift accounts typically require a reference, even if sandbox worked without it.

**giftcardValue rules:** minimum 50, step 10, maximum 5000. Valid: 50, 60, 100, 250. Invalid: 1, 55, 99.

### Step 3 - Finalize basket: full request

**Method:** POST **URL:** `https://api.gogift.io/baskets/finalize`

**Body:**

```
{
  "basketId": "{{basketid}}",
  "paymentMethod": "InvoiceByFinance",
  "countryCode": "DK"
}
```

This creates the confirmed order with GoGift and triggers delivery of the gift card to the recipient email.

### Sandbox vs. production

| Environment | Auth URL | API base URL |
| --- | --- | --- |
| Sandbox | `https://auth-pre.gogift.io/connect/token` | `https://api-pre.gogift.io` |
| Production | `https://auth.gogift.io/connect/token` | `https://api.gogift.io` |

Sandbox and production credentials are separate and not interchangeable. Product data also differs between environments:

| Environment | productId | stockKeepingUnit |
| --- | --- | --- |
| Sandbox | `256314825926729728` | `AEC9A553` |
| Production | `256472009205907456` | `FF79DB80` |

### Troubleshooting

**OAuth credentials verification failed: Token exchange failed: HTTP 400**

The OAuth token exchange is failing. Check:

- Are you using the correct Token URL for your environment (production vs. sandbox)?
- Are Scopes, Audience, and Custom token params all empty?
- Is the Client ID and Client Secret correct?

**{"error":"invalid_client"}**

GoGift is rejecting the Client ID or Client Secret. Verify your credentials directly with GoGift. This is not a basket configuration error.

**The basket require order reference, but the order reference is not supplied**

Add `"reference": "%lead_id%"` to the Step 2 Update basket body. Production accounts require this field even if sandbox worked without it.

**GoGift returns HTML instead of JSON**

Add the header `Accept: application/json` to the HTTP request.

**Update basket or finalize fails with a product or value error**

- Confirm `productId` and `stockKeepingUnit` match the correct environment
- Confirm `giftcardValue` is at least 50 and a multiple of 10
- Confirm `recipientEmail` is set when `deliveryMethod` is `Email`
- Confirm the GoGift OAuth connection is selected on the request

### Pre-launch checklist

- OAuth connection is created and shows **Connected**
- OAuth connection is selected under Connection / Authentication on all three HTTP requests
- No manual `Authorization` header is set on any request
- `Accept: application/json` header is set on all requests
- Step 1 maps `id` to `{{basketid}}` in the JSON property map
- Step 2 sets `id` to `{{basketid}}`
- Step 2 sets `reference` to `%lead_id%`
- Step 2 uses the production `productId` and `stockKeepingUnit`
- `giftcardValue` is at least 50 and a multiple of 10
- Step 3 sets `basketId` to `{{basketid}}`

## Related articles

- https://help.hubhus.com/kb/connections-reusable-authentication-for-http-requests
- https://help.hubhus.com/kb/creating-custom-http-request-templates
- https://help.hubhus.com/kb/hubhus-integrations-overview
- https://help.hubhus.com/kb/how-do-i-use-action-buttons
