---
updatedAt: 2025-09-30T15:27:43.000Z
agentTools:
  projectIndex: https://docs.nexiopay.com/llms.txt
---

# Save card token with iframe

Returns an iframe that can be used to securely save a token for a credit or debit card. You can later use this card token to run a card transaction using the [Run card transaction with iframe](ref:runcardtransactioniframe) or [Run card transaction](ref:runcardtransaction) endpoint.

Card tokens can be used to process transactions through any MID on your account. They are not restricted to a specific merchant account or currency.

For instructions on how to implement this endpoint, see the recipes (listed below) or see [Creating a save card page with the iframe](doc:creating-a-save-card-page-with-the-iframe). 

For a tutorial about running a transaction with the saved card token, see the [Creating a card checkout page with the iframe](doc:creating-a-card-checkout-page-with-the-iframe), [Creating a card checkout page with your own form](doc:creating-a-card-checkout-page-with-your-own-form), or [Running a card transaction with the API](doc:running-a-card-transaction-with-the-api) topic.

<!-- theme: warning -->
> ⚠️ Try It
> 
> To use the Try It feature for this endpoint, you must first request a [one-time-use token](ref:createonetimeusetoken). The system uses the processing and UI options sent in that request for the display and functionality of the iframe.


<div style="display:none;">

## Request parameters
- shouldReturnHtml
- token

## Response parameters
- HTML form

</div>

# OpenAPI definition

```json
{
  "openapi": "3.0.0",
  "info": {
    "title": "Payments API Reference",
    "version": "3.0.0",
    "description": "Payments are how you interact with customers for all kinds of payment methods and types. \n\nUse the `pay` endpoints to generate one-time-use tokens and to accept web-based payments from cards and echecks (ACH) as well as retail payments from terminals or online forms. For more information about these workflows, see the [Getting started with ecommerce](doc:getting-started-with-ecommerce) and [Getting started with retail](doc:getting-started-with-retail) topics in Guides.\n\nAccess the `auth` endpoint to create a simple login that allows trusted users to proceed directly to the retail/MOTO iframe. For a tutorial, see [Using simple login for authentication](using-simple-login-for-authentication) in Guides.\n\nWork with payment billing for subscriptions and payment plans with the `subscriptions` endpoint. For additional information on using these endpoints, see the [Getting started with subscriptions](doc:getting-started-with-subscriptions) and [Getting started with pay plans](doc:getting-started-with-pay-plans) topics in Guides.\n\nThe `apm` endpoint allows you to generate one-time-use tokens and perform the various payment tasks for alternative payment methods. For workflows, integration guides, and tutorials, see the [Payment Methods](doc:payment-methods) documentation.",
    "contact": {
      "name": "Integrations Support",
      "email": "integrations@nexiopay.com",
      "url": "https://nexiointegrations.slack.com/"
    },
    "license": {
      "name": "ISC",
      "url": "https://docs.nexiopay.com/page/license"
    }
  },
  "security": [
    {
      "Basic_Authentication": []
    },
    {
      "One-time-use_Token": []
    }
  ],
  "servers": [
    {
      "description": "Sandbox",
      "url": "https://api.nexiopaysandbox.com",
      "variables": {}
    }
  ],
  "components": {
    "securitySchemes": {
      "Basic_Authentication": {
        "type": "http",
        "scheme": "basic",
        "description": "Basic authentication is a simple authentication scheme built into the HTTP protocol. \n\nFor the \"Try It\" feature, type your API username and password in the appropriate fields. The system then automatically creates the Authorization header that contains the word `Basic` followed by a space and a base64-encoded string `username:password`. \n\nFor example: `Authorization: Basic ZGVtbzpwQDU1dzByZA==` \n\nFor your own requests, learn how to do the conversion in the [Authentication](doc:authentication#basic-authentication) guide. \n\nFor more information about this security protocol, see https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#basic-authentication-sample"
      },
      "One-time-use_Token": {
        "type": "apiKey",
        "name": "token",
        "in": "query",
        "description": "The one-time-use token authentication scheme requires a token supplied in the named query parameter that can only be used to submit a single API request and that expires after one hour. \n\nFor the \"Try It\" feature, first generate the one-time-use token through either the [Create one-time-use token](ref:createonetimeusetoken) or the [Create APM one-time-use token](ref:createapmonetimeusetoken) endpoint. Copy the resulting token and then paste it in the appropriate field for the current endpoint. \n\nFor your own requests, learn how to generate the one-time-use token in the [Authentication](doc:authentication#one-time-use-tokens) guide. Then, use it as normal for this endpoint. \n\nFor more information about the \"apiKeys\" security protocol, see https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#security-scheme-object"
      }
    },
    "responses": {
      "401": {
        "description": "Unauthorized.\n\nFor help with this error and other error codes, see [Common errors](doc:common-errors) in the Guides area.",
        "content": {
          "application/json": {
            "schema": {
              "type": "object",
              "properties": {
                "error": {
                  "type": "integer",
                  "example": 440,
                  "description": "Indicates the Nexio error code, if applicable."
                },
                "message": {
                  "type": "string",
                  "description": "A message from Nexio about the state of the request.",
                  "example": "Unauthorized"
                }
              }
            }
          }
        }
      }
    },
    "parameters": {
      "shouldReturnHtml": {
        "name": "shouldReturnHtml",
        "in": "query",
        "required": false,
        "schema": {
          "type": "string",
          "default": "false",
          "example": "true"
        },
        "description": "By default, a success response always returns HTML. However, when there is an error with the request, the system returns a JSON object to the iframe and a 400 error. In order to get HTML for errors also, include this parameter and set the value to `true` in order to force the system to return the response as HTML. Since a success response is also HTML, setting this to `true` can make handling error situations easier. Otherwise, you need to create a listener for the JSON object and a 400 error response. For more information, see [Handling errors and declines](doc:handling-errors-and-declines) in Guides."
      }
    }
  },
  "tags": [
    {
      "name": "Ecommerce",
      "description": "APIs for ecommerce payments"
    }
  ],
  "paths": {
    "/pay/v3/saveCard": {
      "get": {
        "description": "Returns an iframe that can be used to securely save a token for a credit or debit card. You can later use this card token to run a card transaction using the [Run card transaction with iframe](ref:runcardtransactioniframe) or [Run card transaction](ref:runcardtransaction) endpoint.\n\nCard tokens can be used to process transactions through any MID on your account. They are not restricted to a specific merchant account or currency.\n\nFor instructions on how to implement this endpoint, see the recipes (listed below) or see [Creating a save card page with the iframe](doc:creating-a-save-card-page-with-the-iframe). \n\nFor a tutorial about running a transaction with the saved card token, see the [Creating a card checkout page with the iframe](doc:creating-a-card-checkout-page-with-the-iframe), [Creating a card checkout page with your own form](doc:creating-a-card-checkout-page-with-your-own-form), or [Running a card transaction with the API](doc:running-a-card-transaction-with-the-api) topic.\n\n<!-- theme: warning -->\n> ⚠️ Try It\n> \n> To use the Try It feature for this endpoint, you must first request a [one-time-use token](ref:createonetimeusetoken). The system uses the processing and UI options sent in that request for the display and functionality of the iframe.\n\n\n<div style=\"display:none;\">\n\n## Request parameters\n- shouldReturnHtml\n- token\n\n## Response parameters\n- HTML form\n\n</div>",
        "operationId": "SaveCardTokenIframe",
        "tags": [
          "Ecommerce"
        ],
        "parameters": [
          {
            "in": "query",
            "name": "token",
            "description": "Your [one-time-use token](ref:createonetimeusetoken). The system uses the processing and UI options sent in that request for the display and functionality of the iframe.",
            "schema": {
              "type": "string",
              "example": "830d36f6-a5e3-4455-9600-3a55b63e2fc2"
            },
            "required": true
          },
          {
            "$ref": "#/components/parameters/shouldReturnHtml"
          }
        ],
        "security": [],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "string",
                  "example": "<html>A save card form</html>"
                },
                "examples": {
                  "Example response": {
                    "value": "<form id=\"paymentForm\" class=\"loaded\"> <fieldset class=\"fieldSet\"> <legend class=\"legend \">Card Information</legend> <div class=\"formRow\"> <span class=\"label\"> <span class=\"requiredField\">*</span>Name <span class=\"labelSeparator\">:</span> <span class=\"grey\">(as it appears on card)</span> </span> <span id=\"cardHolderNameValidation\" class=\"validation\">Required</span> <span id=\"cardHolderNameSanitation\" class=\"validation\">Field cannot contain credit card number</span> <input class=\"textBox\" id=\"cardHolderName\" name=\"cardHolderName\" type=\"text\" value=\"Default Test\"> </div> <div class=\"formRow\"> <span class=\"label\"> <span class=\"requiredField\">*</span>Card Number <span class=\"labelSeparator\">:</span> </span> <span id=\"ccNumberValidation\" class=\"validation\">Card number is invalid</span> <span id=\"ccCardTypeValidation\" class=\"validation\">We only accept Visa, MC, JCB, Discover, or Amex</span> <input class=\"textBox\" id=\"ccNumber\" name=\"ccNumber\" type=\"tel\"> </div> <div class=\"formRow\"> <span class=\"label\"> <span class=\"requiredField\">*</span>Expiration Date <span class=\"labelSeparator\">:</span> </span> <span id=\"expirationValidation\" class=\"validation\">Select a date in the future</span> <br> <select class=\"dropDown month\" id=\"expirationMonth\" name=\"expirationMonth\" required=\"true\" title=\"\"> <option value=\"1\">Jan-01</option> <option value=\"2\">Feb-02</option> <option value=\"3\">Mar-03</option> <option value=\"4\">Apr-04</option> <option value=\"5\">May-05</option> <option value=\"6\">Jun-06</option> <option value=\"7\">Jul-07</option> <option value=\"8\">Aug-08</option> <option value=\"9\">Sep-09</option> <option value=\"10\">Oct-10</option> <option value=\"11\">Nov-11</option> <option value=\"12\">Dec-12</option> </select>&nbsp;/&nbsp; <select class=\"year dropDown\" id=\"expirationYear\" name=\"expirationYear\" required=\"true\" title=\"\"> <option selected=\"\" value=\"2022\">2022</option> <option value=\"2023\">2023</option> <option value=\"2024\">2024</option> <option value=\"2025\">2025</option> <option value=\"2026\">2026</option> <option value=\"2027\">2027</option> <option value=\"2028\">2028</option> <option value=\"2029\">2029</option> <option value=\"2030\">2030</option> <option value=\"2031\">2031</option> <option value=\"2032\">2032</option> <option value=\"2033\">2033</option> <option value=\"2034\">2034</option> <option value=\"2035\">2035</option> <option value=\"2036\">2036</option> <option value=\"2037\">2037</option> <option value=\"2038\">2038</option> <option value=\"2039\">2039</option> <option value=\"2040\">2040</option> <option value=\"2041\">2041</option> <option value=\"2042\">2042</option> </select> </div> <div class=\"formRow\"> <span class=\"label\"> <span class=\"requiredField\">*</span>Security Code <span class=\"labelSeparator\">:</span> </span> <span id=\"securityCodeValidation\" class=\"validation\">Security code is invalid, must be 3-4 digits</span> <input class=\"textBox\" id=\"securityCode\" name=\"securityCode\" type=\"text\"> </div> </fieldset> <fieldset class=\"fieldSet\"> <legend class=\"\">Billing Information</legend> <div class=\"formRow\"> <span class=\"label\"> <span class=\"requiredField\">*</span>Country<span class=\"labelSeparator\">:</span> </span> <select class=\"dropDown\" id=\"billToCountry\" name=\"billToCountry\"> <option value=\"CA\">Canada</option><option value=\"MX\">Mexico</option><option value=\"GB\">United Kingdom</option><option selected=\"selected\" value=\"US\">United States</option> </select> <span id=\"countryValidation\" class=\"validation\">Required</span> <span id=\"countrySanitation\" class=\"validation\">Field cannot contain credit card number</span> </div> <div class=\"formRow\"> <span class=\"label\"> <span class=\"requiredField\">*</span>Address 1<span class=\"labelSeparator\">:</span> </span> <span id=\"addressValidation\" class=\"validation\">Required</span> <span id=\"addressSanitation\" class=\"validation\">Field cannot contain credit card number</span> <input class=\"textBox\" id=\"billToAddressOne\" name=\"billToAddressOne\" type=\"text\" value=\"123 Test St\"> </div> <div class=\"formRow\"> <span class=\"label\"> <span class=\"field\">Address 2<span class=\"labelSeparator\">:</span></span> </span> <span id=\"billToAddressTwoSanitation\" class=\"validation\">Field cannot contain credit card number</span> <input class=\"textBox\" id=\"billToAddressTwo\" name=\"billToAddressTwo\" type=\"text\" value=\"Suite 123\"> </div> <div class=\"formRow\"> <span class=\"label\"> <span class=\"requiredField\">*</span>City<span class=\"labelSeparator\">:</span> </span> <span id=\"cityValidation\" class=\"validation\">Required</span> <span id=\"citySanitation\" class=\"validation\">Field cannot contain credit card number</span> <input class=\"textBox\" id=\"billToCity\" name=\"billToCity\" title=\"\" type=\"text\" value=\"Testerville\"> </div> <div class=\"formRow\"> <span class=\"label\"> <span class=\"requiredField\">*</span>State / Province<span class=\"labelSeparator\">:</span> </span> <span id=\"stateValidation\" class=\"validation\">Required</span> <span id=\"stateSanitation\" class=\"validation\">Field cannot contain credit card number</span> <input class=\"textBox hidden\" id=\"billToStateInput\" name=\"billToStateInput\" title=\"\" type=\"text\" value=\"UT\"> <select id=\"billToStateDropdown\" name=\"billToState\" class=\"dropDown\"> <option value=\"AK\">AK - Alaska</option><option value=\"AL\">AL - Alabama</option><option value=\"AR\">AR - Arkansas</option><option value=\"AZ\">AZ - Arizona</option><option value=\"CA\">CA - California</option><option value=\"CO\">CO - Colorado</option><option value=\"CT\">CT - Connecticut</option><option value=\"DC\">DC - District of Columbia</option><option value=\"DE\">DE - Delaware</option><option value=\"FL\">FL - Florida</option><option value=\"GA\">GA - Georgia</option><option value=\"GU\">GU - Guam</option><option value=\"HI\">HI - Hawaii</option><option value=\"IA\">IA - Iowa</option><option value=\"ID\">ID - Idaho</option><option value=\"IL\">IL - Illinois</option><option value=\"IN\">IN - Indiana</option><option value=\"KS\">KS - Kansas</option><option value=\"KY\">KY - Kentucky</option><option value=\"LA\">LA - Louisiana</option><option value=\"MA\">MA - Massachusetts</option><option value=\"MD\">MD - Maryland</option><option value=\"ME\">ME - Maine</option><option value=\"MI\">MI - Michigan</option><option value=\"MN\">MN - Minnesota</option><option value=\"MO\">MO - Missouri</option><option value=\"MS\">MS - Mississippi</option><option value=\"MT\">MT - Montana</option><option value=\"NC\">NC - North Carolina</option><option value=\"ND\">ND - North Dakota</option><option value=\"NE\">NE - Nebraska</option><option value=\"NH\">NH - New Hampshire</option><option value=\"NJ\">NJ - New Jersey</option><option value=\"NM\">NM - New Mexico</option><option value=\"NV\">NV - Nevada</option><option value=\"NY\">NY - New York</option><option value=\"OH\">OH - Ohio</option><option value=\"OK\">OK - Oklahoma</option><option value=\"OR\">OR - Oregon</option><option value=\"PA\">PA - Pennsylvania</option><option value=\"PR\">PR - Puerto Rico</option><option value=\"RI\">RI - Rhode Island</option><option value=\"SC\">SC - South Carolina</option><option value=\"SD\">SD - South Dakota</option><option value=\"TN\">TN - Tennessee</option><option value=\"TX\">TX - Texas</option><option selected=\"selected\" value=\"UT\">UT - Utah</option><option value=\"VA\">VA - Virginia</option><option value=\"VT\">VT - Vermont</option><option value=\"WA\">WA - Washington</option><option value=\"WI\">WI - Wisconsin</option><option value=\"WV\">WV - West Virginia</option><option value=\"WY\">WY - Wyoming</option><option value=\"AS\">AS - American Samoa</option><option value=\"VI\">VI - Virgin Islands</option><option value=\"AA\">AA - Armed Forces Americas</option><option value=\"AE\">AE - Armed Forces Europe</option><option value=\"AP\">AP - Armed Forces Pacific</option> </select> </div> <div class=\"formRow\"> <span class=\"label\"> <span class=\"requiredField\">*</span>Postal Code<span class=\"labelSeparator\">:</span> <span id=\"postalValidation\" class=\"validation\">Required</span> <span id=\"postalSanitation\" class=\"validation\">Field cannot contain credit card number</span> </span> <input class=\"textBox\" maxlength=\"10\" id=\"billToPostal\" name=\"billToPostal\" type=\"text\" value=\"12345\"> </div> </fieldset> <div class=\"submitButtonWrapper\"> <button id=\"submitButton\" class=\"hidden\" type=\"submit\" disabled=\"\">Submit</button> </div> </form>"
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/401"
          }
        },
        "summary": "Save card token with iframe"
      }
    }
  }
}
```