Create Workflow Configuration

Call the POST /payments/workflow_config endpoint.

After a configuration is created, the operation type for the WC can’t be changed. However, other WC parameters can be defined and edited later when creating the WE.

Example

{
  configName: 'some-name',
  preScreening: {
    enabled: true
  },
  failureHandling: {
    enabled: true,
    type: 'REVERSE'
  },
  configOperations: {
    type: 'TRANSFER',
    params: {
      source: {
        accountId: 'xyz',
        accountType: 'EXCHANGE_ACCOUNT',
      },
      assetId: 'USDC_POLYGON',
      destination: {
        accountType: 'VAULT_ACCOUNT',
        accountId: '0',
      },
    },
  },
  {
    type: 'TRANSFER',
    params: {
      destination: {
        accountType: 'EXCHANGE_ACCOUNT',
        accountId: 'abc',
      },
      source: {
        accountType: 'VAULT_ACCOUNT',
        accountId: '0',
      },
      assetId: 'USDC_POLYGON',
    },
  },
}

This route returns the configuration ID which will be used to create the WE.

A configuration proceeds through the following statuses during its creation. These statuses will be applied to each WCO and the WC as a whole.

  1. PENDING: The configuration is about to start the validation process.
  2. VALIDATION_IN_PROGRESS: The validation process has started, ensuring the configuration is valid.
  3. VALIDATION_FAILED or READY_FOR_EXECUTION: The validation failed or the configuration can be executed. These statuses are finite states.

All the operation validation processes must succeed for the configuration validation to succeed.

If one or more operation validations fail, the entire configuration validation fails. Failed WCOs may show VALIDATION_FAILED while others may show VALIDATION_COMPLETED. However, the WC status will show VALIDATION_FAILED. The failure details will be included under the failed operation in the validationFailure field. In this scenario, you should call the API endpoint again with the corrected configuration.