Mandates
Create UPI Mandate
Create a new UPI autopay mandate for recurring payments.
POST
/
v1
/
mandates
Create a UPI Autopay mandate
curl --request POST \
--url https://billing.example.com/v1/mandates \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"customer_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"max_amount": 123,
"currency": "<string>",
"subscription_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"vpa": "<string>"
}
'import requests
url = "https://billing.example.com/v1/mandates"
payload = {
"customer_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"max_amount": 123,
"currency": "<string>",
"subscription_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"vpa": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
customer_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
max_amount: 123,
currency: '<string>',
subscription_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
vpa: '<string>'
})
};
fetch('https://billing.example.com/v1/mandates', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://billing.example.com/v1/mandates",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'customer_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'max_amount' => 123,
'currency' => '<string>',
'subscription_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'vpa' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://billing.example.com/v1/mandates"
payload := strings.NewReader("{\n \"customer_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"max_amount\": 123,\n \"currency\": \"<string>\",\n \"subscription_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"vpa\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://billing.example.com/v1/mandates")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"customer_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"max_amount\": 123,\n \"currency\": \"<string>\",\n \"subscription_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"vpa\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://billing.example.com/v1/mandates")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"customer_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"max_amount\": 123,\n \"currency\": \"<string>\",\n \"subscription_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"vpa\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"mandate": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"tenant_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"customer_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"subscription_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"mandate_type": "<string>",
"payment_method": "<string>",
"vpa": "<string>",
"razorpay_token_id": "<string>",
"razorpay_subscription_id": "<string>",
"razorpay_customer_id": "<string>",
"max_amount": 123,
"frequency": "weekly",
"status": "created",
"authorized_at": "2023-11-07T05:31:56Z",
"activated_at": "2023-11-07T05:31:56Z",
"revoked_at": "2023-11-07T05:31:56Z",
"last_debit_at": "2023-11-07T05:31:56Z",
"next_debit_at": "2023-11-07T05:31:56Z",
"pre_debit_notified": true,
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
},
"auth_url": "<string>"
}{
"error": {
"code": "BAD_REQUEST",
"message": "<string>"
}
}{
"error": {
"code": "BAD_REQUEST",
"message": "<string>"
}
}Body Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
customer_id | string (UUID) | Yes | The ID of the customer to create the mandate for. |
subscription_id | string | No | Associate the mandate with a specific subscription. |
vpa | string | Yes | The customer’s UPI Virtual Payment Address (e.g. user@upi). |
max_amount | integer (int64) | Yes | Maximum debit amount per cycle in smallest currency unit (paise). Must be greater than 0. |
frequency | string | Yes | Debit frequency. One of weekly, monthly, quarterly, or yearly. |
Example Request
curl -X POST https://api.recurso.dev/v1/mandates \
-H "Authorization: Bearer rsk_live_xxx" \
-H "Content-Type: application/json" \
-d '{
"customer_id": "cust_a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"subscription_id": "sub_9f8e7d6c5b4a3210",
"vpa": "rajesh.kumar@okicici",
"max_amount": 99900,
"frequency": "monthly"
}'
Response
Returns the newly created mandate object withstatus set to created.
{
"id": "mdt_7a6b5c4d3e2f1098",
"object": "mandate",
"customer_id": "cust_a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"subscription_id": "sub_9f8e7d6c5b4a3210",
"vpa": "rajesh.kumar@okicici",
"max_amount": 99900,
"frequency": "monthly",
"status": "created",
"umn": "UMN-202606231015-ABCDEF",
"mandate_url": "https://api.recurso.dev/v1/mandates/mdt_7a6b5c4d3e2f1098/authorize",
"valid_from": "2026-06-23T00:00:00Z",
"valid_until": "2031-06-23T00:00:00Z",
"created_at": "2026-06-23T10:15:30Z",
"updated_at": "2026-06-23T10:15:30Z"
}
After creating the mandate, redirect the customer to the
mandate_url to complete
authorization via their UPI app. The mandate status will transition from created
to authorized once the customer approves.Errors
| Status | Code | When | Fix |
|---|---|---|---|
400 | validation_failed | Malformed body: positive max_amount and a frequency of weekly/monthly/quarterly/yearly are required; currency, if sent, must be a valid ISO code | Correct the payload |
400 | validation_failed | customer_id or subscription_id is not a valid UUID | Use the object UUIDs, not display codes |
400 | validation_failed | vpa is required for a UPI mandate — UPI (INR) mandates need the customer’s VPA; bank-debit mandates authorize on the gateway’s hosted page instead | Send vpa for INR mandates |
400 | validation_failed | customer phone number is required for a UPI mandate | Add a phone number to the customer record first |
401 | unauthorized | Missing or invalid API key | Send Authorization: Bearer $API_KEY |
500 | internal_error | Customer lookup failed or the gateway (Razorpay / GoCardless) rejected the mandate | Verify the customer exists and the gateway connection is configured for the right mode |
Authorizations
Tenant API key obtained from POST /auth/register or POST /v1/developer/keys.
Body
application/json
Maximum per-debit amount in the lowest currency unit.
Available options:
weekly, monthly, quarterly, yearly Mandate rail. Empty/INR = Razorpay UPI AutoPay; an overridden currency (e.g. EUR) = bank debit via GoCardless. VPA is only required for INR.
Required string length:
3Customer UPI VPA (e.g. name@bank).
⌘I
Create a UPI Autopay mandate
curl --request POST \
--url https://billing.example.com/v1/mandates \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"customer_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"max_amount": 123,
"currency": "<string>",
"subscription_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"vpa": "<string>"
}
'import requests
url = "https://billing.example.com/v1/mandates"
payload = {
"customer_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"max_amount": 123,
"currency": "<string>",
"subscription_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"vpa": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
customer_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
max_amount: 123,
currency: '<string>',
subscription_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
vpa: '<string>'
})
};
fetch('https://billing.example.com/v1/mandates', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://billing.example.com/v1/mandates",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'customer_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'max_amount' => 123,
'currency' => '<string>',
'subscription_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'vpa' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://billing.example.com/v1/mandates"
payload := strings.NewReader("{\n \"customer_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"max_amount\": 123,\n \"currency\": \"<string>\",\n \"subscription_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"vpa\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://billing.example.com/v1/mandates")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"customer_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"max_amount\": 123,\n \"currency\": \"<string>\",\n \"subscription_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"vpa\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://billing.example.com/v1/mandates")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"customer_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"max_amount\": 123,\n \"currency\": \"<string>\",\n \"subscription_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"vpa\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"mandate": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"tenant_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"customer_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"subscription_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"mandate_type": "<string>",
"payment_method": "<string>",
"vpa": "<string>",
"razorpay_token_id": "<string>",
"razorpay_subscription_id": "<string>",
"razorpay_customer_id": "<string>",
"max_amount": 123,
"frequency": "weekly",
"status": "created",
"authorized_at": "2023-11-07T05:31:56Z",
"activated_at": "2023-11-07T05:31:56Z",
"revoked_at": "2023-11-07T05:31:56Z",
"last_debit_at": "2023-11-07T05:31:56Z",
"next_debit_at": "2023-11-07T05:31:56Z",
"pre_debit_notified": true,
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
},
"auth_url": "<string>"
}{
"error": {
"code": "BAD_REQUEST",
"message": "<string>"
}
}{
"error": {
"code": "BAD_REQUEST",
"message": "<string>"
}
}