Quickstart
This walkthrough takes you from a new merchant to a sandbox checkout page:
- Create a merchant
- Get a sandbox Merchant API Key
- Create a product and plan
- Open the checkout page
A Merchant API Key is scoped to its own merchant and to the sub-merchants that merchant onboards. Platform partners: use your own Merchant API Key to POST /v1/public-api/merchants — see the Partner Onboarding guide.
1. Create a merchant
Dashboard
- Sign in to the Payments AI dashboard.
- Complete business setup (business name, contact email, phone with country code, like
+14155552671). - Copy your
merchantIdfrom the dashboard (you will use it in every Public API path).
MCP (programmatic)
If you are using Cursor, Claude, or another MCP client, call create_merchant_account with name, email, and E.164 phone. See MCP server for setup.
Create a sandbox merchant named "Quickstart Demo" with my email <your email> and my phone <your phone with country code>.
Use your own real, deliverable email address — create_merchant_account rejects example, disposable, and other reserved or undeliverable addresses. Use your own phone number too, starting with + and your country code, with no spaces or dashes (for example, +14155552671 is a US number, but not yours): KYC notifications are sent to it by SMS.
The tool returns { "merchantId": "<uuid>" }. Use that id in the rest of this guide.
2. Get a sandbox Merchant API Key
- In the dashboard, open Developer Tools → API Keys.
- Create a sandbox key (
pai_test_*). Never paste livepai_live_*keys into docs Try It.
Send the key as a Bearer token on every Public API request:
Authorization: Bearer pai_test_<your_sandbox_key>
3. Create a product and plan
POST /v1/public-api/merchants/{merchantId}/products creates the product and nested plans in one call. The response is { "id": "<productId>" }.
curl 'https://sandbox.mor.payments.ai/api/v1/public-api/merchants/{merchantId}/products' \
-X POST \
-H "Authorization: Bearer pai_test_<key>" \
-H "Content-Type: application/json" \
-d '{
"name": "Starter Plan",
"status": "draft",
"plans": [
{
"name": "Monthly",
"amount": 19.99,
"currency": "usd",
"type": "recurring",
"billingPeriod": "month",
"periodLength": 1
}
]
}'
Fetch plan ids from the product (copy plans[0].id as {planId}):
curl 'https://sandbox.mor.payments.ai/api/v1/public-api/merchants/{merchantId}/products/{productId}' \
-H "Authorization: Bearer pai_test_<key>"
To add another plan later:
curl 'https://sandbox.mor.payments.ai/api/v1/public-api/merchants/{merchantId}/products/{productId}/plans' \
-X POST \
-H "Authorization: Bearer pai_test_<key>" \
-H "Content-Type: application/json" \
-d '{
"name": "Annual",
"amount": 199.00,
"currency": "usd",
"type": "recurring",
"billingPeriod": "year",
"periodLength": 1
}'
draft is enough for sandbox checkout testing. Set "status": "active" when the product should appear in the live catalog.
4. Open the checkout page
Resolve hosted checkout for the plan. The JSON includes checkoutUrl — open that URL in a browser.
curl 'https://sandbox.mor.payments.ai/api/v1/public-api/merchants/{merchantId}/checkout/plans/{planId}' \
-H "Authorization: Bearer pai_test_<key>"
Sandbox checkout URLs include ?isSandbox=true so the checkout SPA pins the sandbox API.
Embed session (optional)
If you are embedding checkout instead of opening the hosted page, the script mounts payment fields only — product name and price are not rendered. See Embedded checkout to fetch plan metadata and display the offer on your page.
The hosted iframe path still creates a session; use purchaseUrl (when present) or sessionId:
curl 'https://sandbox.mor.payments.ai/api/v1/public-api/merchants/{merchantId}/checkout/plans/{planId}/session' \
-X POST \
-H "Authorization: Bearer pai_test_<key>" \
-H "Content-Type: application/json" \
-d '{"returnUrl":"https://example.com/thanks"}'
For composable payment fields (not the iframe embed), confirm the buyer's
confirmationToken on your server or via the public buyer route:
curl 'https://sandbox.mor.payments.ai/api/v1/checkout/plans/{planId}/confirm' \
-X POST \
-H 'Content-Type: application/json' \
-d '{
"confirmationToken": "ctok_…",
"returnUrl": "https://example.com/thanks"
}'
The same operation is available on the Merchant Public API at
POST /v1/public-api/merchants/{merchantId}/checkout/plans/{planId}/confirm when using API-key
auth. See Embedded checkout.
5. Try It on API Reference
Open the API Reference, paste your pai_test_* key and sandbox merchantId in the right-rail Try It panel, and send GET /v1/public-api/merchants/{merchantId}/products.
6. Building with an AI coding agent?
We don't publish client SDKs yet. Instead, install the Payments AI skill in Claude Code, Cursor, or another agent-based tool — it teaches the agent our API shapes and conventions directly, so it can write correct integration code against the raw HTTP API for you.