Skip to content

create-customer-mandate

Method: POST
Path: /customers/{customer_id}/mandates

Tags: Customers

Summary

Create mandate

Description

Create a new mandate for a given customer.

Storefront SDK Usage

SDK Method: sdk.customer.createMandate()

Example:

typescript
const { data, error } = await sdk.customer.createMandate({
  payment_method_type: "NB",
  payment_method: "JP_HDFC",
  service_provider_slug: "juspay",
  gateway_reference_id: "gtw_ref_01H9XYZ",
  bank_ifsc: "HDFC0001234",
  bank_account_number: "123456789012",
  bank_beneficiary_name: "Jane Doe"
});

if (error) {
  console.error("Failed to create mandate:", error);
  return;
}

console.log("Mandate created:", data.mandate);

TypeScript Definition

typescript
"create-customer-mandate": {
        parameters: {
            query?: never;
            header?: never;
            path: {
                /** @description Customer Id */
                customer_id: string;
            };
            cookie?: never;
        };
        /** @description payload for new mandate */
        requestBody: {
            content: {
                "application/json": components["schemas"]["CreateCustomerMandate"];
            };
        };
        responses: {
            /** @description OK */
            200: {
                headers: {
                    [name: string]: unknown;
                };
                content: {
                    "application/json": {
                        message: string;
                        success: boolean;
                        content: {
                            mandate: components["schemas"]["CustomerMandate"];
                        };
                    };
                };
            };
            400: components["responses"]["BadRequest"];
            401: components["responses"]["Unauthorized"];
            404: components["responses"]["NotFound"];
        };
    };

Component References

ReferenceResolves To
components["schemas"]["CreateCustomerMandate"]CreateCustomerMandate
components["schemas"]["CustomerMandate"]CustomerMandate
components["responses"]["BadRequest"]BadRequest
components["responses"]["Unauthorized"]Unauthorized
components["responses"]["NotFound"]NotFound

Request Body

payload for new mandate

Content Types: application/json

Responses

200

OK

400

Bad request

401

Not authorized for given operation on the Resource

404

Requested resource not found

OpenAPI Definition

json
{
  "tags": [
    "Customers"
  ],
  "operationId": "create-customer-mandate",
  "summary": "Create mandate",
  "description": "Create a new mandate for a given customer.",
  "externalDocs": {
    "url": "https://llm-docs.commercengine.io/storefront/operations/create-customer-mandate",
    "description": "API reference for the create-customer-mandate operation"
  },
  "requestBody": {
    "description": "payload for new mandate",
    "required": true,
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/CreateCustomerMandate"
        }
      }
    }
  },
  "responses": {
    "200": {
      "description": "OK",
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "required": [
              "message",
              "success",
              "content"
            ],
            "properties": {
              "message": {
                "type": "string"
              },
              "success": {
                "type": "boolean"
              },
              "content": {
                "properties": {
                  "mandate": {
                    "$ref": "#/components/schemas/CustomerMandate"
                  }
                },
                "required": [
                  "mandate"
                ],
                "type": "object"
              }
            }
          }
        }
      }
    },
    "400": {
      "$ref": "#/components/responses/BadRequest"
    },
    "401": {
      "$ref": "#/components/responses/Unauthorized"
    },
    "404": {
      "$ref": "#/components/responses/NotFound"
    }
  },
  "security": [
    {
      "Authorization": []
    }
  ],
  "x-speakeasy-group": "customers",
  "x-speakeasy-ignore": false,
  "x-speakeasy-name-override": "createCustomerMandate"
}

Auto-generated from OpenAPI spec and TypeScript definitions

Last updated: