> ## Documentation Index
> Fetch the complete documentation index at: https://docs.orsunpay.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Payment API

> Comprehensive payment gateway API for deposits and withdrawals

## Overview

The Payment API provides a secure and reliable way to process financial transactions through our payment gateway. Our platform supports various payment methods including cryptocurrencies, e-wallets, and Buy Now, Pay Later (BNPL) services.

## Supported Operations

* **Deposits (Sale)** - Process customer payments and account funding
* **Withdrawals (Payout)** - Handle fund withdrawals to customers

## Authentication

All API endpoints require authentication using an API key passed in the `x-api-key` header. Your API key is associated with your merchant account and provides access to your transaction data and settings.

```bash theme={null}
curl -X POST "https://api.orsunpay.com/v1/payment/sale" \
  -H "x-api-key: your-api-key-here" \
  -H "Content-Type: application/json" \
  -d '{...}'
```

<Warning>
  Keep your API key secure and never expose it in client-side code or public
  repositories.
</Warning>

## Base URL

```
https://api.orsunpay.com/v1/payment
```

## Rate Limits

* Standard rate limit: 100 requests per minute per API key
* Burst limit: 10 requests per second

## Error Handling

All API responses follow a consistent format with proper HTTP status codes:

* `200/201` - Success
* `400` - Bad request (invalid parameters)
* `401` - Unauthorized (invalid API key)
* `500` - Internal server error

```json theme={null}
{
  "status": false,
  "error": "Invalid payment method"
}
```

## Response Format

Successful responses include transaction details and any required redirect URLs:

```json theme={null}
{
  "status": true,
  "url": "https://payment-provider.com/pay/abc123",
  "transaction": {
    "id": "tx_clyv2goxb0000z8b8j5y6fl1j",
    "orderId": "transaction_123",
    "status": "PROCESSING",
    "action": "SALE",
    "amount": 1000,
    "currency": "USD",
    "createdAt": "2023-12-25T10:00:00.000Z"
  }
}
```

## Transaction Statuses

* `CREATED` - Transaction has been created
* `WAIT_APPROVE` - Waiting for operator approval
* `PROCESSING` - Transaction is being processed
* `SUCCESS` - Transaction completed successfully
* `DECLINED` - Transaction was declined
* `CANCELED` - Transaction was canceled by customer
* `EXPIRED` - Transaction expired before completion
