Utilize the Add to Samsung Wallet service for digital cards
NoteScenes in the demo video are simulated and does not represent any real-world conditions or outcomes.
Objective
Learn how to use the Add to Samsung Wallet service so that users can store digital contents, such as boarding passes, tickets, and coupons, to their Samsung Wallet app.
Partnership Request
To create, manage, and monitor performance of wallet cards with the Samsung Wallet Partners site, you must become an official Samsung partner. Once done, you can fully utilize this Code Lab. You can learn more by visiting Samsung Wallet Partner Onboarding process, here in Samsung Developers.
Overview
Samsung Wallet is an application that securely stores essential items such as boarding passes, tickets, and coupons, making them easily accessible from anywhere. With this app, users can access various partner wallet cards in one place, simply by swiping up from the bottom of the screen.
The Add to Samsung Wallet service provides interfaces for users to conveniently add digital content to Samsung Wallet. Here are examples of the supported wallet cards:
-
Boarding Pass
Journey information such as flights, trains, and buses can be provided as notifications, allowing easy retrieval when checking in. By configuring server synchronization, updates to journey information such as gate changes, schedule changes, or cancellations can be received by the users.
-
Ticket
Notifications about events and additional information, including benefits, can be provided. Based on real-time utilization of performances, sports games, movies, and admission tickets, status updates related to expiration and availability can be provided.
-
ID
ID cards can fulfill identification verification purposes, such as identity cards, employee cards, and licenses. Physical documents can be represented through wallet cards, and near field communication (NFC)-based authentication can be provided.
-
Reservation
Reservation cards can contain diverse online booking details, including rental cars, restaurants, and accommodations. Ongoing reservation information can be managed as a journey.
The image below shows the process of managing wallet cards.
For more information, refer to Manage Wallet Cards.
Set up your environment
You will need the following:
-
Latest version of Samsung Wallet app from Galaxy Store
-
Samsung Galaxy device that supports Samsung Wallet
-
Access to Samsung Wallet Partners site
-
Internet browser, such as Chrome
-
OpenSSL
-
IntelliJ IDEA or any Java IDE (Optional)
Start the onboarding process
Partners can manage wallet cards and monitor performance with the Samsung Wallet Partners site. To join as partner:
- Generate a private key and certificate signing request (CSR) using the OpenSSL command. You can follow the instructions in Security Factors.
NoteA private key enables encryption and is the most important component of certificates. While CSR, which is a necessary factor to obtain a signed certificate, includes the public key and additional information like organization and country.
-
Proceed to register in the Samsung Wallet Partners site using your Samsung Account. Follow the Samsung Wallet Partner Onboarding process.
-
Upload the generated CSR for data encryption in Encryption Setting Management section.
-
After registration, you will receive a welcome email.
NoteUpon receiving the certificates via email, be sure to keep the information safe from exposure and only use them for the following purposes:
- Signed Certificate: used along with the private key to sign data.
- Samsung Certificate: used to encrypt card data and validate authentication tokens in server API headers.
Create a wallet card
Follow the steps below to create a wallet card in Samsung Wallet Partners site:
-
Click the Wallet Cards menu and choose Create Wallet Card.
-
Fill out the General information form with the details of the wallet card.
-
In Wallet Card Template, choose a card type and sub type.
-
Select the design type and click Done. You can choose from various types of wallet card templates optimized for partners.
- After inputting all necessary details, click Save to set the wallet card status to Draft.
Launch the wallet card
You can launch and request activation of the card by clicking the Launch button.
Upon agreeing to proceed, the Launch button text changes to Launched and the card status becomes Verifying.
-
Open a web browser on your computer or Galaxy mobile device, and go to the following link:
partner.walletsvc.samsung.com/addToWalletTest
-
Go to Add To Wallet tab and click Choose Key File to upload your private key.
-
In the Select Card dropdown menu, select the created card to display the card details and populate sample data.
-
Navigate to the Form tab and modify the card data as desired.
-
Scroll down to the bottom of the page and click the Add to Samsung Wallet button.
-
Click Done when a preview of the card shows on your mobile screen with a message indicating that the card has been added to your wallet.
-
Once the card is added to your Samsung Wallet app, you can check its details by clicking on it.
NoteYou can also go to the Playground tab and add cards to the Samsung Wallet app even without creating a card on the Wallet Partners site.
Update the status of the added card
If a server API info (Partner Get card data and Partner Send card state) is registered in the wallet card, real-time updates of the user's registered cards can be provided.
Modify and update the card's status by utilizing the Push Notification feature of the Test Tool.
-
Navigate to the Push Notification tab.
-
Ensure that the correct private key is uploaded and the same card as in the Add to Wallet tab is selected.
-
Copy the Ref ID value from the Add to Wallet tab and paste it into Ref ID field in the Push Notification tab.
-
In the Status field, enter one of the following card states: EXPIRED
, REDEEMED
, HELD
, SUSPENDED
, or DELETED
. The current state is set to ACTIVE
.
-
Then, click the Request Push Notification button.
-
Check the card in the Samsung Wallet app to confirm the change.
NoteThis step is optional, but if you want to learn how to integrate the Add To Samsung Wallet button into your services like an Android app, web app, or email, you can follow these steps.
The Samsung Wallet Partners site provides generated Add to Samsung Wallet scripts for each wallet card you create. You can simply copy and paste these scripts into your partner apps (Web and Android) or include them in emails/MMS messages.
To implement the Add to Wallet button, follow these steps:
-
Go to the [Add to Wallet Script Guide] section of the card you created. Click Show to view the available scripts and then copy the appropriate script for your service.
-
Develop a program that can generate tokenized card data (CData). The CData represents the actual content of the wallet card and comes in different formats depending on the card type. You can check the CData Generation Sample Code for reference.
-
The CData is derived from the card data, which is in JSON format. For testing purposes, you can utilize the generated JSON from the Test Tool.
-
Follow the Implementing ATW button guide to determine where to incorporate the generated CData and gain further insights into this process.
You're done!
Congratulations! You have successfully achieved the goal of this Code Lab topic.
Now, you can utilize the Add to Samsung Wallet service by yourself!
To learn more about Samsung Wallet, visit:
developer.samsung.com/wallet