---
title: "New Cycle Started Webhook"
source_url: https://docs.rapyd.net/en/new-cycle-started-webhook.html
lang: en
---

# New Cycle Started Webhook

The **CUSTOMER_SUBSCRIPTION_NEW_CYCLE** webhook is sent when a new billing cycle starts.

> **Note:**
>
> The endpoint for webhooks is unique for each client. To set up a webhook endpoint, see [Defining a Webhook Endpoint](https://docs.rapyd.net/en/defining-a-webhook-endpoint.md "Defining a Webhook Endpoint").

### Parameters

### Webhook Header Parameters

- - Content-Type
  - Indicates that the data appears in JSON format. Set to **application/json**.
- - salt
  - Random string.
- - signature
  - Signature calculated for each webhook individually.

    See [Webhook Authentication](https://docs.rapyd.net/en/webhook-authentication.md "Webhook Authentication").
- - timestamp
  - Timestamp for the webhook, in [Unix time](https://docs.rapyd.net/en/glossary.md#UUID-945d98cf-adae-e1cf-2606-c7fae8b4a7e1_unix_time "Unix time") (seconds).

### Webhook Root Parameters

- - created_at
  - Time that the webhook was created, in [Unix time](https://docs.rapyd.net/en/glossary.md#UUID-945d98cf-adae-e1cf-2606-c7fae8b4a7e1_unix_time "Unix time").

    > **Note:**
    >
    > Inside the `data` object, some webhooks have another `created_at` field that refers to a different event.
- - data
  - Contains the actual data of the webhook.

    For details, see below.
- - extended_timestamp
  - Time in milliseconds that the webhook was created, in [Unix time](https://docs.rapyd.net/en/glossary.md#UUID-945d98cf-adae-e1cf-2606-c7fae8b4a7e1_unix_time "Unix time").
- - id
  - ID of the webhook. String starting with **wh_**.
- - status
  - Status of the webhook. One of the following:

    - **NEW**
    - **CLO** - Closed.
    - **ERR** - Error.
    - **RET** - Re-sent.

    > **Note:**
    >
    > Inside the `data` object, some webhooks have another `status` field that refers to a different event.
- - trigger_operation_id
  - ID of the operation that triggered the webhook. UUID.
- - type
  - Name of the webhook type.

    > **Note:**
    >
    > The name in the Client Portal is different.

### Webhook Data Parameters

- - billing
  - Determines the method of billing at the end of the billing cycle. Set to **pay_automatically** - Rapyd generates a `payment` object, then attempts to pay it using the designated payment method.
- - billing_cycle_anchor
  - Determines the start of the next full billing cycle, as defined in the plan described in the `items`. One of the following values:

    - **now** - The present day. The next billing cycle starts right now.
    - *Timestamp* in [Unix time](https://docs.rapyd.net/en/glossary.md#UUID-945d98cf-adae-e1cf-2606-c7fae8b4a7e1_unix_time "Unix time") - A time in the future, at or after the end of the free trial period, not more than the length of the billing cycle. The current billing cycle will be shorter than all other billing cycles. Relevant to creating a subscription.
    - **unchanged** - The original billing cycle anchor is unchanged. Relevant to updating a subscription.
- - cancel_at_period_end
  - Determines the last date that charges accrue.

    - **true** - Charges accrue until the end of the current billing period, then the subscription is canceled.

      - When no trial period is set, after `cancel_at_period_end` is set to **true** the subscription will not be renewed at the next interval.
      - When a trial period is set after `cancel_at_period_end` is set to **true**, the subscription will not begin.
    - **false** - When the subscription is created, no end is defined. When [Cancel Subscription](https://docs.rapyd.net/en/cancel-subscription.md "Cancel Subscription") is run, charges stop immediately and the subscription is canceled.
- - cancel_checkout_url
  - URL where the customer is redirected after pressing **Back to Website** to exit the hosted page. This URL overrides the `merchant_website` URL. Does not support localhost URLs.
- - canceled_at
  - Date and time that the subscription is canceled by the customer or by the client. [Unix time](https://docs.rapyd.net/en/glossary.md#UUID-945d98cf-adae-e1cf-2606-c7fae8b4a7e1_unix_time "Unix time").
- - complete_checkout_url
  - URL where the customer is redirected after pressing **Finish** to exit the hosted page. This URL overrides the `merchant_website` URL. Does not support localhost URLs.
- - complete_payment_url
  - URL where the customer is redirected when payment is successful, after returning from an external page such as a 3DS page. Does not support localhost URLs.
- - coupon
  - ID of a coupon to apply a discount to the subscription. String starting with **coupon_**.
- - created_at
  - Time of creation of this subscription, in [Unix time](https://docs.rapyd.net/en/glossary.md#UUID-945d98cf-adae-e1cf-2606-c7fae8b4a7e1_unix_time "Unix time").
- - current_period_end
  - End of the current billing cycle, in [Unix time](https://docs.rapyd.net/en/glossary.md#UUID-945d98cf-adae-e1cf-2606-c7fae8b4a7e1_unix_time "Unix time").
- - current_period_start
  - Start of the current billing cycle, in [Unix time](https://docs.rapyd.net/en/glossary.md#UUID-945d98cf-adae-e1cf-2606-c7fae8b4a7e1_unix_time "Unix time").
- - customer_token
  - ID of the customer who pays for this subscription. String starting with **cus_**.
- - days_until_due
  - Number of days the customer has for paying this invoice.
- - discount
  - Contains information about the coupon that applies to the subscription. Returned as a **null** value when there is no discount.
- - ended_at
  - Date that the subscription was canceled or otherwise terminated. [Unix time](https://docs.rapyd.net/en/glossary.md#UUID-945d98cf-adae-e1cf-2606-c7fae8b4a7e1_unix_time "Unix time").
- - error_payment_url
  - URL where the customer is redirected when payment is not successful, after returning from an external page, such as a 3DS page. Does not support localhost URLs.
- - id
  - ID of the Subscription object. String starting with **sub_**.
- - language
  - Determines the default language of the hosted page. For a list of values, see [List Supported Languages](https://docs.rapyd.net/en/list-supported-languages.md "List Supported Languages").

    - When this parameter is null, the language of the user's browser is used.
    - If the language of the user's browser cannot be determined, the default language is English.
- - merchant_reference_id
  - Identifier defined by the client for reference purposes. Limit: 45 characters.
- - metadata
  - A JSON object defined by the client. See [Metadata](https://docs.rapyd.net/en/metadata.md "Metadata").
- - page_expiration
  - End of the time when the customer can use the hosted page, in [Unix time](https://docs.rapyd.net/en/glossary.md#UUID-945d98cf-adae-e1cf-2606-c7fae8b4a7e1_unix_time "Unix time"). If `page_expiration` is not set, the hosted page expires 14 days after creation.

    **Range:** 1 minute to 30 days.
- - payment_fields
  - Additional `payment_options` fields.
- - payment_method
  - Payment method used for paying invoices generated by this subscription. The ID is a string starting with **card_** or **other_**.
- - payout_fields
  - Reserved.
- - product
  - ID of a `product` object. String starting with **product_** Relevant to [List Subscriptions](https://docs.rapyd.net/en/list-subscriptions.md "List Subscriptions").
- - simultaneous_invoice
  - Determines when the system creates a payment for an invoice.

    - **true** - Payment is created when the invoice is issued.
    - **false** - Payment is created one hour after the invoice is issued.
- - status
  - Status of the subscription. One of the following:

    - **active** - The customer is currently paying for this subscription.
    - **canceled** - The customer has canceled this subscription, but it remains in the Rapyd database.
    - **past_due** - Payment for this subscription was not received by the end of the billing period.
    - **trialing** - The subscription is in its free trial period.
    - **unpaid** - An error occurred in the payment for this subscription.
- - subscription_items
  - An object or array of objects containing the following fields:

    - - data
      - Array of objects that describe individual subscription items.

        - - active
          - Indicates whether the subscription item is active.
        - - created
          - The time the subscription item was created, in [Unix time](https://docs.rapyd.net/en/glossary.md#UUID-945d98cf-adae-e1cf-2606-c7fae8b4a7e1_unix_time "Unix time").
        - - id
          - ID of the subscription item. String starting with **subi_**.
        - - metadata
          - A JSON object defined by the client. See [Metadata](https://docs.rapyd.net/en/metadata.md "Metadata").
        - - plan
          - The pricing plan that defines the product and pricing structure associated with this subscription item. Cannot be a plan that is already part of the subscription. For details of the fields in the 'plan' object, see [Create Plan](https://docs.rapyd.net/en/create-plan.md "Create Plan").
        - - quantity
          - The number of units of the service defined in the plan. Integer. This number can be updated during the billing cycle using [Update Subscription](https://docs.rapyd.net/en/update-subscription.md "Update Subscription") or [Update Subscription Item](https://docs.rapyd.net/en/update-subscription-item.md "Update Subscription Item").
        - - subscription_id
          - ID of the subscription that this subscription item belongs to. String starting with **sub_**.
    - - has_more
      - Indicates that the number of `subscription_items` records is greater than the number of the returned records.
    - - total_count
      - Number of `subscription_items` records.
    - - url
      - URL for the record of all subscription items for this subscription.
- - tax_percent
  - The percentage tax rate that is applied to the subtotal of the invoice, after subtracting all discounts. Decimal.
- - trial_end
  - The date and time of the end of the customer's free trial period, in [Unix time](https://docs.rapyd.net/en/glossary.md#UUID-945d98cf-adae-e1cf-2606-c7fae8b4a7e1_unix_time "Unix time"), or the string **now**. Relevant when `trial_period_days` is not defined.
- - trial_from_plan
  - Determines whether the subscription uses the free trial period defined in the plan.

    - **true** - Uses the trial period defined in the plans added to the subscription. When `trial_from_plan` is true, all plans in the subscription must have the same value for `trial_period_days`.
    - **false** - Uses the trial period defined in the subscription.
- - trial_period_days
  - The number of days in the customer's free trial period. Integer. Range: 0-730.

    Relevant when `trial_end` is not defined.
- - trial_start
  - Date and time of the start of the customer's free trial period, in [Unix time](https://docs.rapyd.net/en/glossary.md#UUID-945d98cf-adae-e1cf-2606-c7fae8b4a7e1_unix_time "Unix time").
- - type
  - The type of the subscription.

    - **payment**

- CUSTOMER_SUBSCRIPTION_NEW_CYCLE Webhook
- ```json
  {
      "id": "wh_3e168ef0ed50e6e1fff5382fb711f911",
      "type": "CUSTOMER_SUBSCRIPTION_NEW_CYCLE",
      "data": {
          "id": "sub_005ca057b15771a535469a60ccce98a2",
          "type": "payment",
          "status": "active",
          "billing": "pay_automatically",
          "discount": null,
          "ended_at": null,
          "metadata": {},
          "trial_end": null,
          "created_at": 1641802550,
          "canceled_at": null,
          "tax_percent": 0,
          "trial_start": null,
          "payout_fields": null,
          "customer_token": "cus_d3ed65d5091a8398cc3651bcedec1201",
          "days_until_due": null,
          "payment_fields": null,
          "payment_method": "card_85264b18bc1bfb949dbb2d88d3d5c12c",
          "current_period_end": 1641975350,
          "subscription_items": {
              "url": "/v1/subscription_items?subscription=sub_005ca057b15771a535469a60ccce98a2",
              "data": [{
                      "id": "subi_139cc833a43aa340ee25ca59a4a34ea6",
                      "plan": {
                          "id": "plan_a2b5060d3e93d4c32883ac2b39c3f2de",
                          "tiers": [],
                          "amount": 1050,
                          "product": {
                              "id": "product_2ddd6f6b43f598d30543ef23ab806b58",
                              "name": "Acme music stream",
                              "skus": [],
                              "type": "services",
                              "active": true,
                              "images": [],
                              "metadata": {},
                              "shippable": false,
                              "attributes": [],
                              "created_at": 1641481860,
                              "unit_label": "",
                              "updated_at": 1641481860,
                              "description": "",
                              "package_dimensions": {
                                  "width": 0,
                                  "height": 0,
                                  "length": 0,
                                  "weight": 0
                              },
                              "statement_descriptor": ""
                          },
                          "currency": "USD",
                          "interval": "day",
                          "metadata": {},
                          "nickname": "Plan 1050",
                          "created_at": 1641802015,
                          "tiers_mode": "",
                          "usage_type": "licensed",
                          "billing_scheme": "per_unit",
                          "interval_count": 1,
                          "aggregate_usage": "sum",
                          "transform_usage": {
                              "round": "up",
                              "divide_by": 1
                          },
                          "trial_period_days": 0
                      },
                      "created": 1641802550,
                      "metadata": null,
                      "quantity": 1
                  }
              ],
              "has_more": false,
              "total_count": 0
          },
          "billing_cycle_anchor": 1641802550,
          "cancel_at_period_end": false,
          "current_period_start": 1641888950
      },
      "trigger_operation_id": "5df6b51b-0203-4930-a9d0-b51353e31464",
      "status": "NEW",
      "created_at": 1641859559,
      "extended_timestamp": 1641859559742
  }
  ```
