Skip to content

API Reference

The Salam Gateway API is organized around REST. Our API has predictable resource-oriented URLs, accepts JSON-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes.

Base URL

txt
https://api.salamgateway.com/v1
txt
https://sandbox-api.salamgateway.com/v1

Authentication

The API uses API keys for authentication. Include your secret key in the Authorization header:

http
Authorization: Bearer sk_live_your_api_key

WARNING

Never expose your secret API key in client-side code. Use the publishable key for frontend integrations.

Request Format

All POST and PUT requests must include:

http
Content-Type: application/json

Response Format

All responses return JSON:

json
{
  "id": "pay_abc123",
  "object": "payment",
  "amount": 10000,
  "currency": "MYR",
  "status": "captured"
}

Pagination

List endpoints support pagination:

ParameterDescription
pagePage number (default: 1)
limitItems per page (default: 20, max: 100)

Response includes metadata:

json
{
  "data": [...],
  "meta": {
    "total": 150,
    "page": 1,
    "limit": 20,
    "totalPages": 8
  }
}

Error Handling

Errors return appropriate HTTP status codes and a JSON error object:

json
{
  "error": {
    "type": "card_error",
    "code": "card_declined",
    "message": "Your card was declined.",
    "param": "payment_method"
  }
}

HTTP Status Codes

CodeMeaning
200OK - Request succeeded
201Created - Resource created
400Bad Request - Invalid parameters
401Unauthorized - Invalid API key
402Request Failed - Valid request but failed
404Not Found - Resource doesn't exist
409Conflict - Request conflicts with current state
429Too Many Requests - Rate limit exceeded
500Server Error - Something went wrong

Error Types

TypeDescription
api_errorServer error
authentication_errorAuthentication failed
card_errorCard was declined
invalid_request_errorInvalid parameters
rate_limit_errorToo many requests

Idempotency

Safely retry requests by including an idempotency key:

bash
curl https://api.salam.com/v1/payments \
  -H "Authorization: Bearer sk_test_xxxxx" \
  -H "Idempotency-Key: unique-key-123" \
  -d "amount=10000" \
  -d "currency=MYR"

Repeated requests with the same key return the same result.

Pagination

List endpoints support cursor-based pagination:

json
{
  "object": "list",
  "data": [...],
  "has_more": true,
  "url": "/v1/payments"
}

Parameters:

  • limit - Number of results (default: 10, max: 100)
  • starting_after - Cursor for next page
  • ending_before - Cursor for previous page

Example:

javascript
const payments = await salam.payments.list({
  limit: 10,
  starting_after: 'pay_xxxxx',
});

Metadata

Most resources support custom metadata (up to 50 key-value pairs):

javascript
const payment = await salam.payments.create({
  amount: 10000,
  currency: 'MYR',
  payment_method: 'pm_xxxxx',
  metadata: {
    order_id: '12345',
    customer_name: 'John Doe',
  },
});

Expanding Resources

Use the expand parameter to include related objects:

javascript
const payment = await salam.payments.retrieve('pay_xxxxx', {
  expand: ['customer', 'payment_method'],
});

// payment.customer is now a full Customer object
// instead of just an ID

Core Resources

Payments

Create and manage payments. The core resource for processing transactions.

Refunds

Issue full or partial refunds for payments.

Customers

Store customer information and payment methods.

Payment Methods

Represent customer payment methods (cards, FPX).

Webhooks

Receive real-time notifications for events.

Rate Limits

  • General: 100 requests per second
  • Payment Creation: 50 requests per second
  • Webhooks: Unlimited

Learn more about rate limits →

SDKs

Official SDKs available:

Support

Need help? Contact us:

Released under the MIT License.