Finalize the Switch

The final step is to confirm the switch by calling the action endpoint for a given switch and sending the "Submit" action. You will likely want to show the customer a screen such as the one below so they can confirm everything looks correct.

Create Customer

Submitting the Action

When the customer taps on submit then you should hit the following API resource and pass the "Submit" action which was returned in the list of actions from the API response when creating/updating the switch in the last step:

API Endpoint: Switches Action

METHOD ENDPOINT
PUT /customers/{customerKey}/switches/{switchIndex}/action

Parameter reference

PARAMETER DESCRIPTION
context
string
The context value to be returned in the response. This is supplied initially by your app and is returned from the API in the response so that responses can be correlated with requests in JSON-P and batch situations. (This is not required)
index
integer
The switchIndex for the given switch.
action
string
The action you want to perform. (e.g. Submit)

Example Response Object

{
  "apiVersion": "3.0.1",
  "context": "testing",
  "id": 1290,
  "data": {
    "kind": "switch",
    "item": {
      "index": 1,
      "type": "deposit",
      "targetId": 678313,
      "name": "Acme Inc.",
      "accountholderIndex": 0,
      "values": {
        "accounts": [
          {
            "index": 0
          }
        ],
        "fields": {}
      },
      "ux": {
        "accounts": {
          "limit": 1,
          "maxChecking": 1,
          "maxSavings": 1,
          "choices": [
            {
              "index": "0",
              "label": "Checking *3904"
            },
            {
              "index": "1",
              "label": "Savings *3289"
            }
          ],
          "fields": []
        },
        "fields": [
          {
            "key": "Custom_Net or Amount (in dollars)",
            "label": "Net or Amount (in dollars)",
            "type": "textbox",
            "required": false
          },
          {
            "key": "Custom_or Percentage of Pay (1 - 100)",
            "label": "Percentage of Pay (1 - 100)",
            "type": "textbox",
            "required": false
          },
          {
            "key": "Custom_Depositor's Full Mailing Address",
            "label": "Depositor's Full Mailing Address",
            "type": "textbox",
            "required": true
          },
          {
            "key": "Custom_Employee ID",
            "label": "Employee ID",
            "type": "textbox",
            "required": false
          },
          {
            "key": "Custom_Last 4 of SSN",
            "label": "Last 4 of SSN",
            "type": "textbox",
            "required": true
          }
        ]
      },
      "metadata": {
        "employee_id": "jsmith",
        "branch": "21"
      },
      "state": {
        "status": "Incomplete",
        "validation": {
          "accounts": [],
          "fields": [
            "Custom_Last 4 of SSN is required",
            "Custom_Depositor's Full Mailing Address is required"
          ],
          "overall": []
        },
        "actions": [
          "HTTP-PUT",
          "Cancel"
        ]
      }
    }
  }
}

Congratulations! You've just helped a customer successfully submit a switch request. You should now see a response from the API outlining the details of the switch you just created and it's current status.