Enroll a Merchant

Simultaneously create a merchant, registers the merchant, and creates a user record in a single request, associating them together.

Create a merchant, its registration, and an associated user with one POST /admin/enroll request from your server-side integration.

This API reference is for developers using the Partner API, not for merchants completing Dashboard setup. Authenticate with a partner-level API key (a credential that grants access to partner operations).


Response Data

On success, you receive the merchant record, registration data, user record, ephemeral bearer token (a temporary credential that authenticates requests as the user), and action summary.

Single Request

Create and associate multiple records simultaneously to streamline the merchant enrollment process.

Send an enrollment request

  1. Obtain your partner-level API key and a valid registration.pricing_plan for your brand. Keep the key on your server; do not put it in browser code or source control.
  2. Install Python 3 to run the example below. Enter the company name, contact email, and user details when prompted. For a new user, provide a name and matching password fields. For an existing user, the API uses the email and ignores the remaining user fields.
  3. Run this script once for the merchant you want to enroll. It sends the required merchant, registration, and user fields and uses premium for the merchant's Stax Pay plan, as in this endpoint's request example.
import getpass
import json
import sys
import urllib.error
import urllib.request


def main():
    api_key = getpass.getpass("Partner API key: ").strip()
    company_name = input("Company name: ").strip()
    contact_email = input("Business contact email: ").strip()
    pricing_plan = input("Valid registration pricing plan for your brand: ").strip()
    owner_email = input("Principal owner's email: ").strip()
    user_email = input("User email: ").strip()
    user_name = input("User full name (required for a new user): ").strip()
    password = getpass.getpass("User password (required for a new user): ")
    confirmation = getpass.getpass("Confirm user password: ")

    if not all((api_key, company_name, contact_email, pricing_plan, owner_email, user_email)):
        sys.exit("Missing required input. No request was sent.")
    if password != confirmation:
        sys.exit("Passwords do not match. No request was sent.")

    payload = {
        "merchant": {
            "plan": "premium",
            "company_name": company_name,
            "contact_email": contact_email,
        },
        "registration": {
            "pricing_plan": pricing_plan,
            "business_email": contact_email,
            "email": owner_email,
        },
        "user": {
            "email": user_email,
            "name": user_name,
            "password": password,
            "password_confirmation": confirmation,
        },
    }
    request = urllib.request.Request(
        "https://apiprod.fattlabs.com/admin/enroll",
        data=json.dumps(payload).encode("utf-8"),
        headers={
            "Authorization": f"Bearer {api_key}",
            "Content-Type": "application/json",
            "Accept": "application/json",
        },
        method="POST",
    )
    try:
        with urllib.request.urlopen(request, timeout=30) as response:
            status = response.status
            result = json.load(response)
    except urllib.error.HTTPError as error:
        print(f"HTTP {error.code}: enrollment failed.", file=sys.stderr)
        print(error.read().decode("utf-8", errors="replace"), file=sys.stderr)
        sys.exit(1)
    except (urllib.error.URLError, TimeoutError, OSError) as error:
        sys.exit(f"Request did not complete: {error}. Verify the merchant record before retrying.")
    except (ValueError, UnicodeError):
        sys.exit("Response was not valid JSON. Verify the merchant record before retrying.")

    if status != 200 or not isinstance(result, dict):
        sys.exit("Unexpected response. Verify the merchant record before retrying.")

    # Use IDs from this API response; this request does not need Dashboard IDs.
    merchant = result.get("merchant")
    user = result.get("user")
    registration = result.get("registration")
    if not (
        isinstance(merchant, dict) and merchant.get("id")
        and isinstance(user, dict) and user.get("id")
        and isinstance(registration, dict)
    ):
        sys.exit("Response is missing expected records. Verify enrollment before retrying.")

    print("HTTP 200: enrollment records returned.")
    print(f"Merchant ID: {merchant['id']}")
    print(f"User ID: {user['id']}")
    print("Registration data returned. Enrollment does not mean the merchant is approved or active.")
    # Avoid printing the full response because it includes a bearer token.


if __name__ == "__main__":
    main()

For the IDs in the documented success response, the output is:

HTTP 200: enrollment records returned.
Merchant ID: 7fe97e0f-2e7a-4817-872b-6eb86eea842c
User ID: 40fe8a52-fb71-4bec-89b3-a48f1dc18a50
Registration data returned. Enrollment does not mean the merchant is approved or active.

Your response contains IDs for your merchant and user. Store those returned IDs for subsequent API requests; you do not need to locate an existing merchant ID in the Dashboard before enrollment.

For HTTP 422, correct the field errors in the response before retrying. Check required merchant fields, the registration pricing plan, and new-user details. The API also reports errors when the existing user's brand does not match the API key's brand or when you lack permission to request a user token. After a timeout or an unexpected response, verify whether the merchant exists before submitting another enrollment request.

Handle existing users and registration fields

Existing User Handling

If the specified user email already exists, the API:

  • Associates the existing user record with the merchant
  • Ignores the remaining user fields in the request
  • Returns an error if the email belongs to a Stax Connect-level user, because the API cannot generate temporary user credentials for those users
Self-Registration Field Permissions

Configure self-registration (the pages where merchants complete their application) through the enrollment endpoint, POST /admin/enroll.

Optional: Hide prefilled fields automatically

Set "hide_prefilled_fields": true at the top level of your request body. The registration pages then hide fields whose values you supplied in the request.

Optional: Control individual fields

Add field_permissions inside registration to control field visibility and editing. Merge this valid JSON fragment into your enrollment request; it is not a complete enrollment request:

{
  "registration": {
    "field_permissions": {
      "business_dba": null,
      "business_website": "read",
      "company_type": "write"
    }
  }
}

When the merchant opens self-registration, these settings have the following results:

FieldPermissionExpected result
business_dbanullHide the business's doing-business-as name (the name it trades under).
business_website"read"Show the website as read-only.
company_type"write"Let the merchant edit the company type.
❗️

If you supply values for every field in a section and mark those fields as hidden, self-registration hides the section and its horizontal bars. If every field on a page meets those conditions, self-registration also removes that page from the sidebar tracker.

The review step does not show fields that you hide and prefill. Confirm your field permissions before directing the merchant to self-registration.

Parameter Notes

Required merchant fields

FieldTypeRequirement
merchant.company_namestringSupply the company name.
merchant.contact_emailstringSupply the email address for merchant communications.
merchant.planstringSupply the plan that configures Stax Pay. The request example uses "premium"; the schema's documented default is "connect-a". Set this field explicitly.

Also supply registration.pricing_plan, registration.business_email, registration.email, and user.email. Use a registration pricing plan valid for your brand. For a new user, also supply user.name, user.password, and user.password_confirmation with matching password values.

Optional: Configure enrollment behavior

FieldTypeDefaultBehavior and constraints
skip_account_pagebooleanNot specifiedSet to true to skip the Set password page when the user logs in.
hide_prefilled_fieldsbooleanNot specifiedSet to true to hide prefilled fields during self-registration.
merchant.hosted_payments_tokenstringGenerated if omittedUnique merchant identifier for Stax.js (the JavaScript library for collecting payment information). If you supply a value, make it unique. Otherwise, the API generates one using the company name and a random string.
merchant.currencyarray of strings["USD"]Supply one currency, such as ["USD"] or ["CAD"]. Only one currency is supported at a time.

Read merchant.hosted_payments_token from the enrollment response rather than copying another merchant's value. For example, the documented response contains "Fattmerchant-c3073a83d4a2"; use the value returned for your own merchant when integrating Stax.js.

Registration response fields

Read the following fields from the registration response object; do not add them to your enrollment request. In the descriptions below, ACH means Automated Clearing House (bank-account payments), card-present means the customer presents a physical card, and card-not-present means a remote or online payment. Underwriting means reviewing a merchant's application and business risk before approval.

FieldTypeDescription
user_idstringThe ID of the user associated with this registration.
merchant_idstringThe ID of the merchant associated with this registration.
created_atstringTimestamp when the registration was created.
updated_atstringTimestamp when the registration was last updated.
plan_txamntstringPer-transaction fee amount (e.g., ".15").
plan_dcamntstringDiscount rate amount (e.g., "2.99").
plan_ach_txamntstringACH per-transaction fee amount.
plan_ach_dcamntstringACH discount rate amount.
plan_ach_capstringACH transaction cap.
cp_transaction_ratestringCard-present transaction rate.
cp_per_item_ratestringCard-present per-item fee.
cp_amex_ratestringCard-present AMEX rate.
cp_amex_per_item_ratestringCard-present AMEX per-item fee.
credit_qual_disc_ratestringCredit qualified discount rate.
credit_qual_trans_feestringCredit qualified transaction fee.
credit_mid_disc_ratestringCredit mid-qualified discount rate.
credit_mid_trans_feestringCredit mid-qualified transaction fee.
credit_non_disc_ratestringCredit non-qualified discount rate.
credit_non_trans_feestringCredit non-qualified transaction fee.
amex_qual_disc_ratestringAMEX qualified discount rate.
amex_qual_trans_feestringAMEX qualified transaction fee.
amex_mid_disc_ratestringAMEX mid-qualified discount rate.
amex_mid_trans_feestringAMEX mid-qualified transaction fee.
amex_non_disc_ratestringAMEX non-qualified discount rate.
amex_non_trans_feestringAMEX non-qualified transaction fee.
is_flat_ratebooleanWhether the merchant is on a flat-rate pricing plan.
cp_credit_surcharge_ratestring \| nullCard-present credit surcharge rate, if applicable.
cnp_credit_surcharge_ratestring \| nullCard-not-present credit surcharge rate, if applicable.
cp_debit_trans_feestring \| nullCard-present debit transaction fee, if applicable.
cnp_debit_trans_feestring \| nullCard-not-present debit transaction fee, if applicable.
cp_debit_discount_ratestring \| nullCard-present debit discount rate, if applicable.
cnp_debit_discount_ratestring \| nullCard-not-present debit discount rate, if applicable.
plus_card_ratestring \| nullTiered pricing plus card rate, if applicable.
premium_card_ratestring \| nullTiered pricing premium card rate, if applicable.
filesarrayArray of file objects associated with the registration.
brandstringThe brand associated with this registration (e.g., "fattmerchant").
underwriting_substatusstring \| nullCurrent underwriting sub-status, if any.
empty_required_fieldsarrayList of registration field names that are still required but have not been provided. Use this to determine what data is missing before underwriting.
latest_file_uploaded_atstring \| nullTimestamp of the most recently uploaded file, or null if no files have been uploaded.
merchantobjectThe full merchant object associated with this registration.
userobjectThe full user object associated with this registration.

Understand compliance responsibilities

If you use the returned hosted payments token with Stax.js, its hosted card fields send sensitive card information directly from the browser to Stax. This supports your Payment Card Industry Data Security Standard (PCI DSS) compliance efforts; it does not guarantee compliance or replace applicable requirements.

Required API fields are enrollment requirements, not a determination of your compliance obligations. Recommendations in this reference, such as verifying a merchant record before retrying an interrupted request, are integration guidance. Consult your legal and compliance teams regarding requirements specific to your integration.

Continue after enrollment

Continue Integration

On HTTP 200, confirm that the response includes merchant, registration, user, and the action summary in message. Save merchant.id and user.id from this response for subsequent API requests; registration.merchant_id and registration.user_id identify the associated records. The documented response does not include registration.id, so do not depend on it. Enrollment creates or associates records; it does not mean the merchant is approved or active.

Body Params
boolean

Set to true to skip the setPassword page for the user when logging in.

boolean

When a field is pre-populated, it will not be displayed to a merchant. This can declutter the information presented to the merchant to be filled out.

registration
object
user
object
merchant
object
Responses

Language
Credentials
Bearer
JWT
LoadingLoading…
Response
Click Try It! to start a request and see the response here! Or choose an example:
application/json