Onecloudpay Developer API

API Integration Documentation

Use this API to let merchants create payment requests, send customers to hosted checkout, and check transaction status. The API does not accept card numbers or CVV directly.

Quick Start

New merchants can sign up and receive an API key at Merchant Signup. Payments created with that key show the merchant business name in checkout automatically.

API base URL:

https://onecloudpay.com/api.php

Payment endpoint: https://onecloudpay.com/api.php/v1/payments

Development API key configured in config.php:

vp_test_1234567890abcdef
Before using production, change the API key in config.php, enable HTTPS, and keep storage/ inaccessible from the browser.

1. Create a payment

curl -X POST "https://onecloudpay.com/api.php/v1/payments" \
  -H "Authorization: Bearer vp_test_1234567890abcdef" \
  -H "Content-Type: application/json" \
  -d '{
    "amount": 50.00,
    "currency": "USD",
    "merchant_reference": "ORDER-1001",
    "description": "Order 1001",
    "return_url": "https://merchant.example/success",
    "cancel_url": "https://merchant.example/cancel",
    "customer": {
      "name": "Demo Customer",
      "email": "[email protected]"
    }
  }'

2. Redirect the customer to checkout

Use data.checkout_url from the response to redirect the customer or build a payment button.

Authentication

Every endpoint under /v1 requires an API key sent as a Bearer token.

Authorization: Bearer vp_test_1234567890abcdef

Keep API keys on the server side only. Do not place keys in browser JavaScript. API keys created from signup are automatically tied to the merchant name.

Endpoints

GET/health

Check whether the API is running. This endpoint does not require an API key.

curl "https://onecloudpay.com/api.php/health"

POST/v1/payments

Create a new payment request.

FieldTypeRequiredDescription
amountnumberYesPayment amount, up to 2 decimal places.
currencystringNoDefault: USD.
merchant_referencestringNoOrder number or reference from the merchant system.
descriptionstringNoPayment description.
return_urlurlNoURL after payment succeeds or remains pending.
cancel_urlurlNoURL when the customer cancels.
customerobjectNoname, email, phone.
metadataobjectNoAdditional merchant data.

Response

{
  "data": {
    "id": "pay_1234567890abcdef",
    "object": "payment",
    "amount": "50.00",
    "currency": "USD",
    "status": "pending",
    "merchant_name": "Demo Merchant",
    "merchant_reference": "ORDER-1001",
    "checkout_url": "https://onecloudpay.com/payment.php?payment_id=pay_1234567890abcdef",
    "payment_url": "https://onecloudpay.com/payment.php?payment_id=pay_1234567890abcdef",
    "created_at": "2026-05-29T04:00:00+00:00",
    "expires_at": "2026-05-30T04:00:00+00:00"
  }
}

GET/v1/payments/{payment_id}

Retrieve payment details and current status.

curl "https://onecloudpay.com/api.php/v1/payments/pay_1234567890abcdef" \
  -H "Authorization: Bearer vp_test_1234567890abcdef"

GET/v1/payments

List payments for the current merchant. Supports limit and merchant_reference.

curl "https://onecloudpay.com/api.php/v1/payments?limit=10" \
  -H "Authorization: Bearer vp_test_1234567890abcdef"

POST/v1/payments/{payment_id}/cancel

Cancel a payment that is still in pending status.

curl -X POST "https://onecloudpay.com/api.php/v1/payments/pay_1234567890abcdef/cancel" \
  -H "Authorization: Bearer vp_test_1234567890abcdef"

Payment Statuses

StatusMeaning
pendingThe payment was created and is waiting for the customer to enter checkout.
requires_reviewThe customer submitted the checkout form; the merchant should review it or continue with a real payment processor.
approvedThe payment was approved by admin.
rejectedThe payment was rejected by admin.
cancelledThe payment was cancelled.

Error Format

{
  "error": {
    "code": "validation_failed",
    "message": "Payment request is invalid.",
    "details": {
      "amount": "Amount must be greater than zero."
    }
  }
}
HTTPCodeDescription
400invalid_jsonThe request body is not valid JSON.
401unauthorizedThe API key is missing or invalid.
404not_foundThe endpoint or payment was not found.
409invalid_statusThe action is not valid for the current status.
422validation_failedA request field is invalid.

Security Notes

No Raw Card API

Merchants should not send card numbers or CVV through the API. Use hosted checkout URLs only.

API Keys

Create a new production key in config.php, and rotate keys when needed.

HTTPS

Production must use HTTPS before merchants or customers use it.

Storage

storage/ contains payment state and the audit log. Do not serve this directory publicly.