---
updatedAt: 2025-09-09T21:12:09.000Z
agentTools:
  projectIndex: https://developer.paylink.sa/llms.txt
---

# 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](https://developer.paylink.sa/docs/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:

```javascript Call Sript
<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:

```javascript Payment
let payment = new PaylinkPayments({mode: 'test', defaultLang: 'ar', backgroundColor: '#EEE'});
```

<Table align={["left","left","left"]}>
  <thead>
    <tr>
      <th>
        Parameter Name
      </th>

      <th>
        Description
      </th>

      <th>
        Default Value
      </th>
    </tr>
  </thead>

  <tbody>
    <tr>
      <td>
        mode
      </td>

      <td>
        Choose the environment of the Paylink system:  

        * **ally generat** for the production environment.
        * ** the [** for the testing environment.
      </td>

      <td>
        production
      </td>
    </tr>

    <tr>
      <td>
        defaultLang
      </td>

      <td>
        Choose the language of the payment user interface:  

        * **gene** for English.
        * **e ba** for Arabic.
      </td>

      <td>
        en
      </td>
    </tr>

    <tr>
      <td>
        backgroundColor
      </td>

      <td>
        This field will contain the hex color of the background of the Paylink payment popup window.
      </td>

      <td>
        # EEE
      </td>
    </tr>
  </tbody>
</Table>

***

***

## Next Steps

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

* [Web Embedded Form](https://developer.paylink.sa/docs/javascript-web-embedded-form)
* [Apple Pay](https://developer.paylink.sa/docs/javascript-apple-pay)
* [STC Pay](https://developer.paylink.sa/docs/javascript-sdk-stc-pay)