Skip to main content

API Endpoints

This page provides a comprehensive reference for all Orsunpay API endpoints, versioning strategy, and compatibility policies.

Base URLs

API Endpoints

EnvironmentBase URLDescription
Sandboxhttps://sandbox-api.orsunpay.com/v1Development and testing
Productionhttps://api.orsunpay.com/v1Live transactions

Service Endpoints

ServiceSandboxProduction
Checkouthttps://sandbox-checkout.orsunpay.comhttps://checkout.orsunpay.com
BackOfficehttps://office.orsunpay.comhttps://office.orsunpay.com
WebhooksDelivered to your configured URLsDelivered to your configured URLs

API Versioning

Current Version: v1

All API endpoints are versioned using URL path versioning:
https://api.orsunpay.com/v1/{resource}

Version Format

  • Major Version: Breaking changes (e.g., v1, v2)
  • Minor Updates: Backward-compatible improvements (released without version increment)
  • Patch Updates: Bug fixes and security updates (transparent to users)
We’re currently on version 1 (v1) and maintain strict backward compatibility within major versions.

Core API Endpoints

Transactions

MethodEndpointDescription
POST/v1/transactionsCreate a new transaction
GET/v1/transactions/{id}Retrieve transaction by ID
GET/v1/transactionsList transactions with filtering
POST/v1/transactions/{id}/captureCapture authorized transaction
POST/v1/transactions/{id}/voidVoid authorized transaction
POST/v1/transactions/{id}/refundRefund completed transaction

Customers

MethodEndpointDescription
POST/v1/customersCreate a new customer
GET/v1/customers/{id}Retrieve customer by ID
GET/v1/customersList customers with filtering
PUT/v1/customers/{id}Update customer information
DELETE/v1/customers/{id}Delete customer

Merchants

MethodEndpointDescription
GET/v1/merchants/meRetrieve current merchant
GET/v1/merchantsList merchants (admin only)
GET/v1/merchants/{id}Retrieve specific merchant

Credential Configs

MethodEndpointDescription
POST/v1/credential-configsCreate credential config
GET/v1/credential-configs/{id}Retrieve config by ID
GET/v1/credential-configsList configs with filtering
PUT/v1/credential-configs/{id}Update config
DELETE/v1/credential-configs/{id}Delete config

Payment Methods

MethodEndpointDescription
GET/v1/payment-methodsList available payment methods
GET/v1/payment-methods/{method}Get specific payment method details

Webhooks

MethodEndpointDescription
GET/v1/webhooks/eventsList webhook event types
POST/v1/webhooks/testSend test webhook

Checkout API Endpoints

Session Management

MethodEndpointDescription
POST/v1/checkout/sessionsCreate checkout session
GET/v1/checkout/sessions/{id}Retrieve session details
PUT/v1/checkout/sessions/{id}Update session

Example Checkout Session Creation

curl "https://api.orsunpay.com/v1/checkout/sessions" \
  -X POST \
  -H "Authorization: Bearer sk_live_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "amount": 5000,
    "currency": "USD",
    "country": "US",
    "customer": {
      "email": "[email protected]"
    },
    "returnUrl": "https://yoursite.com/return",
    "cancelUrl": "https://yoursite.com/cancel"
  }'

Request Format Standards

Content Type

All requests with body content must use:
Content-Type: application/json

Authentication

Include your API key in all requests:
Authorization: Bearer your_api_key_here

Idempotency

For state-changing operations, include idempotency key:
Idempotency-Key: your-unique-key-here

Response Format Standards

Success Response

All successful API responses follow this structure:
{
  "id": "resource_id",
  "object": "transaction|customer|merchant",
  "created": "2023-11-15T10:30:00.000Z",
  "updated": "2023-11-15T10:30:00.000Z",
  // ... resource-specific fields
}

Error Response

All error responses follow this structure:
{
  "error": {
    "code": "error_code",
    "message": "Human readable error message",
    "details": {
      "field": "Additional error details"
    }
  }
}

Pagination

List Endpoints

All list endpoints support pagination using cursor-based pagination:

Request Parameters

ParameterTypeDefaultDescription
limitinteger10Number of items per page (max 100)
cursorstring-Cursor for next page

Response Format

{
  "data": [...],
  "hasMore": true,
  "nextCursor": "eyJpZCI6InRyXzEyMyJ9"
}

Example Usage

# First page
curl "https://api.orsunpay.com/v1/transactions?limit=10" \
  -H "Authorization: Bearer sk_live_your_api_key"

# Next page using cursor
curl "https://api.orsunpay.com/v1/transactions?limit=10&cursor=eyJpZCI6InRyXzEyMyJ9" \
  -H "Authorization: Bearer sk_live_your_api_key"

Filtering and Sorting

Common Filter Parameters

ParameterTypeExampleDescription
statusstringSUCCESSFilter by status
merchantIdstringmr_123Filter by merchant
customerIdstringcu_456Filter by customer
dateFromISO date2023-11-01T00:00:00.000ZStart date filter
dateToISO date2023-11-30T23:59:59.999ZEnd date filter

Sorting

Use the sort parameter with field names:
# Sort by creation date (newest first)
curl "https://api.orsunpay.com/v1/transactions?sort=-createdAt"

# Sort by amount (ascending) 
curl "https://api.orsunpay.com/v1/transactions?sort=amount"

Rate Limits

Headers

Rate limit information is included in response headers:
X-RateLimit-Limit: 1000
X-RateLimit-Remaining: 999
X-RateLimit-Reset: 1609459200

Rate Limit Exceeded Response

{
  "error": {
    "code": "rate_limit_exceeded",
    "message": "Too many requests. Please retry after some time.",
    "details": {
      "retryAfter": 60
    }
  }
}

Compatibility Policy

Backward Compatibility

We maintain backward compatibility within major versions by:
  • Never removing existing fields from responses
  • Never changing field data types
  • Never requiring new mandatory fields in requests
  • Never changing existing endpoint behavior

Additive Changes (Non-Breaking)

We may add these without notice:
  • New optional fields in requests
  • New fields in responses
  • New endpoints
  • New optional query parameters
  • New webhook event types

Breaking Changes

Breaking changes require a new major version:
  • Removing fields from responses
  • Changing field data types
  • Adding required fields to requests
  • Changing endpoint URLs
  • Removing endpoints
We provide at least 12 months notice before deprecating any API version.

Regional Endpoints

Currently, all traffic is routed through our primary data centers:

Primary Regions

RegionLocationStatus
US EastVirginiaPrimary
EU WestIrelandSecondary

Planned Expansion

RegionLocationTimeline
Asia PacificSingaporeQ2 2024
EU CentralGermanyQ3 2024

Service Status

Health Check Endpoints

Monitor API health using these endpoints:
# API Health
curl https://api.orsunpay.com/health

# Specific service health
curl https://api.orsunpay.com/health/transactions
curl https://api.orsunpay.com/health/webhooks

Status Page

Monitor real-time system status at:
  • Public Status: https://status.orsunpay.com
  • Incident History: Historical uptime and incidents
  • Maintenance Windows: Scheduled maintenance notifications

Development Tools

API Explorer

Interactive API testing available at:

SDKs and Libraries

Official SDKs available for:
LanguagePackageInstallation
JavaScript@orsunpay/sdk-jsnpm install @orsunpay/sdk-js
Node.js@orsunpay/sdk-nodenpm install @orsunpay/sdk-node
Pythonorsunpaypip install orsunpay
PHPorsunpay/orsunpay-phpcomposer require orsunpay/orsunpay-php

Postman Collection

Import our Postman collection for easy testing:
# Download collection
curl -o orsunpay-api.json \
  https://api.orsunpay.com/postman/collection.json

Support and Resources

For endpoint-specific questions:
All endpoints support both sandbox and production environments. Always test thoroughly in sandbox before using production endpoints.