®
Salesforce: wallet passes from Flow
You use Salesforce for your customers and members: it is where each account, each contact, their status and their history are kept.
You need to put a card in the phone wallet of each of them, a loyalty card, a membership card or a VIP card: issued the moment the record exists, kept true as the record changes, and visible in Salesforce as carried or not.
Pass Studio does that from Salesforce itself. A record is created and the card is issued; the record changes and the card on the phone changes with it; the person adds or removes the card and the record says so. You build it in Flow Builder, with nothing to install.
The card lives in Apple Wallet or Google Wallet, already on every phone: your members install no app.
What it is for
Every new customer or member gets a card, with no card run
A customer or member record is created in Salesforce and a personal card is issued the same minute. Pass Studio emails the Add to Wallet link, or you place the link from the Pass Studio Wallet Link field in your own welcome email, text or portal page.
The card always shows the customer's or member's current status
A tier, level, account number or name changes on the record and the card on the customer's phone changes with it, with a push. Add a message to the call and the customer sees a lock-screen notification, for example that they reached a new tier.
Know who actually carries the card
Pass Studio Wallet Status on the record reads Installed once the customer adds the card, and Removed if they delete it. A Salesforce report or list view of customers with an empty status is your reminder list; Removed is an early sign that a customer is drifting away, which no other field on the record gives you.
Reward customers and members from the system that records what they did
A closed sale, a renewal, a referral or a resolved case is recorded in Salesforce and points are added to the customer's card. The balance changes on the phone, and rewards and tiers follow the rules set on the pass in Pass Studio.
Recognize customers and members at a counter or a door
Staff scan the card's barcode with the Pass Studio staff app in the browser of any phone or tablet. They need no Salesforce login and no Salesforce license. The card they scan is the one Salesforce issued, so the customer shown is the customer on the record.
Build it!
Before you start
- A published pass in Pass Studio, and its pass id: open the pass in the Studio, the id is the line under the pass name, and a click copies it.
- A Pass Studio API key, created in Settings → API Keys. Name it after the org so it can be revoked on its own.
- The pass's field keys, for the values you want on each card: a Loyalty / Membership pass has
memberName,memberId,pointsandtier(GET /api/v1/passeslists them asfieldKeys). - A Salesforce user who can edit Named Credentials, Permission Sets, Object Manager and Flows.
The steps
- Store the API key in a named credential: Salesforce keeps your Pass Studio key and sends it with every call.
- Add two fields to the record: one for the card's id, one for its Add to Wallet link.
- Issue a pass when a Contact is created: a flow that issues the card and saves it on the record.
- Update the card when the record changes: a second flow that keeps the card in step with the record.
- Know in Salesforce what happens on the phone: optional: the record shows when the card is added to a wallet or removed.
Step 1. Store the API key in a named credential
The key is kept in Salesforce's credential store and never appears in a flow.
In Salesforce, signed in as an administrator, click the gear icon at the top right and choose Setup. Then:
- Create the external credential.
- In the Quick Find box type and open it.
- Open the External Credentials tab.
- Click New.
- Label: . Name: .
- Authentication Protocol: Custom.
- Click Save. The external credential opens.
- Put your API key in it.
- Under Principals click New.
- Parameter Name: .
- Under Authentication Parameters click Add.
- Name: . Value: your Pass Studio API key.
- Click Save.
- Add the header that sends the key.
- Under Custom Headers click New.
- Name: .
- Value:
- Click Save.
- Create the named credential.
- Go back to Named Credentials, open the Named Credentials tab and click New.
- Label: . Name: .
- URL:
- External Credential: Pass Studio.
- Clear Generate Authorization Header.
- Tick Allow Formulas in HTTP Header.
- Click Save.
- Let your users use the key.
- In the Quick Find box type and open it.
- Click New. Label: . Click Save.
- In the permission set open External Credential Principal Access and click Edit.
- Move PassStudio - Key to Enabled and click Save.
- Click Manage Assignments, then Add Assignment.
- Tick every user whose record changes should issue or update a pass, click Next, then Assign.
Step 2. Add two fields to the record
In Setup, open the Object Manager tab, then Contact, then Fields & Relationships. Then:
- Create the field that holds the card's id.
- Click New.
- Data type: Text. Click Next.
- Field Label: . Length:
64. The Field Name fills in by itself. - Click Next, then Next again to keep the default access and page layouts.
- Click Save & New.
- Create the field that holds the Add to Wallet link.
- Data type: Text. Click Next.
- Field Label: . Length:
255. - Click Next, then Next again.
- Click Save.
Step 3. Issue a pass when a Contact is created
In Setup, type in the Quick Find box and open it. Then:
- Start the flow.
- Click New Flow and choose Record-Triggered Flow.
- Object: Contact.
- Trigger the Flow When: A record is created.
- At the bottom of the panel turn on Add Asynchronous Path. Flow Builder requires it for a call to an outside system; the call runs after the record is saved.
- Create the call to Pass Studio.
- On the Run Asynchronously path click + and choose Action.
- At the bottom of the action list click Create HTTP Callout.
- Name: . Named Credential: Pass Studio API. Click Next.
- Label: . Method: POST.
- URL Path:
- A key named
passIdappears under the path: set its Data Type to String. Click Next. - Paste this sample request, click Review, then Next:
{ "email": "test-holder@example.com", "name": "John Appleseed", "customerId": "003000000000001AAA", "source": "salesforce", "sendEmail": false, "fields": { "memberName": "John Appleseed" } } - Keep Connect for Schema and click Next.
- Enter your pass id as the value of
passIdand click Connect. The status is201and one test card is issued to the sample email. - On the Data Structure tab, set every field shown with no type to String.
- Click Save.
- Fill the request from the record.
- In the action panel, Label: . Value of
passId: your pass id. - Click the Value box of
body, choose New Resource, name it and click Done. - Above the action click + and add an Assignment. Label: .
- Add one row per line of the table "The request body" below. The variable is typed as , and so on.
- In the action panel, Label: . Value of
- Save the card on the record.
- Below the action click + and add Update Triggering Record.
- Field: Pass Studio Instance ID. Value:
- Click Add Field. Field: Pass Studio Wallet Link. Value:
- Turn it on.
- Click Save and name the flow, for example .
- Click Activate.
The request body
| IssueBody | Value | What it is |
|---|---|---|
| Triggering Contact > Email | The holder's email. Also the key that stops a second card: a repeat call with the same email returns the existing card. | |
| name | {!$Record.FirstName} {!$Record.LastName} | The holder's name, for the wallet email. |
| customerId | Triggering Contact > Contact ID | Your record's id, stored on the card as an external id. |
| source | salesforce | Names the system the customerId comes from. Typed as plain text. |
| sendEmail | True or False | True: Pass Studio emails the Add to Wallet link. False: you deliver addToWalletUrl yourself. Leave the row out to follow the pass's own setting. |
| fields > memberName | {!$Record.FirstName} {!$Record.LastName} | One row per value you want on the card. The keys are the pass's own field keys. |
What comes back
The answer arrives in the same call, so the record is complete with no webhook.
| instanceId | This holder's card. Store it on the record: the update call needs it. |
| addToWalletUrl | The holder's own Add to Wallet link, for an email, a text or a portal page. |
| barcodeContent | The code in the card's barcode. |
| alreadyExisted | true when the holder already had this card and nothing new was issued. |
| emailSent | true when Pass Studio sent the wallet email. |
A repeat call for a holder who already has the card returns the card unchanged; values sent in fields on that repeat call are not applied, which is what the update flow is for.
Step 4. Update the card when the record changes
The example writes the Contact's Title to the card's field. Use any field of yours and any key of your pass.
In Setup, open Flows again. Then:
- Start the flow.
- Click New Flow and choose Record-Triggered Flow.
- Object: Contact.
- Trigger the Flow When: A record is updated.
- Condition Requirements: All Conditions Are Met (AND).
- First row. Field: Title. Operator: Is Changed. Value: True.
- Click Add Condition. Field: Pass Studio Instance ID. Operator: Is Null. Value: False.
- At the bottom of the panel turn on Add Asynchronous Path.
- Create the call to Pass Studio.
- On the Run Asynchronously path click +, choose Action, then Create HTTP Callout.
- Name: . Named Credential: Pass Studio API. Click Next.
- Label: . Method: PATCH.
- URL Path: . Click Next.
- Paste this sample request, with the
instanceIdof the test card you issued in Issue a pass when a Contact is created, click Review, then Next:{ "instanceId": "518a80b3-f93a-5ff5-9d28-85ec38037c05", "fields": { "tier": "Gold" } } - Keep Connect for Schema, click Next, then Connect. The status is
200, withupdatedFieldsandpushed: true, and the test card changes. - Click Save.
- Fill the request from the record.
- In the action panel, Label: .
- Click the Value box of
body, choose New Resource, name it and click Done. - Above the action click + and add an Assignment. Label: .
- First row. Variable: . Value: Triggering Contact > Pass Studio Instance ID.
- Click Add Assignment. Variable: . Value: Triggering Contact > Title.
- Turn it on.
- Click Save and name the flow, for example .
- Click Activate.
Per-holder values set this way stay on the card through later changes to the pass design. Add "message" to the body to show the holder a notification with the update. The full contract is under Update Pass for One Holder in the API guide.
Step 5. Know in Salesforce what happens on the phone
Issuing and updating go one way: Salesforce calls Pass Studio. The other direction is a Pass Studio webhook that tells Salesforce the holder added the card to a wallet, removed it, or had their points changed. This part is not no-code: Salesforce accepts a request that carries no Salesforce login only through an Apex class on a public Site, and the class checks Pass Studio's signature instead.
The record changes within seconds of the event: a customer adds the card to their wallet and Pass Studio Wallet Status reads Installed. A Contact does not need an Account for this to work.
What the receiver writes
Every signed event for a card whose id is on a record sets Pass Studio Last Event to the event name:
| pass.issued | The card was issued. It is written once the issue flow has saved the card's id on the record; an event that arrives before the id is saved finds no record and is not written. |
| pass.installed | The holder added the card to Apple Wallet or Google Wallet. The receiver also sets Pass Studio Wallet Status to Installed. |
| pass.removed | The holder removed the card from the wallet. The receiver also sets Pass Studio Wallet Status to Removed. |
| holder.points_changed | The holder's points balance changed. |
| holder.updated | A points award or deduction, a tier move or a field correction entered on the member's card, with the values before and after. |
Set it up
- Add two more fields to the record, as in Add two fields to the record.
- : Text, length
64. - : Text, length
64.
- : Text, length
- Create the setting that holds the signing secret.
- In Setup, type in the Quick Find box, open it and click New.
- Label: . Object Name: . Setting Type: Hierarchy. Click Save.
- Under Custom Fields click New. Data type: Text. Click Next.
- Field Label: . Length:
255. Click Next, then Save.
- Add the receiver class.
- In Quick Find type , open it and click New.
- Paste the receiver class and click Save.
- Click New again, paste the test class and click Save.
- On the test class click Run Test. Four tests pass.
- Give the class a public address.
- In Quick Find type and open it.
- The first time, accept the Sites terms and click Register My Salesforce Site Domain. Salesforce asks you to confirm, because the domain name cannot be changed afterward.
- Click New. Site Label: . Site Name: .
- Active Site Home Page: . Tick Active. Click Save.
- Let the Site run the class and find the record.
- On the Site click Public Access Settings.
- Go to Enabled Apex Class Access and click Edit. Move PassStudioWebhook to Enabled and click Save.
- Click Edit at the top of the profile and go to Standard Object Permissions.
- Tick Read on Accounts first, then Read on Contacts. Salesforce only lets Contacts be ticked after Accounts.
- Click Save.
- Point Pass Studio at it.
- In Pass Studio open Settings → Webhooks and click Add endpoint.
- URL: . Your Site domain is shown on the Sites page in Salesforce.
- Copy the signing secret Pass Studio shows for the endpoint.
- In Salesforce open Custom Settings and click Manage next to Pass Studio Settings.
- Click New above Default Organization Level Value, paste the secret into Webhook Secret and click Save.
Check that it works
Add a card to a wallet on your own phone. Within seconds the record's Pass Studio Wallet Status reads Installed. If it does not, open Settings → Webhooks in Pass Studio, click View log on the endpoint and read the status of the last delivery:
401: the secret saved in Salesforce is not this endpoint's signing secret. Paste it again.500: the Site's guest profile cannot read Contacts. Tick Read on Accounts, then on Contacts.200and the record did not change: no record holds this card's id in Pass Studio Instance ID. Check that the flow that issues the pass filled it.
Then add or remove the card again: a delivery that failed is not sent a second time.
One rule matters for anyone who writes their own receiver. Since Salesforce API version 67.0 (Summer '26) Apex reads and writes with the running user's access by default, and a Site's guest user sees no Contacts: the query returns nothing and no error is raised. The receiver asks for system mode on both statements (WITH SYSTEM_MODE on the query, update as system on the write); without sharing on the class is not enough.
A delivery that fails is tried five times in all, over about three minutes, and then marked failed, so an event sent while the receiver is misconfigured is not replayed later. An endpoint that fails five deliveries in a row is switched off; add it again in Settings once the receiver answers. The receiver class and its test class come with the Salesforce automatic connection script.
Good to know
- Connect sends a real request. In the HTTP Callout wizard, Connect for Schema calls the Pass Studio API with your sample body. On the issue call it issues a real card; on the update call it changes a real card. Use a throwaway email and "sendEmail": false in the sample, and a test card's instanceId.
- Empty response fields need a type. A field that comes back null in the sample (passstudioHolderId, messageChannel, messageStatus and messageError on a first issue) is shown with no data type. Set each to String before saving.
- The path variable needs a type. {passId} in the URL path is listed as a key with an empty Data Type. Set it to String, or Next stays blocked.
- One external service per callout. Each Create HTTP Callout in Flow Builder asks for a new external service name. This recipe ends with two: PassStudio and PassStudioUpdate. Both use the same named credential.
- Is Changed, not a formula. A record-triggered flow with an asynchronous path does not activate when its entry condition is a formula that uses ISCHANGED. Use a condition row with the operator Is Changed.
- A field update is not echoed back. PATCH /api/v1/instances/fields changes the card and sends no webhook, so an update you send from Salesforce never comes back through the receiver.
- The pass must be published. Issuing on a draft answers 409 pass_not_active. Publish the pass in the Studio first.
- Field keys are checked. A key the pass does not have answers 400 unknown_field_key with the valid keys listed. Keys that are the same on every card (for example programText and expiryDate on a Loyalty / Membership pass) are refused on these two calls.
Other ways to connect Salesforce
- The Salesforce automatic connection script: one script sets up in your org everything on this page, the receiver and its Site included, and points the flows at the pass you choose. It runs with the Salesforce CLI on macOS, Linux or Windows with Git Bash. A team owner downloads it in Pass Studio: Settings → Integrations → Salesforce.
- Zapier: the Pass Studio app issues and updates passes from Salesforce record triggers with no setup inside Salesforce.
- The REST API from Apex or from your middleware: every call on this page is a plain HTTPS request with a bearer key.
What it does
Two record-triggered flows call the Pass Studio REST API through a named credential. The first issues a pass when a Contact is created and saves the card's id and its Add to Wallet link on the Contact. The second updates the card when a field on the Contact changes, and the pass on the holder's phone updates with a push. The example uses Contact; the same steps work on any standard or custom object that holds an email.
There is no managed package and no Apex in these two flows; only the optional write-back uses Apex. The pass itself, its design, its loyalty rules and its barcode live in Pass Studio; Salesforce stays the place where the customer or member record is kept.
Salesforce and the Salesforce cloud logo are registered trademarks of Salesforce, Inc., used here to identify the product Pass Studio connects to. Pass Studio is not affiliated with or endorsed by Salesforce.