SDK Initialization

This JavaScript SDK allows seamless integration of our payment gateway with various platforms, including Apple Pay, STC Pay, and websites. Before using any specific payment option, you must initialize the SDK by following the steps below. This ensures your integration is set up correctly and ready to process payments.

Step 1: Referring to JavaScript SDK

On the client side, refer to the paylink.js SDK library file as follows:

<script src="https://paylink.sa/assets/js/paylink.js"></script>

Step 2: Creating Payment JavaScript Object

Create Paylink Payments JavaScript object from paylink.js SDK library. Use the parameters as follows:

let payment = new PaylinkPayments({mode: 'test', defaultLang: 'ar', backgroundColor: '#EEE'});
Parameter NameDescriptionDefault Value
modeChoose the environment of the Paylink system:

- [production] for the production environment.
- [test] for the testing environment.
production
defaultLangChoose the language of the payment user interface:

- [en] for English.
- [ar] for Arabic.
en
backgroundColorThis field will contain the hex color of the background of the Paylink payment popup window.# EEE


Next Steps

Now that you've initialized the SDK, you can proceed to use one of the following methods: