Scripting
What tenant scripts can do on The Wallet Crew, which endpoint or connector extension fits a need, the mental model behind every script and a build checklist.
Scripts let a brand plug its own logic into The Wallet Crew without a custom deployment: a few lines of JavaScript can fetch a loyalty balance from a CRM, choose which pass type a new customer gets, notify a warehouse when a pass is installed, or decide which email template an enrolment confirmation uses. The platform stays in charge of the flow (enrolment, pass creation, scheduling, sending); the script only answers the specific question the platform asks at a specific moment.
A script is useful only when the platform has an extension point for the need. The list of extension points is closed: each one has an exact registration key, exact handler names and an exact return shape, all documented in Runtime endpoints and, for connector-specific mapping, Connector scripts. When a need is not on those lists, a script cannot cover it, and the request goes to The Wallet Crew support.
I want to…
Show data from an external system (CRM, ERP, ticketing) on a pass
Pass data provider (Fill)
Move an older customerProvider script to the current model
Obsolete customer provider
Push a new registration to an external system when a customer enrols
Pipeline element in a flow (CreateOrUpdate)
Choose the pass type, or change the identifiers, while a pass is created or updated
Pass updater (OnPassCreating, OnPassUpdating)
React when a pass is created, updated, installed or uninstalled
Pass updater (notification hooks)
Update many passes on a schedule from a query run by a script
Scripted push updates (GetPasses)
Transform the rows of a bulk pass-update file before they are applied
Row transformer
Send the platform's transactional emails through another provider
Email engine (SendEmail)
Choose, or skip, the enrolment confirmation email
Email challenge template finder
Refuse an enrolment that does not satisfy a business rule
Account validator (Validate)
Adjust how a connector maps its data (Cegid, Secutix, Bloomreach, …)
Connector extension scripts
The mental model
Every script follows the same five steps. Understanding them removes most of the surprises, because almost every scripting problem is a failure at one of the five. A pass type is shown as a pass template in the admin console; the scripting pages say pass type, as the configuration files do.
Files. A script is a JavaScript file stored under
server/scripts/in the tenant's advanced configuration, in the admin console under Settings → Advanced → Advanced configuration. Every file in that folder, subfolders included, whose name ends in.jsis a script. Scripts are part of the configuration: they are versioned and saved together with the other configuration files.Loading. Each platform component loads every script file the first time it needs one; a saved change applies from the next request or job (How scripts run).
Registration. Each file exports a default function that receives a
contextand callscontext.register(key, handlers). The key names the extension point (for exampleruntime.scriptable.passDataProvider.memberLookup) andhandlersis an object whose properties are the functions the platform may call.Calling. When the platform reaches an extension point, it looks the key up and calls the handler by its exact, case-sensitive name (
Fill,OnPassCreating,GetPasses, …) with the documented arguments. Some extension points also need a line of configuration that points at the script, such asscriptIdin a pass type or a flow.Returning. The handler returns a value, which the platform converts by member name; Handlers tabulates what a missing, empty or failing handler does.
The time limits are stated in How scripts run.
Where to start
A first working script takes a few minutes: First script creates a pass data provider end to end, wires it into a pass type and verifies the result. The other pages of this section then cover the topics in the order they usually come up.
Build and verify a working pass data provider
Understand loading, registration, validation at save and the effect of an error
Know how handler names, return values and failures are handled, with a table for every endpoint
Read and write the entity, identifiers, dates, numbers and enums correctly
Start from a tested pattern for a common need
Go from a symptom to its cause
Review a script before it goes to production
Build checklist
Before writing scripts, settle the following items with the brand and its partners. A missing item is the usual origin of an unstable connector in production.
Identifier strategy
Stable identifier fields (customerId, membershipId, ticketId, and so on) available on every pass-relevant record. They link wallet passes to source records over time.
Data ownership
The source system and its owner are explicit for profile, loyalty, transaction and ticket data. The owner controls the business rules and the data quality.
Trigger model
A clear decision on how data is fetched (pull, push or lifecycle hooks) and which endpoint runs when: data provider, pipeline step, pass hooks, scheduled list. It also defines when updates are propagated.
API or event contract and security
The authentication, payload shape and error handling of each external call. Use API keys or OAuth, with the credentials stored as secrets.
Operational ownership
The team that monitors integration failures and retries, with the retry, timeout and monitoring behavior agreed.
FAQ
Last updated

