> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://beta-docs.payabli.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://beta-docs.payabli.com/_mcp/server.

# EmbeddedMethod UI

Use the EmbeddedMethod component to capture a payment method or make a sale using any payment method. This is the most flexible and customizable component Payabli offers to developers. To see a working example of this component, go to [CodePen](https://codepen.io/payablidocs/pen/JjwezWa).

![](/_fern-img/84bdbd1b189e9a1684b3739a4248398da93df33f55e6cb802739b69b46e3264e.webp)\


> **Tip**
>
> This component is supported in the Playground. Use the [Embedded Component Playground](https://playground.payabli.com) to edit and design embedded components in real time, and export the code to use in your own site or app.

## Usage

> **Info**
>
> See [Library URLs](/developer-guides/embedded-components-overview#library-urls) for important information about embedded components library URLs.

### Step 1: Include the Payabli component

Add the script to the `<body>` element of your HTML.

**`Sandbox`**

```html Sandbox
<!DOCTYPE html>
<html>
  <head>
    <meta charset="UTF-8">
  </head>
  <body>
    <script src="https://embedded-component-sandbox.payabli.com/component.js" data-test></script>
  </body>
</html>
```

> **Note**
>
> You need to include `<meta charset="UTF-8">` in the `<head>` element of your HTML to prevent problems with special characters such as 'á' or 'ñ'.

### Step 2: Define the component container

Add the container to your HTML. This `<div>` tag is where the page renders the component. The ID is the identifier for `rootContainer` in your component configuration.

**`Sandbox`**

```html Sandbox
<!DOCTYPE html>
<html>
  <head>
    <meta charset="UTF-8">
  </head>
  <body>
    <div id="pay-component-1"></div>
    <script src="https://embedded-component-sandbox.payabli.com/component.js" data-test></script>
  </body>
</html>
```

### Step 3: Configure the component

Define the component configuration in a script block immediately after `component.js` and create an instance of the component.

#### Expand for configuration example

[See the Configuration section](/developer-guides/embedded-components-embeddedmethodui#configuration-reference) for a full configuration reference.

**`Card`**

```html Card
<!DOCTYPE html>
<html>
  <head>
    <meta charset="UTF-8">
    <style>
      .hidden {
        display: none;
      }
      #pay-component-1 {
        max-width: 510px;
      }
    </style>
  </head>
  <body>
    <p>When the form is valid, the action button is shown.</p>
    <div id="pay-component-1"></div>
    <button id="btnx" classpath="hidden">Submit</button>
    <script src="https://embedded-component-sandbox.payabli.com/component.js" data-test></script>
    <script>
      document.getElementById("btnx").addEventListener("click", executeAction);
      var payabliConfig0 = {
        type: "methodEmbedded",
        rootContainer: "pay-component-1",
        defaultOpen: "card", //offering only Card method - Embedded UI can only show a payment method
        //customCssUrl: "your url to a custom css file",
        token: "your Payabli API Token", //must be a public token
        entryPoint: "test",
        card: {
          enabled: true,
          amex: true,
          discover: true,
          visa: true,
          mastercard: true,
          jcb: true,
          diners: true,
          fallbackAuth: true,
          inputs: {
            //here we are customizing the input fields
            cardHolderName: {
              label: "NAME ON CARD",
              placeholder: "",
              floating: false,
              value: "John Doe",
              size: 12,
              row: 0,
              order: 0,
            },
            cardNumber: {
              label: "CARD NUMBER",
              placeholder: "1234 1234 1234 1234",
              floating: false,
              size: 6,
              row: 1,
              order: 0,
            },
            cardExpirationDate: {
              label: "EXPIRATION DATE",
              placeholder: "MM/YY",
              floating: false,
              size: 6,
              row: 1,
              order: 1,
            },
            cardCvv: {
              label: "CVV/CVC",
              placeholder: "CVV/CVC",
              floating: false,
              size: 6,
              row: 2,
              order: 0,
            },
            cardZipcode: {
              label: "ZIP/POSTAL CODE",
              placeholder: "ZIP/POSTAL CODE",
              floating: false,
              size: 6,
              row: 2,
              order: 1,
              country: ["us", "ca"],
            },
          },
        },
        ach: {
          enabled: false,
          checking: true,
          savings: true,
        },
        customerData: {
          customerNumber: "00001",
          firstName: "John",
          lastName: "Doe",
          billingEmail: "johndoe@email.com",
        },
      {
        functionCallBackSuccess: function (response) {
          // This callback covers both 2XX and 4XX responses
          console.log(response);
          switch (response.responseText) {
            case "Success":
              // Tokenization was successful
              alert(`Success: ${response.responseData.resultText}`);
              break;
            case "Declined":
              // Transaction or tokenization failed due to processor decline or validation errors
              // Recommend reinitialization of the component so that the user can try again
              // with different card data
              alert(`Declined: ${response.responseData.resultText}`);
              paycomponent0.payabliExec("reinit");
              break;
            default:
              // Other response text. These are normally errors with Payabli internal validations
              // before processor engagement
              // We recommend reinitializing the component.
              // If the problem persists, contact Payabli to help debug
              alert(`Error: ${response.responseText}`);
              paycomponent0.payabliExec("reinit");
              break;
          }
        },
        functionCallBackReady: function (data) {
          //Callback function to capture the ready state of the component.
          //The callback receives an array of booleans with 2 positions: index 0 is for ach, index 1 is for card.
          //In our example we are offering card payment method so we need to verify the position 1 in array "data".
          //When the captured value is "true" we are showing the button to execute the action, when it is "false" we hide it.
          var btn = document.getElementById("btnx");
          if (data[1] === true) {
            btn.classList.remove("hidden");
          } else {
            if (!btn.classList.contains("hidden")) {
              btn.classList.add("hidden");
            }
          }
        },
        functionCallBackError: function (errors) {
          // This callback covers 5XX response or parsing errors
          console.log(errors);
          // We recommend reinitializing the component.
          // If the problem persists, contact Payabli to help debug
          paycomponent0.payabliExec("reinit");
        }
      }
      var paycomponent0 = new PayabliComponent(payabliConfig0);
    </script>

  </body>
</html>
```

**`ACH`**

```html ACH
<!DOCTYPE html>
<html>
  <head>
    <meta charset="UTF-8">
    <style>
      .hidden{
        display:none;
      }
      #pay-component-1{
        max-width: 510px;
      }
      iframe{
        border: solid 1px transparent;
      }
      button {
        background-image: -webkit-linear-gradient(0deg, #7121ff 0%, #21d4fd 100%);
        background-image: -moz-linear-gradient(0deg, #7121ff 0%, #21d4fd 100%);
        background-image: -ms-linear-gradient(0deg, #7121ff 0%, #21d4fd 100%);
        border: none;
        padding: 10px 20px;
        color: #ffffff;
        font-size: 13px;
        cursor: pointer;
        text-transform: uppercase;
        font-weight: bold;
        font-size: 12px;
        padding: 15px 30px;
        border-radius: 5px;
        width: 100%;
        max-width: 510px;
      }
    </style>
  </head>
  <body>
    <p style="font-size:40px;">Payabli Embedded Component Demo</p>
    <p>When the form contents are valid, the action button will be shown.</p>
    <hr/>
    </p>
    <p style="font-size:30px;">Pay Total: $19.99</p>
    </p>
      <div id="pay-component-1"></div>
      <button id="btnx" classpath="hidden">Submit</button>
      <script type="text/javascript" src="https://embedded-component-sandbox.payabli.com/component.js"> //Use the correct version for your environment</script>
      <script>
      document.getElementById("btnx").addEventListener("click", executeAction);
      // Input your Public Organization API Token here:
      var token = "";
      // Input your paypoint entryName here:
      var entryPoint = "";
      var payabliConfig0 = {
        type: "methodEmbedded",
        rootContainer: "pay-component-1",
        defaultOpen: 'ach',  //offering only ACH method - Embedded UI can only show one payment method at a time.
        //customCssUrl: "your url to a custom css file",
        token: token,
        showPopoverError : false,
        temporaryToken: false, //Set to FALSE to create a stored payment method. Used IF payabliExec = 'method'.
        entryPoint: entryPoint,
        ach: {
          enabled: true,
          checking: true,
          savings: true,
          inputs: {
      //customize the ACH input fields
            achAccountHolderName: {
              label: "Holder Name",
              size: 6,
              row: 0,
              order: 0
            },
            achAccountType: {
              label: "Type",
              size: 6,
              row: 0,
              order: 1
            },
            achRouting: {
              label: "Routing Number",
              size: 6,
              row: 1,
              order: 0,
              confirm: true // Displays the field twice, to ensure the fields match
            },
            achAccount: {
              label: "Account Number",
              size: 6,
              row: 1,
              order: 1,
              confirm: true
            }
          }
        },
      {
        functionCallBackSuccess: function (response) {
          // This callback covers both 2XX and 4XX responses
          console.log(response);
          switch (response.responseText) {
            case "Success":
              // Tokenization was successful
              alert(`Success: ${response.responseData.resultText}`);
              break;
            case "Declined":
              // Transaction or tokenization failed due to processor decline or validation errors
              // Recommend reinitialization of the component so that the user can try again
              // with different card data
              alert(`Declined: ${response.responseData.resultText}`);
              paycomponent0.payabliExec("reinit");
              break;
            default:
              // Other response text. These are normally errors with Payabli internal validations
              // before processor engagement
              // We recommend reinitializing the component.
              // If the problem persists, contact Payabli to help debug
              alert(`Error: ${response.responseText}`);
              paycomponent0.payabliExec("reinit");
              break;
          }
        },
        functionCallBackReady: function (data) {
          //Callback function to capture the ready state of the component.
          //The callback receives an array of booleans with 2 positions: index 0 is for ach, index 1 is for card.
          //In our example we are offering card payment method so we need to verify the position 1 in array "data".
          //When the captured value is "true" we are showing the button to execute the action, when it is "false" we hide it.
          var btn = document.getElementById("btnx");
          if (data[1] === true) {
            btn.classList.remove("hidden");
          } else {
            if (!btn.classList.contains("hidden")) {
              btn.classList.add("hidden");
            }
          }
        },
        functionCallBackError: function (errors) {
          // This callback covers 5XX response or parsing errors
          console.log(errors);
          // We recommend reinitializing the component.
          // If the problem persists, contact Payabli to help debug
          paycomponent0.payabliExec("reinit");
        }
      }
        };

      var paycomponent0 = new PayabliComponent(payabliConfig0);
      function executeAction()
      {
        paycomponent0.payabliExec('pay',{
          paymentDetails: {
            totalAmount: 19.99,
            serviceFee: 0,
            categories: [
              {
                label: 'Widget',
                amount: 19.99,
                qty: 1
              }
            ]
          },
        customerData: {
          customerNumber: "123456",
          firstName: "John",
          lastName: "Smith",
          billingEmail: "jsmith@email.com"
          },
        });
      }
      </script>

  </body>
</html>
```

### Step 4: Style the component

Information about styling embedded components is available in [Embedded Components Overview](/developer-guides/embedded-components-overview#customize-component-styling).

### Step 5: Execute an action

You can use the embedded component to execute a payment or to save the payment method. The action is triggered via the `payabliExec` function in the instanced className.
This example calls a JS function named `executeAction` when the component is ready and the user clicks the button.

Learn more about `payabliExec` in the [Embedded Components Overview](/developer-guides/embedded-components-overview#payablicomponent-classname).

#### Expand for code example

**`Calls payabliExec('method')`**

```html Calls payabliExec('method')
  <!DOCTYPE html>
  <html>
  <head>
    <meta charset="UTF-8">
    <style>
      .hidden {
          display: none;
      }
      #pay-component-1 {
          max-width: 510px;
      }
      iframe {
          border: solid 1px transparent;
      }
      button {
          background-image: -webkit-linear-gradient(0deg, #7121ff 0%, #21d4fd 100%);
          background-image: -moz-linear-gradient(0deg, #7121ff 0%, #21d4fd 100%);
          background-image: -ms-linear-gradient(0deg, #7121ff 0%, #21d4fd 100%);
          border: none;
          padding: 15px 30px;
          color: #ffffff;
          font-size: 12px;
          cursor: pointer;
          text-transform: uppercase;
          font-weight: bold;
          border-radius: 5px;
          width: 100%;
          max-width: 510px;
      }
    </style>
  </head>
  <body>
      <p>When the form is valid, the action button will be shown.</p>
      <div id="pay-component-1"></div>
      <button id="btnx" class="hidden">Submit</button>
      <script src="https://embedded-component-sandbox.payabli.com/component.js" data-test></script>
      <script>
          // calling payabliExec('method') stores the payment method when the button is clicked
          document.getElementById("btnx").addEventListener("click", executeAction);
          var token = "o.z8j8aaztW9tUtUg4dlVeYAx+L2MazOFGr0DY8yuK3u79MCYlGK4/q0t5AD1UgLAjXOohnxN8VTZfPswyZcwtChGNn1a8jFMmYWHmLN2cPDW9IrBt1RtrSuu+85HJI+4kML5sIk9SYvULDAU2k0X0E1KFYcPwjmmkUjktrEGtz48XCUM70aKUupkrTh8nL7CXpAXATzVUZ2gEld9jGINwECPPLWmu+cZ4CJb7QMJxnzKFD073+nq/eL+pMth7+u/SkmAWC0+jn8y+Lf6T5Q5PqB6wN7Mvosp8g7U7lbEW2wC0DA92pjblfDHVJOQUkjgT7B1GvryMokLvBjoiaLhKa55iKZE1YDlyqruILkoNF+zGSPS9r17qU6w4ziKhoMdSPzPBJBlLhQhz3MVANXbjfEfJwmtr/JJ1uStUfBFJ710cS1x7goxMJO/cl+q+LVtPy788EKFkgMc5OjfBNCsNL+dBDVbK5CiIJUSbOFzdqdjY/VJ14MEodsHYOwMAjuF4.KRFMeEj0SOur8MLZ362c/UZ/U/Az3CSUkr3/8EVDE6Y=";
          var entryPoint = "bozeman-aikido";
          var payabliConfig0 = {
              type: "methodEmbedded",
              rootContainer: "pay-component-1",
              defaultOpen: 'card',  // offering only Card method - Embedded UI can only show a payment method
              // customCssUrl: "your url to a custom css file",
              token: token,
              entryPoint: entryPoint,
              card: {
                  enabled: true,
                  amex: true,
                  discover: true,
                  visa: true,
                  mastercard: true,
                  jcb: true,
                  diners: true,
                  inputs: {   // here we are customizing the input fields
                      cardHolderName: {
                          label: "NAME ON CARD",
                          placeholder: "",
                          floating: false,
                          value: "John Doe",
                          size: 12,
                          row: 0,
                          order: 0
                      },
                      cardNumber: {
                          label: "CARD NUMBER",
                          placeholder: "1234 1234 1234 1234",
                          floating: false,
                          size: 6,
                          row: 1,
                          order: 0
                      },
                      cardExpirationDate: {
                          label: "EXPIRATION DATE",
                          placeholder: "MM/YY",
                          floating: false,
                          size: 6,
                          row: 1,
                          order: 1
                      },
                      cardCvv: {
                          label: "CVV/CVC",
                          placeholder: "CVV/CVC",
                          floating: false,
                          size: 6,
                          row: 2,
                          order: 0,
                      },
                      cardZipcode: {
                          label: "ZIP/POSTAL CODE",
                          placeholder: "ZIP/POSTAL CODE",
                          floating: false,
                          size: 6,
                          row: 2,
                          order: 1,
                          country: ["us", "ca"],
                      }
                  }
              },
              ach: {
                  enabled: false,
                  checking: true,
                  savings: true
              },
              customerData: {
                  customerNumber: "00001",
                  firstName: "John",
                  lastName: "Doe",
                  billingEmail: "johndoe@email.com"
              },
              functionCallBackSuccess: function (response) {
                const containerEl = document.querySelector('#pay-component-1');
                const responseText = JSON.stringify(response.responseText);
                const responseData = JSON.stringify(response.responseData);
                alert(responseText + " " + responseData);
                containerEl.innerHTML += `
                  <hr/>
                  <p><b>Embedded Component Response:</b></p>
                  <p>${responseText}</p>
                  <p>${responseData}</p>
                  <hr/>
                `;
              },
              functionCallBackReady: function (data) {
                  var btn = document.getElementById("btnx");
                  if (data[1] === true) {
                      btn.classList.remove("hidden");
                  } else {
                      if (!btn.classList.contains("hidden")) {
                          btn.classList.add("hidden");
                      }
                  }
              },
              functionCallBackError: function (errors) {
                  alert('Error!');
                  console.log(errors);
              }
          };

          var paycomponent0 = new PayabliComponent(payabliConfig0);
          function executeAction() {
              paycomponent0.payabliExec('method');
          }
      </script>
  </body>
  </html>

```

**`Calls payabliExec('pay')`**

```html Calls payabliExec('pay')
  <!DOCTYPE html>
  <html>
  <head>
    <meta charset="UTF-8">
    <style>
      .hidden {
          display: none;
      }
      #pay-component-1 {
          max-width: 510px;
      }
      iframe {
          border: solid 1px transparent;
      }
      button {
          background-image: -webkit-linear-gradient(0deg, #7121ff 0%, #21d4fd 100%);
          background-image: -moz-linear-gradient(0deg, #7121ff 0%, #21d4fd 100%);
          background-image: -ms-linear-gradient(0deg, #7121ff 0%, #21d4fd 100%);
          border: none;
          padding: 15px 30px;
          color: #ffffff;
          font-size: 12px;
          cursor: pointer;
          text-transform: uppercase;
          font-weight: bold;
          border-radius: 5px;
          width: 100%;
          max-width: 510px;
      }
    </style>
  </head>
  <body>
      <p>When the form is valid, the action button will be shown.</p>
      <div id="pay-component-1"></div>
      <button id="btnx" class="hidden">Submit</button>
      <script src="https://embedded-component-sandbox.payabli.com/component.js" data-test></script>
      <script>
          // calling payabliExec('pay') processes a payment when the button is clicked
          document.getElementById("btnx").addEventListener("click", executeAction);
          var token = "o.z8j8aaztW9tUtUg4dlVeYAx+L2MazOFGr0DY8yuK3u79MCYlGK4/q0t5AD1UgLAjXOohnxN8VTZfPswyZcwtChGNn1a8jFMmYWHmLN2cPDW9IrBt1RtrSuu+85HJI+4kML5sIk9SYvULDAU2k0X0E1KFYcPwjmmkUjktrEGtz48XCUM70aKUupkrTh8nL7CXpAXATzVUZ2gEld9jGINwECPPLWmu+cZ4CJb7QMJxnzKFD073+nq/eL+pMth7+u/SkmAWC0+jn8y+Lf6T5Q5PqB6wN7Mvosp8g7U7lbEW2wC0DA92pjblfDHVJOQUkjgT7B1GvryMokLvBjoiaLhKa55iKZE1YDlyqruILkoNF+zGSPS9r17qU6w4ziKhoMdSPzPBJBlLhQhz3MVANXbjfEfJwmtr/JJ1uStUfBFJ710cS1x7goxMJO/cl+q+LVtPy788EKFkgMc5OjfBNCsNL+dBDVbK5CiIJUSbOFzdqdjY/VJ14MEodsHYOwMAjuF4.KRFMeEj0SOur8MLZ362c/UZ/U/Az3CSUkr3/8EVDE6Y=";
          var entryPoint = "bozeman-aikido";
          var payabliConfig0 = {
              type: "methodEmbedded",
              rootContainer: "pay-component-1",
              defaultOpen: 'card',  // offering only Card method - Embedded UI can only show a payment method
              // customCssUrl: "your url to a custom css file",
              token: token,
              entryPoint: entryPoint,
              card: {
                  enabled: true,
                  amex: true,
                  discover: true,
                  visa: true,
                  mastercard: true,
                  jcb: true,
                  diners: true,
                  inputs: {   // here we are customizing the input fields
                      cardHolderName: {
                          label: "NAME ON CARD",
                          placeholder: "",
                          floating: false,
                          value: "John Doe",
                          size: 12,
                          row: 0,
                          order: 0
                      },
                      cardNumber: {
                          label: "CARD NUMBER",
                          placeholder: "1234 1234 1234 1234",
                          floating: false,
                          size: 6,
                          row: 1,
                          order: 0
                      },
                      cardExpirationDate: {
                          label: "EXPIRATION DATE",
                          placeholder: "MM/YY",
                          floating: false,
                          size: 6,
                          row: 1,
                          order: 1
                      },
                      cardCvv: {
                          label: "CVV/CVC",
                          placeholder: "CVV/CVC",
                          floating: false,
                          size: 6,
                          row: 2,
                          order: 0,
                      },
                      cardZipcode: {
                          label: "ZIP/POSTAL CODE",
                          placeholder: "ZIP/POSTAL CODE",
                          floating: false,
                          size: 6,
                          row: 2,
                          order: 1,
                          country: ["us", "ca"],
                      }
                  }
              },
              ach: {
                  enabled: false,
                  checking: true,
                  savings: true
              },
              customerData: {
                  customerNumber: "00001",
                  firstName: "John",
                  lastName: "Doe",
                  billingEmail: "johndoe@email.com"
              },
              functionCallBackSuccess: function (response) {
                const containerEl = document.querySelector('#pay-component-1');
                const responseText = JSON.stringify(response.responseText);
                const responseData = JSON.stringify(response.responseData);
                alert(responseText + " " + responseData);
                containerEl.innerHTML += `
                  <hr/>
                  <p><b>Embedded Component Response:</b></p>
                  <p>${responseText}</p>
                  <p>${responseData}</p>
                  <hr/>
                `;
              },
              functionCallBackReady: function (data) {
                  var btn = document.getElementById("btnx");
                  if (data[1] === true) {
                      btn.classList.remove("hidden");
                  } else {
                      if (!btn.classList.contains("hidden")) {
                          btn.classList.add("hidden");
                      }
                  }
              },
              functionCallBackError: function (errors) {
                  alert('Error!');
                  console.log(errors);
              }
          };

          var paycomponent0 = new PayabliComponent(payabliConfig0);
          function executeAction() {
              paycomponent0.payabliExec('pay');
          }
      </script>
  </body>
  </html>

```

### Step 6. Capture the action response

After the action is triggered, you can capture the response using the callback provided in the property `functionCallBackSuccess`, in the configuration.

You can verify if the action was successful or failed by checking the text or numeric response fields. The response is the same for ACH and cards.

See [Handling responses and errors](/developer-guides/embedded-components-overview#handling-responses-and-errors) for more.

**`Save payment method response`**

```json Save payment method response

// Response is the same for ACH and card.
response.responseText:
"Success"

response.responseData
{"referenceId":"30e7658e-5c2c-4638-8308-b48edec0718b-1647","resultCode":1,"resultText":"Added","customerId":1647}

```

**`Payment success response`**

```json Payment success response
// Response is the same for ACH and card.
response.responseText:
"Success"

response.responseData:
{"authCode":"123456","referenceId":"187-c5892026d9f345ffa63bf909d574fe92","resultCode":1,"resultText":"Approved","avsResponseText":"","cvvResponseText":"","customerId":1636}
```

**`Credit card payment decline response`**

```json Credit card payment decline response

response.responseText:
"Declined"

response.responseData:
{"authCode":null,"referenceId":"187-d2a29970fa604edba5a6dbec67ace3ae","resultCode":2,"resultText":"200: Transaction was declined by processor.. DECLINE","avsResponseText":"","cvvResponseText":"CVV2/CVC2 no match","customerId":1636}
```

**`ACH payment decline`**

```json ACH payment decline
response.responseText:
"Declined"

response.responseData:
{"authCode":null,"referenceId":"187-b4cf271c7e24493aa799cabbccbd534d","resultCode":2,"resultText":"200: Transaction was declined by processor.. FAILED","avsResponseText":"","cvvResponseText":"","customerId":1636}
```

### Next steps

If you executed `pay` as the action, then you will receive a **transaction ID** in the field `ReferenceId`, which identifies the transaction in Payabli.

If you executed `method` as the action, then you receive a **stored method ID** in the field `ReferenceId`, which you can then use as `storedMethodId` to make payments at for this Customer using the API (POST to `/api/MoneyIn/getpaid` ). You must use the same `customerId` obtained in the response associated to the stored payment method.

Example of Request body using the ReferenceId with API call:

```json
{
  "entryPoint": "test",
  "paymentMethod": {
    "method": "card",
    "storedMethodId": "1234-xyz" //value obtained in "ReferenceId" field
  },
  "paymentDetails": {
    "totalAmount": 100.0
  },
  "customerData": {
    "customerId": 25
  }
}
```

## Configuration reference

These are the configuration parameters available for the EmbeddedMethod component.

> **Note**
>
> The component accepts only the data below. If you need to pass more data than what's supported, consider using the [temporary token flow](/developer-guides/tokenization-temporary-flow).

**`type`** `string` — required

This value determines the type of embedded component to render.\
Accepted values are: `methodEmbedded`, `methodLightbox`, `vterminal`, or `expressCheckout`.\
For the EmbeddedMethod UI, this value is `methodEmbedded`.
See the [Embedded Components Overview](/developer-guides/embedded-components-overview) for more information on other component types.

---

**`rootContainer`** `string` — required

Container ID used for the component.

---

**`defaultOpen`** `string`

Sets the default payment method that's shown. Accepted values are: `card` or `ach`.

---

**`hideComponent`** `boolean` — default: false

When true the component is hidden when it's instanced.

---

**`token`** `string` — required

API token for authentication. This should be a **public** API token, as described [here](/api-reference/api-overview#authentication#organization-token-most-common).

---

**`forceCustomerCreation`** `boolean` — default: true

When `true`, the component uses the `customerData` object to create a new customer record.
When `temporaryToken` is `true` and `forceCustomerCreation` is `false`, the component doesn't create a new customer record.
See [Temporary Token Flow](/developer-guides/tokenization-temporary-flow#disable-customer-creation) for more information.

---

**`customCssUrl`** `string`

Complete URL of a custom CSS stylesheet to use with the component.

---

**`clearFormAfterSubmit`** `boolean` — default: true

When `true`, the entered values on the form are cleared when submitted.

---

**`temporaryToken`** `boolean` — default: true

When `true`, the token created for the payment is temporary. Set this parameter to false to create a storedMethodId and save the payment profile.

---

**`showPopoverError`** `boolean` — default: true

When `false`, the validation error appears below the field instead of above it in a popover.

---

**`entryPoint`** `string`

When the API token belongs to an organization, the entrypoint name identifies the target paypoint (merchant).

---

**`card`** `object` — required

`cardService` object used to configure accepted card types.

#### properties

**`enabled`** `boolean`

Enable/disable card option.

---

**`amex`** `boolean`

Enable/disable acceptance of American Express cards.

---

**`discover`** `boolean`

Enable/disable acceptance of Discover cards.

---

**`visa`** `boolean`

Enable/disable acceptance of Visa cards.

---

**`mastercard`** `boolean`

Enable/disable acceptance of MasterCard cards.

---

**`diners`** `boolean`

Enable/disable acceptance of Diner's Club cards.

---

**`jcb`** `boolean`

Enable/disable acceptance of JCB cards.

---

**`inputs`** `object`

Card input fields descriptors. This object applies only to the EmbeddedMethod UI component.

#### properties

**`cardHolderName`** `object`

Optional, but *strongly recommended*. Descriptor object for input field.

---

**`cardNumber`** `object` — required

Descriptor object for input field.

---

**`cardExpirationDate`** `object` — required

Descriptor object for input field.

---

**`cardCvv`** `object` — required

Descriptor object for input field.

---

**`cardZipcode`** `object`

Optional, but *strongly recommended*. Descriptor object for input field.

---

---

---

**`ach`** `object` — required

`achService` object used to configure accepted ACH types.

#### properties

**`enabled`** `boolean`

Enable/disable ACH option.

---

**`checking`** `boolean`

Enable/disable acceptance of Checking account.

---

**`savings`** `boolean`

Enable/disable acceptance of Savings account.

---

**`inputs`** `object`

ACH input field descriptors. This only applies to the EmbeddedMethod UI component.

#### properties

**`achAccountHolderName`** `object` — required

Required. Descriptor object for input field.

---

**`achAccountType`** `object` — required

Required. Descriptor object for input field.

---

**`achRouting`** `object` — required

Required. Descriptor object for input field. Use the
`confirm` input descriptor to add matching validation to this field. See [Style Individual Fields](/developer-guides/embedded-components-overview#style-individual-fields) for more.

---

**`achAccount`** `object` — required

Required. Descriptor object for input field. Use the
`confirm` input descriptor to add matching validation to this field. See [Style Individual Fields](/developer-guides/embedded-components-overview#style-individual-fields) for more.

---

---

---

**`paymentMethod`** `object` — required

`paymentMethod` object with data related to the payment method. **Required when saving a payment method or executing a payment**. Can be passed to the component via payabliExec method. See [paymentMethod Object](/api-reference/schemas/paymentmethod) for a full reference.

---

**`customerData`** `object` — required

Customer Object with data related to customer. Can be passed to the component as a parameter with the `payabliExec` method. **Required when saving a payment method**. Which fields are required depends on whether the paypoint has custom identifiers. If you aren't using custom identifiers, then you must include at least one of these values: `firstname` and `lastname`, `email`, or `customerId`. See [customerData (payorData) Object](/api-reference/schemas/payordata) for a full reference.

---

**`paymentDetails`** `object` — required

`paymentDetails` object with data related to the payment. **Required to save a payment method**. Can be passed to the component via payabliExec method. See [paymentDetails Object](/api-reference/schemas/paymentdetail) for a full reference.

---

**`fallbackAuth`** `boolean | null` — default: false

When `true`, if tokenization fails, Payabli will attempt an authorization transaction to request a permanent token for the card. If the authorization is successful, the card will be tokenized and the authorization will be voided automatically.

---

**`fallbackAuthAmount`** `number | null` — default: 1.00

The amount for the `fallbackAuth` transaction. Defaults to one dollar.

---

**`functionCallBackSuccess`** `function`

The callback function called when the component executes successfully.

---

**`functionCallBackError`** `function`

The callback function called when the component receives an error. See **functionCallBackError response** in the next section for a complete reference.

---

**`functionCallBackReady`** `function`

The callback function called when the component's status changes. Used to poll the form's completeness before showing the submit button.

---

## functionCallBackError response

The response for the callback error will contain an array with codes, keys and texts of failed validations. You can check the values in the array to offer your customized error message.

<table id="responseerror">
  <thead>
    <tr>
      <th>
        Code
      </th>

      <th>
        Key
      </th>

      <th>
        Description
      </th>
    </tr>
  </thead>

  <tbody>
    <tr>
      <td>
        802
      </td>

      <td>
        paymentMethodsCardNumberError
      </td>

      <td>
        Error in Card number field
      </td>
    </tr>

    <tr>
      <td>
        803
      </td>

      <td>
        paymentMethodsCardExpirationDateError
      </td>

      <td>
        Error in Card Expiration field
      </td>
    </tr>

    <tr>
      <td>
        804
      </td>

      <td>
        paymentMethodsCardCvvError
      </td>

      <td>
        Error in CardCVV field
      </td>
    </tr>

    <tr>
      <td>
        805
      </td>

      <td>
        paymentMethodsCardZipcodeError
      </td>

      <td>
        Error in Card Zip code field
      </td>
    </tr>

    <tr>
      <td>
        901
      </td>

      <td>
        paymentMethodsAchAccountHolderNameError
      </td>

      <td>
        Error in ACH Holder field
      </td>
    </tr>

    <tr>
      <td>
        902
      </td>

      <td>
        paymentMethodsAchAccountTypeError
      </td>

      <td>
        Error in ACH Account type field
      </td>
    </tr>

    <tr>
      <td>
        903
      </td>

      <td>
        paymentMethodsAchRoutingError
      </td>

      <td>
        Error in ACH Routing field
      </td>
    </tr>

    <tr>
      <td>
        904
      </td>

      <td>
        paymentMethodsAchAccountError
      </td>

      <td>
        Error in ACH Account number field
      </td>
    </tr>
  </tbody>
</table>

## Response

The Response object received via callback Success function has the following structure:

**`responseText`** `string`

"Success" or "Declined"

---

**`responseData`** `object`

Container for response details.

#### properties

**`responseData.AuthCode`** `string`

Authorization code for payments. ULL for saving payment methods.

---

**`responseData.ReferenceId`** `string`

Identifier for the transaction (for payments) or the stored payment method (for save payment method).

---

**`responseData.ResultCode`** `integer`

Result of operation. 1 is success, 2 is declined, and 3 is error.

---

**`responseData.ResultText`** `string`

Message related the result. If the operation was successful, it returns "Added"/"Approved". If there was an error, it returns error details.

---

**`responseData.CustomerId`** `integer`

ID for the customer owner of payment or saved payment method.

---

---

## Examples

These flowcharts visually illustrate the path to making a payment or storing a payment method using an embedded component.

### Make a payment

To make a payment with an embedded component, your component configuration should contain `payabliExec(pay, parameters)`. In the `parameters` argument, include [customerData](/api-reference/schemas/customerdata) and [paymentDetails](/api-reference/schemas/paymentdetail) objects. When the payment is executed, the request returns response data.

*This flowchart explains the basic steps for the task. Hover over a step for more information.*

Run `payabliExec(pay, parameters)`
The action is set to `pay` here. Send the `paymentDetail` and `customerData` object in `parameters`.

→

Payment executed
The transaction is executed and includes the data sent as parameters

→

Response

### Save a payment method

To save a payment method with an embedded component, your component configuration should contain `payabliExec(method, parameters)`. In the `parameters` argument, include [customerData](/api-reference/schemas/customerdata) and [paymentDetails](/api-reference/schemas/paymentdetail) objects. When the payment method is saved, the request returns response data.

*This flowchart explains the basic steps for the task. Hover over a step for more information.*

Run `payabliExec(method, parameters)`
The action is set to `method` here. Send the `paymentDetail` and `customerData` object in `parameters`.

→

Payment method saved
The payment method is saved and includes the data sent as parameters

→

Response

### Save a payment method and make a payment

You can save a payment method and make a payment with the EmbeddedMethod UI component by writing a callback function to execute the payment after successfully saving the payment method.

To save a payment method and then execute a transaction with the saved payment method, your component configuration should contain `payabliExec(method, parameters)`. In the `parameters` argument, include the [customerData](/api-reference/schemas/customerdata) and [paymentDetails](/api-reference/schemas/paymentdetail) objects. When the payment method is saved, use a callback function to execute the transaction.

> **Warning**
>
> Remember to never make payment transactions via client-side API requests. Your callback function should make the payment transaction using a server-side function.

*This flowchart explains the basic steps for the task. Hover over a step for more information.*

Run `payabliExec(method, parameters)`
Here, the action is set to `method`. Send the `paymentDetail` and `customerData` object in `parameters`.

→

Payment method saved
The payment method is saved and includes the data sent as parameters. An ID for the payment method is returned, which is then used to make transactions.

→

Callback function
Use a callback function to send a transaction that uses the new payment method.

→

Response