Skip to main content
POST
/
payment
/
sale
curl -X POST "https://api.orsunpay.com/v1/payment/sale" \
  -H "x-api-key: your-api-key-here" \
  -H "Content-Type: application/json" \
  -d '{
    "amount": 1000,
    "currency": "USD",
    "paymentMethod": "cr_clyv2goxb0000z8b8j5y6fl1j",
    "merchantId": "mr_clyv2goxb0000z8b8j5y6fl1j",
    "orderId": "transaction_123",
    "buyerId": "customer_123",
    "successUrl": "https://example.com/success",
    "failureUrl": "https://example.com/failure",
    "returnUrl": "https://example.com/return",
    "callbackUrl": "https://example.com/callback"
  }'
{
  "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"
  }
}

Overview

The deposit endpoint creates a new transaction for customer account funding. It supports multiple payment methods including cryptocurrencies, e-wallets, and BNPL services.
curl -X POST "https://api.orsunpay.com/v1/payment/sale" \
  -H "x-api-key: your-api-key-here" \
  -H "Content-Type: application/json" \
  -d '{
    "amount": 1000,
    "currency": "USD",
    "paymentMethod": "cr_clyv2goxb0000z8b8j5y6fl1j",
    "merchantId": "mr_clyv2goxb0000z8b8j5y6fl1j",
    "orderId": "transaction_123",
    "buyerId": "customer_123",
    "successUrl": "https://example.com/success",
    "failureUrl": "https://example.com/failure",
    "returnUrl": "https://example.com/return",
    "callbackUrl": "https://example.com/callback"
  }'
{
  "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"
  }
}

Payment Flow

  1. Create Transaction - Call this endpoint to initiate a deposit
  2. Redirect Customer - If url is provided, redirect customer to complete payment
  3. Handle Callback - Process webhook notifications at your callbackUrl
  4. Redirect Customer - Customer returns to successUrl or failureUrl
Always handle webhook notifications for reliable payment status updates, as customers may not complete the redirect flow.

Common Use Cases

Basic Deposit

Perfect for simple payment processing with minimal customer data required.

Deposit with Customer Information

Include customer details for enhanced fraud protection and compliance requirements.

Recurring Payments

Use metadata field to store subscription or recurring payment information.
Ensure your webhook endpoint can handle duplicate notifications and implement proper idempotency checks.

Authorizations

x-api-key
string
header
required

API key for merchant authorization

Body

application/json

Deposit transaction details

amount
integer
required

Transaction amount in cents

Required range: x >= 1
Example:

1000

currency
string
required

Three-letter currency code (ISO 4217)

Example:

"USD"

paymentMethod
string
required

Payment method identifier

Example:

"cr_clyv2goxb0000z8b8j5y6fl1j"

merchantId
string
required

Merchant account identifier

Example:

"mr_clyv2goxb0000z8b8j5y6fl1j"

orderId
string
required

Unique transaction identifier in your system

Example:

"transaction_123"

buyerId
string
required

Customer identifier in your system

Example:

"customer_123"

successUrl
string<uri>
required

URL to redirect customer after successful payment

Example:

"https://example.com/success"

failureUrl
string<uri>
required

URL to redirect customer after failed payment

Example:

"https://example.com/failure"

returnUrl
string<uri>
required

URL to redirect customer when returning to your site

Example:

"https://example.com/return"

callbackUrl
string<uri>
required

Webhook URL for payment status notifications

Example:

"https://example.com/callback"

locale
string

Language/locale in BCP 47 format

Example:

"en-US"

customer
object
paymentMethodInput
object

Additional payment method specific parameters

metadata
object

Additional metadata for the transaction

Response

Deposit transaction successfully created

status
boolean
required

Indicates if the request was successful

Example:

true

url
string<uri>

Redirect URL for payment completion (if required)

Example:

"https://payment-provider.com/pay/abc123"

transaction
object
error
string

Error message if the request failed

Example:

"Payment method not available"