# How can we help?

## Overview

Cordial's integration with [Recharge](https://rechargepayments.com/) empowers you to access and leverage real-time subscription data in our powerful customer engagement platform. This gives you the ability to trigger messages, personalize content, fine-tune audience segments, and report on audience trends based on real-time subscription status.

## Integrate Recharge with Cordial

1. Log in to Cordial and navigate to **Integrations > Partners**.

2. Locate the Recharge card and select **Enable**.

3. Under **Configure Integration**, select **Edit**.

4. Enter your Recharge **API key** and **API key secret**.

5. Configure **Identifier Mapping** by selecting the appropriate Recharge and Cordial identifiers.

6. Click **Save**.

## Enable Subscription Webhooks

1. Select **Enable** in the **Subscription** **Webhooks** pane.

2. Choose the **Enable** bubble and click **Save**.

## Import subscription data

1. To perform a bulk import of subscription data from Recharge, select **Import** in the **Historic Import** pane.

2. Select the import date range using the **From** and **To** calendar menus.

3. Click **Submit**.

## Data example

Below is an example of a subscription supplement record after it's been imported from Recharge into Cordial.

```json
{
    "status": "active",
    "cID": "630b7c0ba1f779f7f90d7bb4",
    "address_id": 100712768,
    "customer_id": 92307748,
    "analytics_data": {
        "utm_params": []
    },
    "cancellation_reason": null,
    "cancellation_reason_comments": null,
    "cancelled_at": null,
    "charge_interval_frequency": 30,
    "created_at": "2022-08-09T11:24:57+00:00",
    "expire_after_specific_number_of_charges": null,
    "external_product_id": {
        "ecommerce": "6568496005249"
    },
    "external_variant_id": {
        "ecommerce": "39376904192129"
    },
    "has_queued_charges": true,
    "is_prepaid": false,
    "is_skippable": true,
    "is_swappable": false,
    "max_retries_reached": false,
    "next_charge_scheduled_at": "2022-09-08",
    "order_day_of_month": null,
    "order_day_of_week": null,
    "order_interval_frequency": 30,
    "order_interval_unit": "day",
    "presentment_currency": "USD",
    "price": "12.00",
    "product_title": "Short sleeve t-shirt",
    "properties": [],
    "quantity": 3,
    "sku": null,
    "sku_override": false,
    "updated_at": "2022-08-09T11:24:57+00:00",
    "variant_title": "Black",
    "ct": "2022-08-28T14:30:35+0000",
    "lm": "2022-08-28T14:30:35+0000",
    "id": "269879305"
}
```

## Scriptable API

Our scriptable API offers asynchronous methods for sending data from Recharge to Cordial. This allows you to stream data, send multiple API requests at the same time, and have more precise control over how Cordial interacts with Recharge.

You can [use Swagger to access and test our scriptable API offerings](https://integrations-ingest-svc.cordial.com/docs#/). In order to do so, you'll need an API key.

- [Visit this article to learn how to create an API key from within Cordial](https://support.cordial.com/hc/en-us/articles/115005365087-API-Keys).

Your Recharge account ID and API client secret are required to use this feature.

### Supported actions

- [POST/recharge/subscription/{accountId}](https://support.cordial.com/hc/en-us/articles/8843982889229-Recharge-integration#h_01H1CGTR9DG0G41E6D2YA442ZP)

### POST/recharge/subscription/{accountId}

| Method | URI path |
| --- | --- |
| POST | recharge/subscription/{accountId} |
| Update subscription status in real time. |  |

- [Parameters](https://support.cordial.com/hc/en-us/articles/8843982889229-Recharge-integration#zp-1-0)
- [Example JSON request](https://support.cordial.com/hc/en-us/articles/8843982889229-Recharge-integration#zp-1-1)

\* Required

| Parameters | Type | Description | Example |
| --- | --- | --- | --- |
| \*subscription | object | Subscription information for customer. | See example request. |

```json
{
  "subscription": {
    "id": 89559201,
    "address_id": 48563471,
    "customer_id": 43845860,
    "analytics_data": {
      "utm_params": []
    },
    "cancellation_reason": null,
    "cancellation_reason_comments": null,
    "cancelled_at": null,
    "charge_interval_frequency": "30",
    "created_at": "2021-02-25T21:27:19+00:00",
    "expire_after_specific_number_of_charges": null,
    "external_product_id": {
      "ecommerce": "2103271587891"
    },
    "external_variant_id": {
      "ecommerce": "18261278883891"
    },
    "has_queued_charges": true,
    "is_prepaid": true,
    "is_skippable": false,
    "is_swappable": false,
    "max_retries_reached": false,
    "next_charge_scheduled_at": "2020-07-15",
    "order_day_of_month": null,
    "order_day_of_week": null,
    "order_interval_frequency": "15",
    "order_interval_unit": "day",
    "price": 5,
    "product_title": "Powder Milk 50.00% Off Auto renew",
    "properties": [],
    "quantity": 3,
    "sku": null,
    "sku_override": false,
    "status": "active",
    "updated_at": "2020-07-10T10:30:51",
    "variant_title": "1 / Powder",
    "include": {
      "customer": {
        "email": "test@example.com"
      }
    }
  }
}
```
