interface saveToPayUI {
/**
* Shows the welcome UI. Redirects to welcomeCallbackUrl if it was
provided in the registration request when the page reaches one of
the final states.
*/
static void showWelcomeModal(S2PRequest r);
/**
* Shows the welcome UI. Resolves the promise with the status and
optionally details after the welcome UI is closed.
*/
static Promise <S2PResponse> showWelcomeModalPromise(S2PRequest
r);
/**
* API to close the modal
*/
static void closeWelcomeModal();
};
dictionary S2PRequest {
/**
* welcomeUrl provided by Save2Pay server in the registration
response.
*/
required DOMString welcomeUrl;
};
dictionary S2PResponse {
required Status status,
/**
* true if triggered by iframe closing (by user or parent page)
* false if the status is one of the final statuses, not triggered
by iframe closing. This can only happen in mobile android case.
*/
required boolean isIframeClosed,
/**
* Optional error information if the status is 'FAILURE'
*/
Details details
};
dictionary Details {
required ErrorCode errorCode;
DOMString message;
};
enum Status {
"SUCCESS",
"FAILURE",
"DEVICE_NOT_SUPPORTED",
"DEFAULT_PENDING"
};
enum ErrorCode {
"INVALID_INPUT",
"PROVISION_FAILURE",
"NETWORK_ERROR",
"UNKNOWN_ERROR",
"CARD_ALREADY_PRESENT",
"CANCELED"
};
var input = {
"welcomeUrl":
'https://s2p.mpay.samsung.com/v1/welcome/eyJlbmMiOiJBMjU2R0NNIiwiYWx
nIjoiZGlyIn0..eLtgW8qp56CIEzo2.mh34gjebgYP_M7-
gW0SbDL3CkaPlP7RtvMC8fe-TmQ2IPMP2rcC1A39qODbVW2sCHiArbooahBE77LPvL8NhKkaPI6MHYNL-Yz6GQx0Sjw.xfRTYjpdZxRnMlQ8Ffe6pg'
}
window.spay.saveToPayUI.showWelcomeModal(input)
Code Block- 3: JavaScript - Promise
var request = {
"welcomeUrl":
'https://s2p.mpay.samsung.com/v1/welcome/eyJlbmMiOiJBMjU2R0NNIiwiYWx
nIjoiZGlyIn0..eLtgW8qp56CIEzo2.mh34gjebgYP_M7-
gW0SbDL3CkaPlP7RtvMC8fe-TmQ2IPMP2rcC1A39qODbVW2sCHiArbooahBE77LPvL8NhKkaPI6MHYNL-Yz6GQx0Sjw.xfRTYjpdZxRnMlQ8Ffe6pg'
}
function successCallback(response) {
console.log(response.status)
}
function failureCallback(error) {
console.log(error)
}
window.spay.saveToPayUI.showWelcomeModalPromise(request).then(succes
sCallback, failureCallback)
PROMISE RESOLUTION
Device Type
Description
Desktop, Tablet & Mobile - iOS
JS library will resolve the promise - 1. When the iframe is closed by the user. 2 closeWelcomeModal function is invoked.
Mobile - Android
JS library will resolve the promise as soon as the provisioning session ends. Or closeWelcomeModal function is invoked. Provisioning session ends when one of the following has happened - 1. The card was successfully added. 2. There was some failure and card provisioning flow cannot continue further. 3. Timeout has happened. 4. User canceled the provisioning process.
Mobile Flows
Mobile Flows v5.00
(181.16 KB)Mar 30, 2023
Manage Your Cookies
We use cookies to improve your experience on our website and to show you relevant
advertising. Manage you settings for our cookies below.
Essential Cookies
These cookies are essential as they enable you to move around the website. This
category cannot be disabled.
Company
Domain
Samsung Electronics
.samsungdeveloperconference.com
Analytical/Performance Cookies
These cookies collect information about how you use our website. for example which
pages you visit most often. All information these cookies collect is used to improve
how the website works.
Company
Domain
LinkedIn
.linkedin.com
Meta (formerly Facebook)
.samsungdeveloperconference.com
Google Inc.
.samsungdeveloperconference.com
Functionality Cookies
These cookies allow our website to remember choices you make (such as your user name, language or the region your are in) and
tailor the website to provide enhanced features and content for you.
Company
Domain
LinkedIn
.ads.linkedin.com, .linkedin.com
Advertising Cookies
These cookies gather information about your browser habits. They remember that
you've visited our website and share this information with other organizations such
as advertisers.
Company
Domain
LinkedIn
.linkedin.com
Meta (formerly Facebook)
.samsungdeveloperconference.com
Google Inc.
.samsungdeveloperconference.com
Preferences Submitted
You have successfully updated your cookie preferences.