Stax Hosted Enrollment
Enroll merchants from your application and send them to Stax-hosted registration pages to complete their applications. This guide is for developers integrating Stax Connect through the API, not for users enrolling merchants through the Dashboard. You automate account creation without implementing the full API-driven enrollment flow.
Prerequisites
- Acquire your Partner Level Enrollment Key and the merchant plan and pricing plan values assigned to your brand.
- Install Bash, curl 7.76.0 or later, and jq to run the examples. The examples use
--fail-with-bodyto report HTTP errors without hiding the response body. - Run the examples in the same Bash session so later steps can reuse the saved values. Enter credentials only in your local terminal; do not commit credentials or response files to source control.
- For the enrollment example, use an existing merchant user's email. Do not use a Stax Connect-level user's email. Creating a new user also requires
user.name,user.password, anduser.password_confirmation.
Step 1: Enroll the merchant account with Stax
Call the Enroll a Merchant API with your brand's plan values. This request creates a merchant account; use merchant details you intend to enroll.
read -r -s -p 'Partner Level Enrollment Key: ' STAX_PARTNER_KEY; printf '\n'
read -r -p 'Merchant plan assigned to your brand: ' STAX_MERCHANT_PLAN
read -r -p 'Pricing plan assigned to your brand: ' STAX_PRICING_PLAN
read -r -p 'Merchant company name: ' STAX_COMPANY_NAME
read -r -p 'Business email: ' STAX_BUSINESS_EMAIL
read -r -p 'Existing merchant user email: ' STAX_USER_EMAIL
# Restrict access because the response contains a sign-in token.
umask 077
jq -n \
--arg plan "$STAX_MERCHANT_PLAN" \
--arg pricing "$STAX_PRICING_PLAN" \
--arg company "$STAX_COMPANY_NAME" \
--arg businessEmail "$STAX_BUSINESS_EMAIL" \
--arg userEmail "$STAX_USER_EMAIL" \
'{merchant: {plan: $plan, company_name: $company, contact_email: $businessEmail}, registration: {pricing_plan: $pricing, business_email: $businessEmail, email: $userEmail}, user: {email: $userEmail}}' \
> enrollment-request.json
if curl --fail-with-body --silent --show-error \
--request POST 'https://apiprod.fattlabs.com/admin/enroll' \
--header "Authorization: Bearer $STAX_PARTNER_KEY" \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data-binary @enrollment-request.json \
--output enrollment-response.json; then
if STAX_MERCHANT_ID=$(jq -er '.merchant.id | strings | select(length > 0)' enrollment-response.json) &&
STAX_AUTH_TOKEN=$(jq -er '.token | strings | select(length > 0)' enrollment-response.json); then
printf 'Merchant enrolled: %s\n' "$STAX_MERCHANT_ID"
else
printf 'Response is missing merchant.id or token. Stop before continuing.\n' >&2
fi
else
printf 'Enrollment failed. Review enrollment-response.json before retrying.\n' >&2
fiOn success, you receive HTTP 200 and see Merchant enrolled: followed by the merchant ID. The response includes merchant.id and token; the example saves them for later steps. For HTTP 422, review the field-level validation errors in enrollment-response.json, correct the request, and retry. Do not continue if the request fails or either saved value is missing.
Use your Partner Level Enrollment Key and your brand’s pricing plan and merchant plan values to enroll the merchant. The API returns an ephemeral token (a temporary sign-in credential) that lets you use single sign-on (SSO, signing a user in without asking them to enter credentials again) to open Stax Pay’s registration pages for the merchant user.
Save merchant.id and the authorization token returned in token. This guide refers to that token as auth_token; the Bash examples store it in STAX_AUTH_TOKEN.
Step 2: Correlate the merchant in Stax to the business in the ISV software
Associate the merchant.id saved from step 1 with the corresponding sub-merchant in your independent software vendor (ISV) application. Use the ID from the API response rather than looking it up in the Dashboard. For example, the enrollment API documents a UUID-shaped ID such as 7fe97e0f-2e7a-4817-872b-6eb86eea842c; use your own returned ID, not this example.
Step 3: Redirect merchant to Stax Sign-up Pages using Single Sign On (SSO)
Using the user’s auth_token, you can redirect the user to Stax’s registration/sign-up page to finish the application. The auth token allows you, the ISV, to sign your merchant’s users into the Stax Sign-up pages. The following URL is where you will send the user. See our SSO docs for more information.
Build the redirect URL from the token saved in step 1:
if [ -n "${STAX_AUTH_TOKEN:-}" ]; then
printf 'https://signup.staxpayments.com/#/sso?jwt%%5B%%5D=%s\n' \
"$(printf '%s' "$STAX_AUTH_TOKEN" | jq -sRr @uri)"
else
printf 'No authorization token is available. Complete step 1 first.\n' >&2
fiThe output is a sign-in URL with the token encoded in the jwt[] query parameter. Redirect the merchant to that URL to open the registration pages. Treat the URL as a credential: do not log it or share it with anyone other than the intended merchant user.
Note: The authorization token expires after 96 hours. If the token has expired, either the ISV application can generate a new auth token using the Generate an Ephemeral Token API for the user, or the merchant will need to log in to the sign-up page https://signup.staxpayments.com with their username and password.
Step 4: Create the merchant API key
Use the STAX_MERCHANT_ID saved from the enrollment response to create an API key for the sub-merchant:
if [ -z "${STAX_PARTNER_KEY:-}" ] || [ -z "${STAX_MERCHANT_ID:-}" ]; then
printf 'Complete step 1 to obtain the partner key and merchant ID.\n' >&2
else
umask 077
if curl --fail-with-body --silent --show-error \
--request POST "https://apiprod.fattlabs.com/merchant/$STAX_MERCHANT_ID/apikey" \
--header "Authorization: Bearer $STAX_PARTNER_KEY" \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data '{"name":"merchant-payments","team_role":"full"}' \
--output merchant-apikey-response.json; then
printf 'API key request succeeded. Read merchant-apikey-response.json securely.\n'
else
printf 'API key request failed. Review merchant-apikey-response.json before retrying.\n' >&2
fi
fiExpect HTTP 200 on success. Record the returned API key securely and associate it with the sub-merchant in your ISV application. The endpoint reference does not document the response field containing the key, so this example saves the full response rather than assuming a field name. If the response is empty or contains no key, confirm the response format with Stax before continuing. For HTTP 400, review the response before retrying.
Note: Merchants must wait until Stax completes underwriting (the review of the merchant’s application and business risk), approves the application, and activates the account before processing payments with this API key. Check the application and account statuses in steps 6 and 7; creating an API key alone does not authorize payment processing.
Step 5: Verifying the merchant application
The merchant must complete and sign the application before the underwriting team can begin reviewing the application.
Merchants may abandon their forms to retrieve required business information they may not know off-hand (such as TIN or banking information). Recognize when an application has been abandoned after a designated period. You may need to communicate with the merchant to encourage them to complete the signing process.
You can determine whether the merchant has signed by using the Get Merchant Registration Data API resource and checking for the timestamp in the electronic signature field (electronic_signature.timestamp).
The merchant has not completed their application until this field contains a timestamp. You may poll for this information every 30 minutes to an hour, then trigger an event (such as an email) to notify the merchant to finish their application. You can contact merchants who have not signed to see if you can help them complete their application.
Note: If you enable the update_electronic_signature webhook, you receive a notification each time the merchant signs or re-signs the application. Use this notification to track when the merchant reaches the signature step. Refer to our Webhook Documentation for instructions on setting up the webhook.
Step 6: Check the merchant’s underwriting status
After the merchant signs the application and electronic_signature.timestamp contains a value, poll the merchant’s registration to check the underwriting status.
Retrieve the registration object, then read its underwriting_status field. The field name is not part of the endpoint URL.
if [ -z "${STAX_PARTNER_KEY:-}" ] || [ -z "${STAX_MERCHANT_ID:-}" ]; then
printf 'Complete step 1 to obtain the partner key and merchant ID.\n' >&2
else
umask 077
if curl --fail-with-body --silent --show-error \
"https://apiprod.fattlabs.com/merchant/$STAX_MERCHANT_ID/registration" \
--header "Authorization: Bearer $STAX_PARTNER_KEY" \
--header 'Accept: application/json' \
--output registration-response.json; then
if ! jq -e 'type == "object"' registration-response.json > /dev/null; then
printf 'Expected a registration object. Review registration-response.json.\n' >&2
else
jq '{underwriting_status, underwriting_substatuses, underwriting_note}' registration-response.json
fi
else
printf 'Registration request failed. Review registration-response.json before retrying.\n' >&2
fi
fiOn HTTP 200, the output shows underwriting_status, underwriting_substatuses, and underwriting_note. A null status means the response does not yet provide a status; do not treat it as approval. For HTTP 422, review the validation errors before retrying.
Use underwriting_substatuses and underwriting_note from the registration response for further details.
For additional information, see the Get Merchant Registration Data API resource.
Example
If the Underwriting gets PENDED (underwriting_status: “PENDED”, the underwriting_note will reflect the information that needs to be updated. In these cases, you should offer the user a way to return to the Signup pages via a link to https://signup.staxpayments.com/#/application/review to make updates.
Note: You can use the merchant’s merchant-level API key(From step 4 above) to subscribe to a webhook update_underwriting to receive a notification of the merchant’s underwriting status. Refer to our Webhook Documentation for instructions on setting up the webhook.
Step 7: Check the merchant’s account status
When the underwriting_status is “APPROVED,” you can poll the merchant record to view the merchant status.
Retrieve the merchant record and read its status field:
if [ -z "${STAX_PARTNER_KEY:-}" ] || [ -z "${STAX_MERCHANT_ID:-}" ]; then
printf 'Complete step 1 to obtain the partner key and merchant ID.\n' >&2
else
umask 077
if curl --fail-with-body --silent --show-error \
"https://apiprod.fattlabs.com/merchant/$STAX_MERCHANT_ID" \
--header "Authorization: Bearer $STAX_PARTNER_KEY" \
--header 'Accept: application/json' \
--output merchant-response.json; then
if STAX_MERCHANT_STATUS=$(jq -er '.status | strings | select(length > 0)' merchant-response.json); then
printf 'Merchant status: %s\n' "$STAX_MERCHANT_STATUS"
else
printf 'Response is missing status. Review merchant-response.json.\n' >&2
fi
else
printf 'Merchant request failed. Review merchant-response.json before retrying.\n' >&2
fi
fiOn HTTP 200, the output shows the merchant status, such as Merchant status: PENDING. Continue checking until the status is ACTIVE; do not treat a missing status or any other value as activation. For HTTP 400, review the response before retrying.
Once the merchant status is “ACTIVE,” the account can begin processing payments using the API key.
Note: You can use the merchant’s merchant-level API key to subscribe to a webhook update_merchant_status and receive an update on the merchant status
Refer to our Webhook Documentation for instructions on setting up the Webhook.
Customizing the Merchant Enrollment
The white-labelled enrollment method allows you to customize and streamline the enrollment process for your merchants. This ability can improve successful sign-ups and reduce the need for intervention to help merchants complete the applications. Additionally, streamlining the application process can reduce errors and make them easier to correct, resulting in faster underwriting approvals.
You can control whether to show or hide field values and pre-populate values that can be edited if needed.

To hide all pre-populated fields, add the boolean hide_prefilled_fields with the value true to your enrollment request. This JSON fragment shows the setting, not a complete enrollment request:
{
"hide_prefilled_fields": true
}When the merchant opens the registration pages, pre-populated fields are hidden.
For additional flexibility, you can set each field parameter to a specific setting, allowing you to hide or show parameters and enable or disable editing.
Merge this JSON fragment into the registration object in 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 the registration pages, these settings have the following results:
| Field | Permission | Expected result |
|---|---|---|
business_dba | null | The field is hidden. |
business_website | "read" | The field is visible and read-only. |
company_type | "write" | The field is visible and editable. |
Updated 4 days ago
