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.
1. Getting Token
From the server side, programmatically generate a token from the backend server using the Paylink Authentication endpoint. then client-side code will use this token.
2. 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>
3. 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 Name | Description | Default Value |
---|---|---|
mode | Choose the environment of the Paylink system: - [production] for the production environment. - [test] for the testing environment. | production |
defaultLang | Choose the language of the payment user interface: - [en] for English. - [ar] for Arabic. | en |
backgroundColor | This 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:
Updated 18 days ago