API Overview

The YardPay Pro REST API for creating checkout sessions, managing subscriptions, and processing payments.

Base URL

https://dev-payment-gateway.mplex.net

All API endpoints are relative to this base URL. All requests must use HTTPS.

Authentication

YardPay uses two types of API keys. Pass the key as a Bearer token in theAuthorization header.

Key TypePrefixUseAccess
Server Keysk_live_...Server-side onlyFull API access (create sessions, manage subscriptions, verify webhooks)
Publishable Keypk_live_...Client-side (browsers, mobile apps)Scoped to a single checkout session. Requires the X-Client-Secret header.

Publishable-key scopes

Publishable keys are issued with a fixed scope set covering the client-safe checkout flow. Every request must also carry the X-Client-Secret header matching the session the action targets.

ScopeEndpoint
checkout.session.readGET /api/v1/checkout-sessions/{id}
checkout.session.confirmPOST /api/v1/checkout-sessions/{id}/confirm
checkout.session.confirmPOST /api/v1/checkout-sessions/{id}/withdraw-qr
checkout.session.tokenizePOST /api/v1/checkout-sessions/{id}/tokenize
checkout.session.cancelPOST /api/v1/checkout-sessions/{id}/cancel
checkout.session.statusGET /api/v1/checkout-sessions/{id}/status
checkout.session.cards.readGET /api/v1/checkout-sessions/{id}/saved-cards
checkout.session.cards.verifyPOST /api/v1/checkout-sessions/{id}/saved-cards/verify
checkout.session.cards.confirm_otpPOST /api/v1/checkout-sessions/{id}/saved-cards/confirm-otp
checkout.session.src.lookupPOST /api/v1/checkout-sessions/{id}/src/lookup
checkout.session.src.authenticatePOST /api/v1/checkout-sessions/{id}/src/authenticate

Server-key-only scopes

ScopeEndpoint
checkout.session.createPOST /api/v1/checkout-sessions
checkout.session.refundPOST /api/v1/checkout-sessions/{id}/refund
subscriptionplan.create / .read / .update / .delete/api/v1/plans
subscription.readGET /api/v1/subscriptions*
subscription.updatePOST /api/v1/subscriptions/{id}/cancel · pause · resume
portal.session.createPOST /api/v1/portal-sessions
client_token.generateNot available — POST /api/v1/client-token returns 501. Use the publishable key with the session's client secret.

Server Key Authentication

curl -X POST https://dev-payment-gateway.mplex.net/api/v1/checkout-sessions \
  -H "Authorization: Bearer sk_live_your_server_key" \
  -H "Content-Type: application/json" \
  -d '{"amount": 50.00, "currency": "USD"}'

Publishable Key + Client Secret

Client-side requests use the publishable key for authentication and the client secret (returned when creating a checkout session) to scope access to that specific session.

curl -X POST https://dev-payment-gateway.mplex.net/api/v1/checkout-sessions/cs_live_abc123/confirm \
  -H "Authorization: Bearer pk_live_your_publishable_key" \
  -H "X-Client-Secret: cs_live_abc123_secret_xyz789" \
  -H "Content-Type: application/json" \
  -d '{"paymentMethodId": "pm_card_visa_1234"}'

Response Format

All responses are JSON. Successful responses return the resource object directly. List endpoints return a paginated wrapper.

Single resource

{
  "id": "cs_live_abc123",
  "object": "checkout_session",
  "status": "open",
  "amount": 50.00,
  "currency": "USD",
  "clientSecret": "cs_live_abc123_secret_xyz789",
  "createdAt": "2025-01-15T10:30:00Z"
}

Paginated list

{
  "object": "list",
  "data": [
    { "id": "sub_abc123", "object": "subscription", "status": "active" }
  ],
  "hasMore": true,
  "totalCount": 42
}

Error Handling

Errors return an appropriate HTTP status code with a JSON body describing the problem.

{
  "error": {
    "type": "invalid_request",
    "code": "amount_too_small",
    "message": "Amount must be at least 1.00 USD.",
    "param": "amount"
  }
}
HTTP StatusError TypeDescription
400invalid_requestMissing or invalid parameters
401authenticationInvalid or missing API key
403permission_deniedKey does not have access to this resource
404not_foundResource does not exist
409conflictResource is in an invalid state for this operation
429rate_limitToo many requests
500server_errorInternal server error (retry with backoff)

Rate Limits

The API enforces rate limits to ensure fair usage and protect service stability.

PlanRate LimitBurst
Standard100 requests/second200 requests
Enterprise500 requests/second1000 requests

Rate limit headers are included in every response:

X-RateLimit-Limit: 100
X-RateLimit-Remaining: 95
X-RateLimit-Reset: 1705312200

429 responses

When rate limited, wait for the number of seconds indicated in theRetry-After header before retrying. Implement exponential backoff for production applications.

Idempotency

For POST requests, pass an Idempotency-Key header to safely retry requests without risk of duplicate operations.

curl -X POST https://dev-payment-gateway.mplex.net/api/v1/checkout-sessions \
  -H "Authorization: Bearer sk_live_your_server_key" \
  -H "Idempotency-Key: unique-request-id-12345" \
  -H "Content-Type: application/json" \
  -d '{"amount": 50.00, "currency": "USD"}'