---
title: Cancel customer payment method switches
slug: reference/cancel-customer-payment-method-switches
docTags: 
createdAt: 2025-08-21T21:09:26.155Z
---

{
  "id": "f8rI48dn5lSR4nW8uTSYD",
  "type": "api-oas-v2",
  "data": {
    "method": "DELETE",
    "url": "https://app.amberflo.io/customers/payment-method/switch",
    "servers": [
      {
        "url": "https://app.amberflo.io/customers/payment-method/switch"
      }
    ],
    "name": "Cancel customer payment method switches",
    "description": "<p>Cancels all current and future payment method switches scheduled for a customer at or after the specified time.\nUse this endpoint to abort payment provider transitions and revert to current billing configuration.</p>\n<p>Use this endpoint to:</p>\n<ul>\n<li>Cancel scheduled payment method switches before they take effect</li>\n<li>Abort payment provider transitions due to business changes</li>\n<li>Clean up failed or incorrect switch configurations</li>\n<li>Revert customers to their current payment method</li>\n</ul>",
    "contentType": "application/json",
    "request": {
      "pathParameters": [],
      "headerParameters": [],
      "queryParameters": [
        {
          "kind": "required",
          "name": "customerId",
          "type": "string",
          "example": "customer_123",
          "description": "Unique identifier of the customer whose payment method switches should be canceled.\n"
        },
        {
          "kind": "required",
          "name": "switchTimeInSeconds",
          "type": "integer<int64>",
          "example": 1703980800,
          "description": "<p>Unix timestamp (in seconds) specifying the cutoff time for switch cancellation.\nAll switches scheduled at or after this time will be canceled.</p>"
        }
      ],
      "bodyDataParameters": [],
      "formDataParameters": [],
      "oAuthParameters": [
        {
          "id": "apiKey",
          "name": "X-API-KEY",
          "kind": "optional",
          "type": "apiKey",
          "in": "header"
        }
      ]
    },
    "responses": [
      {
        "statusCode": "200",
        "description": "Successfully canceled payment method switches and returns array of affected switch records",
        "jsonExample": "",
        "isExpanded": true,
        "schema": [
          {
            "kind": "optional",
            "type": "array",
            "description": "Customer payment method switch configuration defining the scheduled transition from one billing system to another, including audit timestamps and execution status for payment provider migration tracking.",
            "customType": "customer.payment_method.CustomerPaymentMethodSwitch.out[]",
            "schema": [
              {
                "name": "customerId",
                "kind": "required",
                "type": "string",
                "description": "Unique customer identifier for whom the payment method switch configuration applies and payment transitions will be executed.",
                "example": ""
              },
              {
                "name": "sourcePaymentType",
                "kind": "optional",
                "type": "string",
                "description": "Current billing system enumeration indicating the payment provider platform being transitioned away from during the switch operation.",
                "modelRef": "#/components/schemas/customer.payment_method.BillingSystem.in",
                "customType": "customer.payment_method.BillingSystem.in",
                "schema": []
              },
              {
                "name": "sourcePaymentId",
                "kind": "optional",
                "type": "string",
                "description": "Payment provider connection identifier currently active before the switch, referencing existing billing system configuration and account settings.",
                "example": ""
              },
              {
                "name": "targetPaymentType",
                "kind": "required",
                "type": "string",
                "description": "Target billing system enumeration specifying the destination payment provider platform to activate after the scheduled switch execution.",
                "modelRef": "#/components/schemas/customer.payment_method.BillingSystem.in",
                "customType": "customer.payment_method.BillingSystem.in",
                "schema": []
              },
              {
                "name": "targetPaymentId",
                "kind": "required",
                "type": "string",
                "description": "Payment provider connection identifier for the new billing system, referencing target account payment settings and integration configurations.",
                "example": ""
              },
              {
                "name": "targetCustomerIdentifier",
                "kind": "required",
                "type": "string",
                "description": "Customer-specific identifier within the target payment provider system, enabling billing operations and payment processing in the destination platform.",
                "example": ""
              },
              {
                "name": "switchTimeInSeconds",
                "kind": "required",
                "type": "integer<int64>",
                "description": "Unix timestamp in seconds defining the exact moment when payment provider transition activates, evaluated against invoice start times.",
                "example": 0
              },
              {
                "name": "createdTimeInSeconds",
                "kind": "optional",
                "type": "integer<int64>",
                "description": "Unix timestamp in seconds recording when the payment method switch configuration was initially created and stored in the system.",
                "example": 0
              },
              {
                "name": "updatedTimeInSeconds",
                "kind": "optional",
                "type": "integer<int64>",
                "description": "Unix timestamp in seconds tracking the most recent modification to the payment method switch configuration for audit and versioning purposes.",
                "example": 0
              }
            ],
            "modelRef": "#/components/schemas/customer.payment_method.CustomerPaymentMethodSwitch.out",
            "isExpanded": true
          }
        ]
      },
      {
        "statusCode": "400",
        "description": "Invalid customer ID format, invalid timestamp, or malformed request parameters",
        "jsonExample": "",
        "isExpanded": true
      },
      {
        "statusCode": "401",
        "description": "Authentication required or invalid API key provided",
        "jsonExample": "",
        "isExpanded": true
      },
      {
        "statusCode": "403",
        "description": "Insufficient permissions to modify customer payment method switches",
        "jsonExample": "",
        "isExpanded": true
      },
      {
        "statusCode": "404",
        "description": "Customer not found or no payment method switches scheduled for cancellation",
        "jsonExample": "",
        "isExpanded": true
      },
      {
        "statusCode": "500",
        "description": "Internal server error occurred while canceling payment method switches",
        "jsonExample": "",
        "isExpanded": true
      }
    ],
    "hasXCodeSamples": false,
    "examples": {
      "languages": [
        {
          "id": "73mTLToUYEVF_T6CZ3zZE",
          "language": "curl",
          "label": "cURL",
          "code": "curl --request DELETE \\\n     --url 'https://app.amberflo.io/customers/payment-method/switch?customerId=customer_123&switchTimeInSeconds=1703980800' \\\n     --header 'accept: application/json'"
        },
        {
          "id": "xax3vltdWD-kaR-YWLH4S",
          "language": "javascript",
          "label": "javascript",
          "code": "var myHeaders = new Headers();\nmyHeaders.append(\"accept\", \"application/json\");\nmyHeaders.append(\"content-type\", \"application/json\");\n\nvar requestOptions = {\n   method: 'DELETE',\n   headers: myHeaders,\n   redirect: 'follow'\n};\n\nfetch(\"https://app.amberflo.io/customers/payment-method/switch?customerId=customer_123&switchTimeInSeconds=1703980800\", requestOptions)\n   .then(response => response.text())\n   .then(result => console.log(result))\n   .catch(error => console.log('error', error));"
        },
        {
          "id": "jhPHVLByn4HbPc0L_An11",
          "language": "ruby",
          "label": "Ruby",
          "code": "require \"uri\"\nrequire \"json\"\nrequire \"net/http\"\n\nurl = URI(\"https://app.amberflo.io/customers/payment-method/switch?customerId=customer_123&switchTimeInSeconds=1703980800\")\n\nhttps = Net::HTTP.new(url.host, url.port)\nhttps.use_ssl = true\n\nrequest = Net::HTTP::Delete.new(url)\nrequest[\"accept\"] = \"application/json\"\nrequest[\"content-type\"] = \"application/json\"\n\nresponse = https.request(request)\nputs response.read_body\n"
        },
        {
          "id": "Xx9K_OqI7ecjrHMALDN5e",
          "language": "python",
          "label": "Python",
          "code": "import requests\nimport json\n\nurl = \"https://app.amberflo.io/customers/payment-method/switch?customerId=customer_123&switchTimeInSeconds=1703980800\"\n\npayload = {}\nheaders = {\n   'accept': 'application/json',\n   'content-type': 'application/json'\n}\n\nresponse = requests.request(\"DELETE\", url, headers=headers, data=payload)\n\nprint(response.text)\n"
        }
      ],
      "selectedLanguageId": "73mTLToUYEVF_T6CZ3zZE"
    },
    "results": {
      "languages": [
        {
          "id": "response-0-200",
          "language": "200",
          "code": "// Successfully canceled payment method switches and returns array of affected switch records\n[\n  {\n    \"customerId\": \"\",\n    \"sourcePaymentType\": \"\",\n    \"sourcePaymentId\": \"\",\n    \"targetPaymentType\": \"\",\n    \"targetPaymentId\": \"\",\n    \"targetCustomerIdentifier\": \"\",\n    \"switchTimeInSeconds\": \"\",\n    \"createdTimeInSeconds\": \"\",\n    \"updatedTimeInSeconds\": \"\"\n  }\n]"
        },
        {
          "id": "response-1-400",
          "language": "400",
          "code": "// Invalid customer ID format, invalid timestamp, or malformed request parameters\n"
        },
        {
          "id": "response-2-401",
          "language": "401",
          "code": "// Authentication required or invalid API key provided\n"
        },
        {
          "id": "response-3-403",
          "language": "403",
          "code": "// Insufficient permissions to modify customer payment method switches\n"
        },
        {
          "id": "response-4-404",
          "language": "404",
          "code": "// Customer not found or no payment method switches scheduled for cancellation\n"
        },
        {
          "id": "response-5-500",
          "language": "500",
          "code": "// Internal server error occurred while canceling payment method switches\n"
        }
      ],
      "selectedLanguageId": "response-0-200"
    }
  },
  "children": [
    {
      "text": ""
    }
  ]
}