Skip to content

SDKs Overview

Salam provides official SDKs to make integration easier. Choose the SDK that matches your platform.

Available SDKs

JavaScript (Browser)

For client-side web applications

bash
<script src="https://js.salam.com/v1/salam.js"></script>

Features:

  • Secure card input elements
  • PCI compliant tokenization
  • 3D Secure handling
  • FPX bank selection
  • Real-time validation

Use Cases:

  • E-commerce checkout pages
  • Payment forms
  • Single-page applications (React, Vue, Angular)

Node.js

For server-side applications

bash
npm install @salam/salam-node

Features:

  • Full API coverage
  • TypeScript support
  • Webhook verification
  • Automatic retries
  • Idempotency support

Use Cases:

  • Backend APIs
  • Webhook handlers
  • Subscription systems
  • Payment processing

PHP (Coming Soon)

For PHP applications

bash
composer require salam/salam-php

Features:

  • Full API coverage
  • Laravel integration
  • Webhook verification

Python (Coming Soon)

For Python applications

bash
pip install salam

Features:

  • Full API coverage
  • Django/Flask integration
  • Webhook verification
  • Type hints

Installation

JavaScript (Browser)

CDN (Recommended)

html
<script src="https://js.salam.com/v1/salam.js"></script>

NPM

bash
npm install @salam/salam-js

Node.js

bash
npm install @salam/salam-node

Quick Start

Browser

html
<!DOCTYPE html>
<html>
<head>
  <script src="https://js.salam.com/v1/salam.js"></script>
</head>
<body>
  <div id="card-element"></div>
  <button id="pay-button">Pay</button>

  <script>
    const salam = Salam('pk_test_xxxxx');
    const elements = salam.elements();
    const cardElement = elements.create('card');
    cardElement.mount('#card-element');

    document.getElementById('pay-button').addEventListener('click', async () => {
      const { paymentMethod, error } = await salam.createPaymentMethod({
        type: 'card',
        card: cardElement,
      });
      
      if (!error) {
        // Send paymentMethod.id to your server
        console.log(paymentMethod.id);
      }
    });
  </script>
</body>
</html>

Node.js

javascript
const Salam = require('@salam/salam-node');
const salam = new Salam('sk_test_xxxxx');

const payment = await salam.payments.create({
  amount: 10000,
  currency: 'MYR',
  payment_method: 'pm_xxxxx',
});

console.log(payment.status);

SDK Comparison

FeatureBrowserNode.jsPHPPython
Card Input
Tokenization
Payment API⚠️ Limited
Refund API
Customer API
Webhooks
TypeScript⚠️ Type hints

Support

Each SDK has its own repository with:

  • README with examples
  • Full API documentation
  • Issue tracker
  • Changelog

Contributing

Want to contribute to an SDK or request a new one?

Migration Guides

If you're migrating from another payment gateway:

Released under the MIT License.