Configuration

Every option open() takes in SDK v2, which value wins between subaccount policy and open(), the consent and terms boxes, and hosted enrollment links.

Options

open() checks every option before it opens anything. A value it refuses logs an error naming the field, and open() resolves false and opens nothing; an option it ignores or a value it adjusts logs a warning, and the session opens. "Same" in the table means as in SDK v1.

OptionIn v2
personaNew, and required. "admin" or "cardholder". Set it from who is on the page; the SDK never asks. A missing or other value is refused.
localeNew. The language of the screens, as a BCP 47 tag such as "en-GB"; the language part decides. The screens are in English. sv-SE is available on request; contact Astrada.
prefillNew. Optional. { companyLegalName?, adminName?, adminEmail?, bankContactName?, bankContactEmail? }, all strings. Fills in the bulk kickoff form and the confirm-request form with details your page already knows.
logoNew. { pngBase64 }: your logo beside Astrada's mark at the top of the card, on every screen, 28 pixels tall. Without it, Astrada's mark shows alone.
entryIgnored, with a warning whatever its value; there is no chooser.
bulkFlowIgnored, with a warning whatever its value. The kickoff is the only bulk flow (resume still opens the reference step).
minBinDigitsNow 8 to 11 (default 8), and always used: it sets how many digits Continue needs on the card number screen. v1 took 6 to 16, and only with card enrollment off. Values outside the range are clamped, with a warning.
bulkEnrollmentSame values. "suggested" and "forced" act through the program screen and the callout; "forced" drops Connect this card now.
bankEnrollmentSame values. "on" no longer adds a chooser tile: the bank link is a route after the card number, on admin pages, and on employee pages for an Amex card.
linkAnotherCardSame type. It shows or hides Connect another company card on the card success screen, which starts again on the page's first screen: the card number screen on an admin page, the empty card form on an employee page.
bankLinkSame shape. When the page sends no countryCode, v2 sends the card issuer's country. An unknown field or a bad value is refused.
maxWidthSame type, now at least 360 pixels: a smaller number becomes 360 with a warning.
getAccessTokenTimeoutMsSame meaning. The enrollment window waits for it too, so a slow token gets the time you set. It must be a positive number; anything else is refused.
resumeSame shape. On a cardholder page it is ignored with a warning, and the session opens as any session on that page does. An unknown field is refused.
reconnectSame shape. An unknown field is refused.
statusLabelsSame shape. An unknown stage, or a label that is not a string, is refused.
customerReferenceIdSame meaning, and it must be a UUID: the API takes a UUID only, so anything else is refused.
termsSame shape. text renders as text, where a Markdown link becomes a link, and links open only for https, http and mailto URLs. Without terms, the form shows no terms box (see Consent and the terms box).
metadataStill reserved. v2 logs a warning that it does nothing, whatever its value, and sends it nowhere.

More on locale, prefill, logo, bulkEnrollment, linkAnotherCard and terms:

  • locale: without a supported locale the screens are in English, whatever language the browser prefers. Another language shows English, with a warning. The hosted link pages take no locale and are in English.
  • prefill: the admin sees each value and can change it, and nothing is sent until they submit. An unknown field or a non-string value is refused.
  • logo: pngBase64 is the bytes of a PNG file in base64, with no data: prefix and never a URL, at most 512 x 512 pixels and 32 KB. Anything else is refused, and the error says why.
  • bulkEnrollment: the v1 true or false still works, with a warning naming what it sets:
    • true is bulk "suggested" with the bank step "on";
    • false is bulk "off" with the bank step "amex-only";
    • and both turn the card form on, except for a cardEnrollment or bankEnrollment you pass yourself.
  • linkAnotherCard: a hosted link session never shows it, whatever this is set to.
  • terms: a non-string text, a javascript:, data: or vbscript: URL, or an unknown field is refused.

Unchanged: subaccountId, companyName, getAccessToken, container, cardEnrollment, and the five callbacks.

An employee page sets persona: "cardholder":

UnifiedEnrollmentSdk.open({
  subaccountId: "<subaccountId>",
  companyName: "Your company",
  getAccessToken,
  persona: "cardholder",
});

Which value wins: subaccount policy or open() option

Each rail has a server field on the subaccount's enrollmentPolicy and an option in open(). The SDK picks one field at a time, in this order: the subaccount's value, then the account's value, then the open() option, then the default.

SettingServer field (PATCH /subaccounts/{subaccountId})open() optionDefaultWho wins
Card formenrollmentPolicy.cardEnrollmentcardEnrollmenttrueThe subaccount, then the account, then open()
Bank linkenrollmentPolicy.bankEnrollmentbankEnrollment"off"The subaccount, then the account, then open()
BulkenrollmentPolicy.bulkEnrollmentbulkEnrollment"off"The subaccount, then the account, then open()
Connect another company cardNot set through PATCH (Astrada manages it; the subaccount read shows the effective value)linkAnotherCardtruefalse on either side hides the button; nothing can turn it on against false

A rail the subaccount leaves unset (or clears with null) takes the account's value when there is one, then your open() option. Two exceptions to the order:

  • While Astrada has locked the account's bank link value (bankEnrollmentLocked: true on the subaccount read, read-only), that value applies whatever the subaccount or open() says.
  • An account bankEnrollment of "amex-visa" applies to every subaccount the same way.

route-decided reports where each field came from in provenance. When a rail's stored value and your open() option disagree, the SDK uses the stored value and logs a console warning, once per page load, that names each such rail with both values.

A policy change reaches the next session you open. If the same tab ran the SDK in the last 5 minutes, that session can start from the policy it read then; the new policy takes over on the card-number screen (on an employee page, the card form while nothing is typed in it), and a session already past that screen switches when it gets back there.

Consent and the terms box

The SDK sends the consent record with each card enrollment, including from hosted enrollment link pages, so you write no code for it. What it shows on a consent error and what it records: The consent record.

Two network consent boxes. Admin page, Visa: starts "I confirm this is a company card." Employee page, Mastercard: starts "I confirm I use this card for work." and includes the "Privacy Policy" link.

Admin and employee pages open the network box with different sentences.

Clip: a person types a test card, fills the form, ticks the consent box, presses Connect; the checklist runs; "You're all set!".

Tick, connect, success (16 s).

Enrollment links and hosted pages

An enrollment link lets people connect their own cards on a page Astrada hosts, so you need no SDK page of your own for them. A link opens one subaccount, and every card enrolled through it joins that subaccount. Astrada switches enrollment links on per account; until then the endpoints below answer 409 with ENROLLMENT_LINKS_NOT_ENABLED.

Your backend creates the link and hears what was enrolled:

sequenceDiagram
    autonumber
    participant B as Your backend
    participant A as Astrada API
    participant E as Employee
    B->>A: POST /enrollment-links {subaccountId, kind}
    A-->>B: 201 {id, url}, the only copy of the secret
    B->>E: Send the url
    Note over E: Uses the link (next diagram)
    A-->>B: cardsubscription.created webhook
    B->>A: GET /enrollment-links/{id}

The person uses the link on the hosted page:

sequenceDiagram
    autonumber
    participant E as Employee
    participant H as Hosted page
    participant A as Astrada API
    E->>H: Opens the link (enroll.html)
    H->>A: POST /enrollment-link-sessions/preview
    A-->>H: Platform, employer, brand
    E->>H: Get started (team link: Turnstile)
    H->>A: POST /enrollment-link-sessions
    A-->>H: Session, 300 s card token
    E->>H: Ticks consent box, submits card
    H->>A: Card enrollment calls, with consent
    H->>A: POST /enrollment-link-sessions/complete

There are two kinds of link:

  • Personal link. One link for one employee.
    • Your backend creates it with POST /enrollment-links, kind: "cardholder" and your API client. The customerReferenceId you send (a UUID, such as the employee it is for) is carried by every card enrolled through the link.
    • A personal link is used up by the first session that completes something, and allows at most 5 session starts before that.
    • It expires after 7 days unless you set expiresInHours.
  • Team link. One link to share with a team.
    • Your backend creates it with POST /enrollment-links and kind: "team" (14 days and 50 session starts by default, maxUses up to 500), or the SDK creates it with POST /subaccounts/{subaccountId}/team-link when an admin presses Invite your team on an ending: the admin sees a link to copy.
    • A session that ends from Invite your team always ends with next: "invite-team" on onSuccess and on the closed event: right away when enrollment links are off for the account, from Done on the link screen, or when the link can't be made. teamLink ({ id, url, expiresAt }) comes with it only when a link was made.
    • A page with bulkEnrollment: "forced" never offers Invite your team.

What the person sees

Link pages carry card enrollment only: no bulk enrollment and no bank step. A person who opens a working link goes through these screens:

  1. The start page. The link opens enroll.html under /unified/v2/ on the SDK host (sdk.astrada.co, or sdk.sandbox.astrada.co in sandbox), with the link's secret after #. The page strips the secret from the address before it makes any request.
    • It names your platform and the employer from the link's platformName and organizationName; once Astrada has set a brand profile for your account, it shows your name, accent color and logo instead of the plain Astrada header. The brand shows once, in the page header.
    • The consent text is Astrada's.
  2. Get started. The person presses Get started. A team link also asks the person to pass a Cloudflare Turnstile check first.
  3. The card form. The page runs the SDK as an employee page (persona: "cardholder") for the link's subaccount, so it opens on the card form. The card form's heading is the page's only heading. Because a link cannot pass terms, the card form shows only the network consent box.
  4. "You're done". The page's "You're done" is its one ending: the SDK's success screen closes as it opens, because a link session never offers Connect another company card and the screen has nothing but Done.

Before you create links

  • POST /enrollment-links needs subaccounts:write, so call it from your backend with your API client, never from a browser token. POST /subaccounts/{subaccountId}/team-link takes the SDK token's card-subscriptions:write, or an API client's subaccounts:write.
  • Both calls answer 409 with CARD_ENROLLMENT_OFF when card enrollment is off on the subaccount (enrollmentPolicy.cardEnrollment is false), because the hosted page has nothing else to offer.
  • Both calls answer 429 with RATE_LIMITED once your account has created 2,000 links in a UTC day, team links included. POST /subaccounts/{subaccountId}/team-link also stops at 20 links a day for one subaccount.
  • POST /subaccounts/{subaccountId}/team-link makes a new link on every call. A new link does not revoke an older one, so a link an admin already shared keeps working when they press Invite your team again. Each link ends at its own expiry, when its session starts are used up, or when it is revoked.
  • The response's url is the only place the secret is returned. Store or send it then; later reads such as GET /enrollment-links/{linkId} do not show it. POST /enrollment-links/{linkId}/revoke ends a link.
  • A session lasts 60 minutes; GET /enrollment-links/{linkId} lists each session with the ids the page reported. The cardsubscription webhooks stay the source of truth for what was enrolled.

Did this page help you?