Skip to main content

Documentation Index

Fetch the complete documentation index at: https://privexpay.mintlify.app/llms.txt

Use this file to discover all available pages before exploring further.

Privex Pay gives you multiple integration paths depending on your platform and technical requirements. You can connect using the REST API directly, use a platform SDK for web or mobile, or install a pre-built plugin for popular e-commerce platforms. Most integrations go live in under 15 minutes.
Before you integrate, you need a Privex Pay merchant account with API credentials. See Account setup to create your account and retrieve your API key.

Integration options

REST API

Make direct HTTP requests to the Privex Pay API. Works with any language or framework.

SDKs

Use a platform SDK for JavaScript, mobile, or server-side languages to simplify integration.

Plugins

Install a pre-built plugin for your e-commerce platform — no custom code required.

How to integrate

1

Get your API credentials

Log in to your Privex Pay dashboard, navigate to Settings → API keys, and copy your secret key. Keep this value private — never expose it in client-side code.
2

Choose your integration method

Select the API, SDK, or plugin approach that best fits your stack. See the examples below for API and JavaScript SDK usage.
3

Add Privex Pay to your codebase

Follow the code examples in this page or in your chosen SDK’s documentation to create a payment session and redirect your customer to the hosted checkout.
4

Test in sandbox mode

Use your sandbox API key (available in the dashboard under Settings → API keys → Sandbox) to run test transactions before going live. Use the test card number 4111 1111 1111 1111 with any future expiry date.
5

Go live

Switch your integration to use your live API key. Verify that your checkout flow completes end to end, then start accepting real payments.

API integration

The Privex Pay API is a REST API that accepts JSON. To initiate a payment, you create a payment session by sending a POST request to /v1/sessions. The API returns a checkout_url that you redirect your customer to.

Authentication

Pass your secret API key in the Authorization header as a Bearer token on every request.

Create a payment session

curl --request POST \
  --url https://api.privexpay.com/v1/sessions \
  --header 'Authorization: Bearer sk_live_your_secret_key' \
  --header 'Content-Type: application/json' \
  --data '{
    "amount": 4999,
    "currency": "usd",
    "description": "Pro plan — monthly subscription",
    "success_url": "https://yoursite.com/thank-you",
    "cancel_url": "https://yoursite.com/checkout"
  }'
The API responds with a session object that includes a checkout_url. Redirect your customer to this URL to complete payment on the Privex Pay hosted checkout page.
Response
{
  "id": "sess_01HXYZ9K2ABCDEF",
  "checkout_url": "https://checkout.privexpay.com/pay/sess_01HXYZ9K2ABCDEF",
  "status": "pending",
  "amount": 4999,
  "currency": "usd",
  "expires_at": "2026-05-10T15:00:00Z"
}
Never include your secret API key in client-side JavaScript or mobile app source code. Always make API calls from your server and pass only the checkout_url to the browser.

Add a checkout button (HTML)

Once you have a checkout_url from your server, you can use a simple button to send your customer to checkout:
HTML
<button onclick="window.location.href='{{ checkout_url }}'">
  Pay now
</button>
Replace {{ checkout_url }} with the URL returned by your server after creating the session.

Pre-built plugins

If you are running an e-commerce platform, install the Privex Pay plugin to add checkout support without writing API code. Plugins are available for major platforms — find them in your dashboard under Settings → Plugins, or in your platform’s app marketplace. Each plugin connects using your API key and handles session creation automatically.
If your platform is not listed, use the REST API or JavaScript SDK. The API is compatible with any server-side environment, including PHP, Python, Ruby, and Go.