Skip to main content

SDK Initialization

Include the Skrill JS script in your HTML:

<script src="https://pay.skrill.com/skrill-js/skrill.min.js"></script>

This exposes the global variable skrill used for initialization and control over the payment flow.

After a payment session is created and the Payment Session ID is obtained, the SDK is initialized in the following way:

const instance = await skrill.fields.setup(merchantId, sessionId[, configuration]);

Function arguments are the following:

ArgumentDescriptionExample
merchantIdSkrill Merchant ID1001
sessionIdSkrill Payment Session IDebed38d22295c787fefa3119fcd36c39
configurationOptional JSON object with additional configSee Additional Configuration

In order for Skrill JS to inject the input fields, placeholders have to be present on the Merchant's website for each field: card number, expiry date, CVV, cardholder name, payer e-mail and the card store consent (needed for Visa card payments).In case the Merchant provided the payer e-mail upon Payment Session creation, the e-mail field won't be needed. Same applies for the consent field in case the Merchant does not accept Visa payments. Otherwise, consent will be dynamically shown if the entered card number is a Visa one. See Additional Configuration section to find out how to configure the CSS selectors for each placeholder.

The set-up function returns a promise. In case of successful initialization, the promise will resolve to a Skrill JS instance. In case of failure, the promise will be rejected with an error (see Exception Handling section for more details). Here is an initialization example:

const instance =
await skrill.fields.setup(merchantId, sessionId)
.catch((error) => {
// Handle initialization error
});

On the Merchant's website, placeholder HTML elements should be present for each input field. See Additional Configuration section to find out how to configure the CSS selectors which will be used to locate those elements.

Example result of initialization in case payer e-mail is provided in the Payment Session:

Example result of initialization in case payer e-mail is not provided in the Payment Session and the payer entered a Visa card number: