Configuration

The legacy Card Enrollment SDK's openForm parameters, the network and customer consent texts, your own terms, where the SDK renders, and progress messages.

Configuration

In this section, you will learn how to configure the parameters when calling the CardEnrollmentSdk.openForm(config)method. The following config parameters are supported:

ParameterTypeRequiredDescriptionExample
companyNamestringYesThe name of the company using card linking"Your company name"
subaccountIdstringYesA valid UUID of the Astrada subaccount where the card should be enrolled"67bc3887-4e25-49cf-bea7-326d808acb5f"
terms.textstringNoMarkdown text for a customizable consent messageBy checking this box, you are indicating that you agree to the terms and policy.
terms.privacyUrlstringNoURL to privacy documentationhttps://yourcompany.com/privacy
terms.termsUrlstringNoURL to terms and conditions documentationhttps://yourcompany.com/terms
statusLabels.creatingSubscriptionstringNoOverrides the progress message shown while the card subscription is createdSecurely connecting your card
statusLabels.startingVerificationstringNoOverrides the progress message shown while card verification startsContacting your bank
statusLabels.verifyingstringNoOverrides the progress message shown while the card is verifiedVerifying with your bank
statusLabels.finishingstringNoOverrides the progress message shown while enrollment is finalizedFinalizing your enrollment
customerReferenceIdstringNoA valid UUID used to correlate the card enrolment"67bc3887-4e25-49cf-bea7-326d808acb5f"
getAccessTokenfunctionYesAn asynchronous function that returns a valid Access Token to request Astrada's API
getAccessTokenTimeoutMsnumberNoMilliseconds to wait for getAccessToken to resolve before the token fetch times out. Defaults to 5000.5000
onConnectfunctionNoFunction to be triggered when the cardholder submits the card form and verification begins
onSuccessfunctionNoFunction to be triggered when the cardholder successfully enrolls a card
onErrorfunctionNoFunction to be triggered when an error occurs during the card enrollment (e.g. failure to create a card subscription, verify the card, etc)
onCancelfunctionNoFunction to be triggered when the cardholder abandons/cancels the enrollment flow
containerHTMLElementNoThe HTML element in which the SDK should be rendered.document.querySelector(“#container-div”)
metadataobjectNoReserved. Accepted and validated, but not currently forwarded to the enrollment API, so it has no runtime effect yet.{"orderId": "1234"}
CardEnrollmentSdk.openForm({
  companyName: "Your company name",
  subaccountId: "67bc3887-4e25-49cf-bea7-326d808acb5f",
  getAccessToken: async () => 'valid-json-web-token',
  getAccessTokenTimeoutMs: 5000, // optional, raise if your token exchange is slow (default 5000)
  onConnect: () => console.log("Card submitted; verification started."),
  onSuccess: (data) => console.log(data),
  onError: (data) => console.log(data),
  onCancel: () => console.log("The user abandoned the enrollment flow."),
  terms: {
  	text: "By checking this box, you are indicating that you agree to the [terms](https://yourcompany.com/terms) and [policy](https://yourcompany.com/policy)."
	}
   // Add more configuration parameters here if needed
  ...
});

Customization

Consent Message

Approved Consent Language:

The form collects up to two consents: the Network Consent, always shown and not customizable, and your customer consent, shown when you pass terms.

The texts below are quoted from the SDK's source. The SDK fills {{scheme}} with the card's network: Visa or Mastercard, and in the Unified Enrollment SDK also American Express ("your card network" until the card number shows the network). Each tag in angle brackets is a link. In the customer text, the two empty tags are your terms and privacy links, named with your companyName, and {{and}} joins them.

Network consent, Visa:

By submitting your card information and checking this box, you authorize {{scheme}} to access, monitor and share transaction data (e.g., amount, time, date, and merchant name) with Astrada (our service provider) for the purposes of identifying relevant transactions and carrying out related spend management services. You also affirm that the card being monitored is used primarily for business purposes.

Network consent, Mastercard:

By submitting your card information and checking this box, you authorize {{scheme}} to access, monitor and share transaction data (e.g., amount, time, date, and merchant name) according to its <mastercardPrivacyLink>Privacy Policy</mastercardPrivacyLink>, with Astrada (our service provider) for the purposes of identifying relevant transactions and carrying out related spend management services. You also affirm that the card being monitored is used primarily for business purposes.

Network consent, American Express (Unified Enrollment SDK only): the Visa text above.

In the Unified Enrollment SDK, the network consent box starts with one more sentence before the network text: "I confirm this is a company card." on admin pages, or "I confirm I use this card for work." on employee pages. The record names the whole box, that sentence included.

Customer consent, the default text with your links (see below):

By submitting your card information and checking this box, you affirm your consent so that Astrada may process said data in accordance with <customerTermsAndConditions></customerTermsAndConditions> {{and}} <customerPrivacyPolicy></customerPrivacyPolicy>. You also acknowledge and agree that relevant transaction details may be shared with involved third parties to enable spend management processes, in accordance with <astradaPrivacyLink>Astrada's Privacy Policy</astradaPrivacyLink>. You may opt out of transaction monitoring on the payment card you entered at any time by going to your account settings.

Rely on the default consent language

If the terms object is not passed to openForm, the form shows the network consent only, with no customer consent box. What the SDK records: The consent record.


Card Enrollment SDK form, Mastercard test card, one box: the Mastercard network consent with the "Privacy Policy" link, no customer box.

No terms: the network consent only.

Illustration; the wording above is authoritative.


Customize links within the Customer default consent language

If you want to rely on both consent languages, network-specific and customer, you can proceed with the default consent message and insert your company's Privacy Policy and Terms & Conditions, follow the example below:

CardEnrollmentSdk.openForm({
  companyName: "",
  subaccountId: "",
  getAccessToken: async () => "<access token>",
  terms: {
    privacyUrl: "YOUR_PRIVACY_URL_HERE",
    termsUrl: "YOUR_TERMS_URL_HERE",
  }
});
Mastercard network box with "according to its Privacy Policy", and the default customer box linking Northwind Travel's Terms and Conditions, Northwind Travel's Privacy Policy and Astrada's Privacy Policy.

termsUrl and privacyUrl in Astrada's default text.

Illustration; the wording above is authoritative.


Customize customer consent language

To set up a fully customizable consent message, use the following code snippet::

CardEnrollmentSdk.openForm({
  companyName: "",
  subaccountId: "",
  getAccessToken: async () => "<access token>",
  terms: {
    text: "By checking this box, you are indicating that you agree to the [terms](https://yourcompany.com/terms) and [policy](https://yourcompany.com/policy).",
  }
});
Mastercard network box, and a second box with the host's own text: "By checking this box, you are indicating that you agree to the terms and policy."

Your own terms.text (the example above).


The consent record

The SDK sends the consent record with the card subscription, so you write no code for it. On a consent error onError receives the code. What the screen shows and what the record names: The consent record.

Card Enrollment SDK screen: "We couldn't record your consent", "Trying again won't fix this. Please contact your spend management provider for support.", Close button.

Card Enrollment SDK, any card_subscription.consent_* code.

Customize where the SDK should be rendered

To customize where the SDK is rendered on your page, follow the example below:

CardEnrollmentSdk.openForm({
  companyName: "",
  subaccountId: "",
  getAccessToken: async () => "<access token>",
  container: document.querySelector("#container-div")
});

The SDK will render at full-page scale if the HTML element is absent.

Progress Messages

Creating the card subscription and verifying the card can take some time. To make the wait easier to follow, the SDK shows a short progress checklist that advances through the enrollment: Securely connecting your card → Contacting your bank → Verifying with your bank → Finalizing your enrollment.

Rely on the default progress messages

If statusLabels is not passed to openForm, the built-in messages above are shown.

Customize the progress messages

Pass statusLabels to override any subset of the stage messages; omitted stages keep the built-in copy. Each key maps to a stage of the enrollment:

CardEnrollmentSdk.openForm({
  companyName: "",
  subaccountId: "",
  getAccessToken: async () => "<access token>",
  statusLabels: {
    creatingSubscription: "Securely connecting your card",
    startingVerification: "Contacting your bank",
    verifying: "Talking to your card issuer",
    finishing: "Finalizing your enrollment",
  },
});

Did this page help you?