> For the complete documentation index, see [llms.txt](https://docs.hyperswitch.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.hyperswitch.io/integrations/prism/node/payment-service/setup-recurring.md).

# Setup Recurring

## Overview

The `setupRecurring` method establishes a payment mandate for future recurring charges. This enables subscription billing, automated bill payments, and installment plans without requiring customer presence for each transaction.

**Business Use Case:** A customer signs up for your SaaS monthly plan. Setup a recurring mandate so you can charge their card automatically each month.

## Purpose

| Scenario           | Benefit                    |
| ------------------ | -------------------------- |
| SaaS subscriptions | Automate monthly billing   |
| Utility bills      | Enable automatic payments  |
| Installment plans  | Schedule multiple payments |
| Membership dues    | Automate renewals          |

## Request Fields

| Field                        | Type           | Required | Description                    |
| ---------------------------- | -------------- | -------- | ------------------------------ |
| `merchantRecurringPaymentId` | string         | Yes      | Your unique recurring setup ID |
| `amount`                     | Money          | Yes      | Initial amount for validation  |
| `paymentMethod`              | PaymentMethod  | Yes      | Card or payment method         |
| `address`                    | PaymentAddress | Yes      | Billing address                |
| `authType`                   | string         | Yes      | THREE\_DS or NO\_THREE\_DS     |
| `setupFutureUsage`           | string         | No       | ON\_SESSION or OFF\_SESSION    |
| `customer`                   | object         | No       | Customer information           |

## Response Fields

| Field                         | Type          | Description                  |
| ----------------------------- | ------------- | ---------------------------- |
| `merchantRecurringPaymentId`  | string        | Your reference (echoed back) |
| `connectorRecurringPaymentId` | string        | Connector's mandate ID       |
| `status`                      | PaymentStatus | ACTIVE, FAILED, PENDING      |
| `mandateReference`            | object        | Mandate ID and status        |
| `error`                       | ErrorInfo     | Error details if failed      |
| `statusCode`                  | number        | HTTP status code             |

## Example

### SDK Setup

```javascript
const { PaymentClient } = require('hyperswitch-prism');

const paymentClient = new PaymentClient({
    connector: 'stripe',
    apiKey: 'YOUR_API_KEY',
    environment: 'SANDBOX'
});
```

### Request

```javascript
const request = {
    merchantRecurringPaymentId: "recurring_001",
    amount: {
        minorAmount: 2900,
        currency: "USD"
    },
    paymentMethod: {
        card: {
            cardNumber: { value: "4242424242424242" },
            cardExpMonth: { value: "12" },
            cardExpYear: { value: "2027" },
            cardCvc: { value: "123" },
            cardHolderName: { value: "John Doe" }
        }
    },
    address: {
        billing: {
            line1: "123 Main St",
            city: "San Francisco",
            state: "CA",
            zip: "94102",
            country: "US"
        }
    },
    authType: "NO_THREE_DS",
    setupFutureUsage: "OFF_SESSION"
};

const response = await paymentClient.setupRecurring(request);
```

### Response

```javascript
{
    merchantRecurringPaymentId: "recurring_001",
    connectorRecurringPaymentId: "seti_3Oxxx...",
    status: "ACTIVE",
    mandateReference: {
        mandateId: "pm_3Oxxx...",
        mandateStatus: "ACTIVE"
    },
    statusCode: 200
}
```

## Next Steps

* [RecurringPaymentService.charge](/integrations/prism/node/recurring-payment-service/charge.md) - Use the mandate for future charges
* [RecurringPaymentService.revoke](/integrations/prism/node/recurring-payment-service/revoke.md) - Cancel the mandate


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.hyperswitch.io/integrations/prism/node/payment-service/setup-recurring.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
