### Development Quick Start Commands Source: https://github.com/atmospherelabs-dev/cipherpay-api/blob/main/SPEC.md Commands to clone, configure, start PostgreSQL, and run the CipherPay service in development. Requires Docker for PostgreSQL and Rust toolchain for cargo. ```bash # Clone and setup git clone https://github.com/your-org/cipherpay cd cipherpay cp .env.example .env # Start PostgreSQL docker-compose up -d # Run the service cargo run ``` -------------------------------- ### Start CipherPay server with debug logging Source: https://github.com/atmospherelabs-dev/cipherpay-api/blob/main/TESTNET_GUIDE.md Run the CipherPay server with debug logging enabled to monitor scanner activity and troubleshoot issues. Access the web interface at http://127.0.0.1:3080 after starting. ```bash cd cipherpay RUST_LOG=cipherpay=debug cargo run ``` -------------------------------- ### GET /api/products Source: https://github.com/atmospherelabs-dev/cipherpay-api/blob/main/README.md Lists all products for the authenticated merchant. ```APIDOC ## GET /api/products ### Description Lists all products for the authenticated merchant. ### Method GET ### Endpoint /api/products ### Authentication API key ### Response #### Success Response (200) - **products** (array) - List of products #### Response Example { "products": [] } ``` -------------------------------- ### GET /api/products/{id}/prices Source: https://github.com/atmospherelabs-dev/cipherpay-api/blob/main/README.md Lists all prices for a specific product. ```APIDOC ## GET /api/products/{id}/prices ### Description Lists all prices for a specific product. ### Method GET ### Endpoint /api/products/{id}/prices ### Authentication API key ### Parameters #### Path Parameters - **id** (string) - Required - Product ID ### Response #### Success Response (200) - **prices** (array) - List of prices #### Response Example { "prices": [] } ``` -------------------------------- ### Clone and configure environment, then run server Source: https://github.com/atmospherelabs-dev/cipherpay-api/blob/main/README.md Sets up the environment by copying .env.example to .env and generating an ENCRYPTION_KEY with openssl. Starts the server with cargo run; the server listens on http://localhost:3080. ```bash # Clone and configure cp .env.example .env # Set ENCRYPTION_KEY: openssl rand -hex 32 # Run cargo run ``` -------------------------------- ### Checkout: create invoice from product (POST /api/checkout) Source: https://github.com/atmospherelabs-dev/cipherpay-api/blob/main/README.md Creates an invoice from an existing product and price by providing product_id and price_id. No authentication header is shown in this example. ```bash curl -X POST http://localhost:3080/api/checkout \ -H "Content-Type: application/json" \ -d '{"product_id": "", "price_id": ""}' ``` -------------------------------- ### GET /api/subscriptions Source: https://github.com/atmospherelabs-dev/cipherpay-api/blob/main/README.md Lists all subscriptions for the authenticated merchant. ```APIDOC ## GET /api/subscriptions ### Description Lists all subscriptions for the authenticated merchant. ### Method GET ### Endpoint /api/subscriptions ### Authentication API key ### Response #### Success Response (200) - **subscriptions** (array) - List of subscriptions #### Response Example { "subscriptions": [] } ``` -------------------------------- ### GET /api/merchants/me/billing Source: https://github.com/atmospherelabs-dev/cipherpay-api/blob/main/README.md Retrieves the billing summary for the authenticated merchant. ```APIDOC ## GET /api/merchants/me/billing ### Description Retrieves the billing summary for the authenticated merchant. ### Method GET ### Endpoint /api/merchants/me/billing ### Authentication Session ### Response #### Success Response (200) - **billing** (object) - Billing summary #### Response Example { "billing": {} } ``` -------------------------------- ### GET /api/invoices Source: https://github.com/atmospherelabs-dev/cipherpay-api/blob/main/README.md Lists all invoices for the authenticated merchant. ```APIDOC ## GET /api/invoices ### Description Lists all invoices for the authenticated merchant. ### Method GET ### Endpoint /api/invoices ### Authentication API key ### Response #### Success Response (200) - **invoices** (array) - List of invoices #### Response Example { "invoices": [] } ``` -------------------------------- ### GET /api/products/{id}/public Source: https://github.com/atmospherelabs-dev/cipherpay-api/blob/main/README.md Retrieves public product information, supports slug lookup. ```APIDOC ## GET /api/products/{id}/public ### Description Retrieves public product information, supports slug lookup. ### Method GET ### Endpoint /api/products/{id}/public ### Parameters #### Path Parameters - **id** (string) - Required - Product ID or slug ### Response #### Success Response (200) - **product** (object) - Public product info #### Response Example { "product": {} } ``` -------------------------------- ### GET /api/merchants/me/keys Source: https://github.com/atmospherelabs-dev/cipherpay-api/blob/main/README.md Lists all full and restricted API keys for the authenticated merchant. ```APIDOC ## GET /api/merchants/me/keys ### Description Lists all full and restricted API keys for the authenticated merchant. ### Method GET ### Endpoint /api/merchants/me/keys ### Authentication Full / Session ### Response #### Success Response (200) - **keys** (array) - List of API keys #### Response Example { "keys": [] } ``` -------------------------------- ### GET /api/rates Source: https://github.com/atmospherelabs-dev/cipherpay-api/blob/main/README.md Retrieves current ZEC exchange rates. ```APIDOC ## GET /api/rates ### Description Retrieves current ZEC exchange rates. ### Method GET ### Endpoint /api/rates ### Response #### Success Response (200) - **rates** (object) - Exchange rates for ZEC #### Response Example { "rates": {} } ``` -------------------------------- ### GET /api/prices/{id}/public Source: https://github.com/atmospherelabs-dev/cipherpay-api/blob/main/README.md Retrieves public price information. ```APIDOC ## GET /api/prices/{id}/public ### Description Retrieves public price information. ### Method GET ### Endpoint /api/prices/{id}/public ### Parameters #### Path Parameters - **id** (string) - Required - Price ID ### Response #### Success Response (200) - **price** (object) - Public price info #### Response Example { "price": {} } ``` -------------------------------- ### GET /api/invoices/{id} Source: https://github.com/atmospherelabs-dev/cipherpay-api/blob/main/README.md Retrieves a specific invoice. ```APIDOC ## GET /api/invoices/{id} ### Description Retrieves a specific invoice. ### Method GET ### Endpoint /api/invoices/{id} ### Parameters #### Path Parameters - **id** (string) - Required - Invoice ID ### Response #### Success Response (200) - **invoice** (object) - Invoice details #### Response Example { "invoice": {} } ``` -------------------------------- ### GET /api/rates Source: https://github.com/atmospherelabs-dev/cipherpay-api/blob/main/SPEC.md Returns current ZEC exchange rates for EUR and USD. Rates are cached for 5 minutes. ```APIDOC ## GET /api/rates ### Description Returns current ZEC exchange rates for EUR and USD. Rates are cached for 5 minutes. ### Method GET ### Endpoint /api/rates ### Response #### Success Response (200) - **zec_eur** (number) - The ZEC to EUR exchange rate. - **zec_usd** (number) - The ZEC to USD exchange rate. - **updated_at** (string) - The timestamp when the rates were last updated. #### Response Example { "zec_eur": 35.42, "zec_usd": 38.10, "updated_at": "2026-02-21T15:00:00Z" } ``` -------------------------------- ### GET /api/merchants/me/billing/history Source: https://github.com/atmospherelabs-dev/cipherpay-api/blob/main/README.md Retrieves the billing history for the authenticated merchant. ```APIDOC ## GET /api/merchants/me/billing/history ### Description Retrieves the billing history for the authenticated merchant. ### Method GET ### Endpoint /api/merchants/me/billing/history ### Authentication Session ### Response #### Success Response (200) - **history** (array) - Billing history entries #### Response Example { "history": [] } ``` -------------------------------- ### Generate testnet address and export viewing key with zcash-cli Source: https://github.com/atmospherelabs-dev/cipherpay-api/blob/main/TESTNET_GUIDE.md Use these commands when running a testnet node to create a new address and export its viewing key. The exported key is needed for CipherPay's UFVK configuration. ```bash # Generate a new address zcash-cli -testnet z_getnewaddress # Export the viewing key zcash-cli -testnet z_exportviewingkey "YOUR_ADDRESS" ``` -------------------------------- ### GET /api/merchants/me/x402/history Source: https://github.com/atmospherelabs-dev/cipherpay-api/blob/main/README.md Retrieves x402 verification history for the authenticated merchant. ```APIDOC ## GET /api/merchants/me/x402/history ### Description Retrieves x402 verification history for the authenticated merchant. ### Method GET ### Endpoint /api/merchants/me/x402/history ### Authentication Session ### Response #### Success Response (200) - **history** (array) - List of verification records #### Response Example { "history": [] } ``` -------------------------------- ### GET /api/merchants/me Source: https://github.com/atmospherelabs-dev/cipherpay-api/blob/main/README.md Retrieves the authenticated merchant's profile. ```APIDOC ## GET /api/merchants/me ### Description Retrieves the authenticated merchant's profile. ### Method GET ### Endpoint /api/merchants/me ### Authentication Session ### Response #### Success Response (200) - **merchant** (object) - Merchant profile #### Response Example { "merchant": {} } ``` -------------------------------- ### GET /api/invoices/{id}/qr Source: https://github.com/atmospherelabs-dev/cipherpay-api/blob/main/README.md Retrieves a QR code image for the invoice. ```APIDOC ## GET /api/invoices/{id}/qr ### Description Retrieves a QR code image for the invoice. ### Method GET ### Endpoint /api/invoices/{id}/qr ### Parameters #### Path Parameters - **id** (string) - Required - Invoice ID ### Response #### Success Response (200) - **image** (binary) - QR code image #### Response Example (image data) ``` -------------------------------- ### POST /x402/verify request example Source: https://github.com/atmospherelabs-dev/cipherpay-api/blob/main/docs/AI_AGENTS.md Resource server calls CipherPay to verify a Zcash payment. Requires a Bearer API key (cpay_sk_...) and provides the transaction ID, expected amount, and token. Returns { "valid": true } if the payment decrypts and matches. ```http POST https://api.cipherpay.app/x402/verify Authorization: Bearer cpay_sk_... { "txid": "7f3a9b...", "expected_amount": "0.001", "expected_token": "ZEC" } ``` -------------------------------- ### GET /api/rates Response (200) Source: https://github.com/atmospherelabs-dev/cipherpay-api/blob/main/SPEC.md Current ZEC exchange rates, cached for 5 minutes. ```json { "zec_eur": 35.42, "zec_usd": 38.10, "updated_at": "2026-02-21T15:00:00Z" } ``` -------------------------------- ### GET /api/health Source: https://github.com/atmospherelabs-dev/cipherpay-api/blob/main/README.md Health check endpoint to verify the API is running. ```APIDOC ## GET /api/health ### Description Health check endpoint to verify the API is running. ### Method GET ### Endpoint /api/health ### Response #### Success Response (200) - **status** (string) - Health status #### Response Example { "status": "ok" } ``` -------------------------------- ### Stream payment status via SSE (GET /api/invoices//stream) Source: https://github.com/atmospherelabs-dev/cipherpay-api/blob/main/README.md Opens a Server-Sent Events stream to receive real-time payment status updates for a specific invoice. Use curl -N to disable buffering. ```bash curl -N http://localhost:3080/api/invoices//stream ``` -------------------------------- ### GET /api/health Response Source: https://github.com/atmospherelabs-dev/cipherpay-api/blob/main/SPEC.md Health check endpoint response. ```json { "status": "ok", "service": "cipherpay", "version": "0.1.0" } ``` -------------------------------- ### GET /api/invoices/{id}/status Source: https://github.com/atmospherelabs-dev/cipherpay-api/blob/main/README.md Polls the payment status of an invoice. ```APIDOC ## GET /api/invoices/{id}/status ### Description Polls the payment status of an invoice. ### Method GET ### Endpoint /api/invoices/{id}/status ### Parameters #### Path Parameters - **id** (string) - Required - Invoice ID ### Response #### Success Response (200) - **status** (string) - Payment status #### Response Example { "status": "paid" } ``` -------------------------------- ### GET /api/invoices/{id} Response (200) Source: https://github.com/atmospherelabs-dev/cipherpay-api/blob/main/SPEC.md Full invoice details including status and detected transaction ID. ```json { "id": "uuid", "merchant_id": "uuid", "memo_code": "CP-A7F3B2C1", "product_name": "[REDACTED] Tee", "size": "L", "price_eur": 65.00, "price_zec": 1.835, "status": "pending", "detected_txid": null, "expires_at": "2026-02-21T15:30:00Z", "created_at": "2026-02-21T15:00:00Z" } ``` -------------------------------- ### GET /api/invoices/{id}/stream Source: https://github.com/atmospherelabs-dev/cipherpay-api/blob/main/README.md Streams payment status updates via Server-Sent Events (SSE). ```APIDOC ## GET /api/invoices/{id}/stream ### Description Streams payment status updates via Server-Sent Events (SSE). ### Method GET ### Endpoint /api/invoices/{id}/stream ### Parameters #### Path Parameters - **id** (string) - Required - Invoice ID ### Response #### Success Response (200) - **event** (string) - Payment status event #### Response Example { "event": "payment.status" } ``` -------------------------------- ### Webhook Event Payload JSON Source: https://github.com/atmospherelabs-dev/cipherpay-api/blob/main/SPEC.md Example HTTP POST payload sent to the merchant's webhook_url on status changes. Contains event type, invoice_id, txid, and timestamp. ```json { "event": "detected", "invoice_id": "uuid", "txid": "abc123...", "timestamp": "2026-02-21T15:05:00Z" } ``` -------------------------------- ### GET /api/invoices/{id}/status Response (200) Source: https://github.com/atmospherelabs-dev/cipherpay-api/blob/main/SPEC.md Lightweight status endpoint for widget polling. Status values: pending → detected → confirmed (or expired / refunded). ```json { "invoice_id": "uuid", "status": "detected", "detected_txid": "abc123...", "confirmations": null } ``` -------------------------------- ### GET /api/invoices/{id}/stream Source: https://github.com/atmospherelabs-dev/cipherpay-api/blob/main/README.md Streams payment status updates for an invoice using Server-Sent Events (SSE). ```APIDOC ## GET /api/invoices/{id}/stream ### Description Streams payment status updates for an invoice using Server-Sent Events (SSE). ### Method GET ### Endpoint /api/invoices/{id}/stream ### Parameters #### Path Parameters - **id** (string) - Required - The ID of the invoice. ### Response #### Success Response (200) - **event** (string) - The type of event (e.g., invoice.confirmed, invoice.expired, invoice.cancelled). - **data** (object) - The event data. #### Response Example { "event": "invoice.confirmed", "data": {} } ``` -------------------------------- ### GET /api/health Source: https://github.com/atmospherelabs-dev/cipherpay-api/blob/main/SPEC.md Health check endpoint that returns the service status, service name, and version. Use it to verify the API is running. ```APIDOC ## GET /api/health ### Description Health check endpoint that returns the service status, service name, and version. ### Method GET ### Endpoint /api/health ### Response #### Success Response (200) - **status** (string) - Service status, e.g., "ok" - **service** (string) - Service name, e.g., "cipherpay" - **version** (string) - API version, e.g., "0.1.0" #### Response Example { "status": "ok", "service": "cipherpay", "version": "0.1.0" } ``` -------------------------------- ### GET /api/invoices/{id} Source: https://github.com/atmospherelabs-dev/cipherpay-api/blob/main/SPEC.md Retrieves full details of a specific invoice by its ID. Returns all invoice fields including status and detected transaction ID. ```APIDOC ## GET /api/invoices/{id} ### Description Retrieves full details of a specific invoice by its ID. Returns all invoice fields including status and detected transaction ID. ### Method GET ### Endpoint /api/invoices/{id} ### Parameters #### Path Parameters - **id** (string) - Required - The unique identifier of the invoice. ### Response #### Success Response (200) - **id** (string) - The invoice ID. - **merchant_id** (string) - The merchant ID. - **memo_code** (string) - The memo code. - **product_name** (string) - The product name. - **size** (string) - The product size. - **price_eur** (number) - The price in EUR. - **price_zec** (number) - The price in ZEC. - **status** (string) - The invoice status (pending, detected, confirmed, expired, refunded). - **detected_txid** (string|null) - The detected transaction ID, if any. - **expires_at** (string) - The expiration timestamp. - **created_at** (string) - The creation timestamp. #### Response Example { "id": "uuid", "merchant_id": "uuid", "memo_code": "CP-A7F3B2C1", "product_name": "[REDACTED] Tee", "size": "L", "price_eur": 65.00, "price_zec": 1.835, "status": "pending", "detected_txid": null, "expires_at": "2026-02-21T15:30:00Z", "created_at": "2026-02-21T15:00:00Z" } ``` -------------------------------- ### GET /api/invoices/{id}/status Source: https://github.com/atmospherelabs-dev/cipherpay-api/blob/main/SPEC.md Lightweight status endpoint for widget polling. Returns the invoice status and detected transaction ID if available. ```APIDOC ## GET /api/invoices/{id}/status ### Description Lightweight status endpoint for widget polling. Returns the invoice status and detected transaction ID if available. ### Method GET ### Endpoint /api/invoices/{id}/status ### Parameters #### Path Parameters - **id** (string) - Required - The unique identifier of the invoice. ### Response #### Success Response (200) - **invoice_id** (string) - The invoice ID. - **status** (string) - The invoice status (pending, detected, confirmed, expired, refunded). - **detected_txid** (string|null) - The detected transaction ID, if any. - **confirmations** (number|null) - The number of confirmations, if any. #### Response Example { "invoice_id": "uuid", "status": "detected", "detected_txid": "abc123...", "confirmations": null } ``` -------------------------------- ### CipherPay payment detection flow Source: https://github.com/atmospherelabs-dev/cipherpay-api/blob/main/TESTNET_GUIDE.md Shows the end-to-end flow from buyer sending ZEC to CipherPay detecting and confirming the payment. The scanner polls every 5 seconds, trial-decrypts with the merchant's UFVK, and checks for block inclusion. ```text Buyer sends ZEC → Mempool → CipherPay Scanner polls every 5s ↓ Fetches raw tx hex from CipherScan API ↓ Trial-decrypts with merchant's UFVK ↓ Memo matches invoice? → DETECTED! ↓ Block mined? → CONFIRMED! ``` -------------------------------- ### Create a product and add a price (POST /api/products, /api/prices) Source: https://github.com/atmospherelabs-dev/cipherpay-api/blob/main/README.md Creates a product with a name and slug, then adds a price to it using the returned product_id. Both requests require an API key in the Authorization header. ```bash # Create product curl -X POST http://localhost:3080/api/products \ -H "Authorization: Bearer " \ -H "Content-Type: application/json" \ -d '{"name": "T-Shirt", "slug": "t-shirt"}' # Add a price curl -X POST http://localhost:3080/api/prices \ -H "Authorization: Bearer " \ -H "Content-Type: application/json" \ -d '{"product_id": "", "unit_amount": 29.99, "currency": "USD"}' ``` -------------------------------- ### Create invoice directly (POST /api/invoices) Source: https://github.com/atmospherelabs-dev/cipherpay-api/blob/main/README.md Creates an invoice directly with product details and a price in EUR. Requires an API key in the Authorization header. ```bash curl -X POST http://localhost:3080/api/invoices \ -H "Authorization: Bearer " \ -H "Content-Type: application/json" \ -d '{"product_name": "T-Shirt", "size": "L", "price_eur": 65.00}' ``` -------------------------------- ### POST /api/products Source: https://github.com/atmospherelabs-dev/cipherpay-api/blob/main/README.md Creates a new product. ```APIDOC ## POST /api/products ### Description Creates a new product. ### Method POST ### Endpoint /api/products ### Authentication API key ### Parameters #### Request Body - **product details** (object) - Required - Product information ### Request Example { "product details": {} } ### Response #### Success Response (200) - **product** (object) - Created product object #### Response Example { "product": {} } ``` -------------------------------- ### Docker Production Build and Run Source: https://github.com/atmospherelabs-dev/cipherpay-api/blob/main/SPEC.md Builds the CipherPay Docker image and runs it with environment variables from .env, mapping port 3080. Use for production deployment. ```bash docker build -t cipherpay . docker run -d \ --env-file .env \ -p 3080:3080 \ cipherpay ``` -------------------------------- ### POST /api/products Source: https://github.com/atmospherelabs-dev/cipherpay-api/blob/main/README.md Creates a new product. Requires authentication with the merchant's API key. ```APIDOC ## POST /api/products ### Description Creates a new product. Requires authentication with the merchant's API key. ### Method POST ### Endpoint /api/products ### Parameters #### Headers - **Authorization** (string) - Required - Bearer token with the merchant's API key. #### Request Body - **name** (string) - Required - The name of the product. - **slug** (string) - Required - The slug for the product. ### Request Example { "name": "T-Shirt", "slug": "t-shirt" } ### Response #### Success Response (200) - **product_id** (string) - The ID of the created product. #### Response Example { "product_id": "..." } ``` -------------------------------- ### Build CipherPay in release mode Source: https://github.com/atmospherelabs-dev/cipherpay-api/blob/main/README.md Compiles the project with optimizations. The resulting binary is placed at target/release/cipherpay. ```bash cargo build --release # Binary at target/release/cipherpay ``` -------------------------------- ### POST /api/merchants/me/keys Source: https://github.com/atmospherelabs-dev/cipherpay-api/blob/main/README.md Mints a new API key. Returns the raw key once. ```APIDOC ## POST /api/merchants/me/keys ### Description Mints a new API key. Returns the raw key once. ### Method POST ### Endpoint /api/merchants/me/keys ### Authentication Full / Session ### Parameters #### Request Body - **type** (string) - Required - Key type (full or restricted) - **label** (string) - Required - Key label ### Request Example { "type": "full", "label": "My Key" } ### Response #### Success Response (200) - **key** (string) - Raw API key (returned once) #### Response Example { "key": "string" } ``` -------------------------------- ### Accept ZEC via x402 with @cipherpay/x402 middleware Source: https://github.com/atmospherelabs-dev/cipherpay-api/blob/main/docs/AI_AGENTS.md One-line server middleware to accept ZEC payments via x402. Routes verifications through CipherPay facilitator. Free and open source. ```typescript import { cipherPayMiddleware } from '@cipherpay/x402'; app.use('/api/premium/*', cipherPayMiddleware({ amount: '0.001', currency: 'ZEC', facilitator: 'https://api.cipherpay.app', })); ``` -------------------------------- ### Register a merchant (POST /api/merchants) Source: https://github.com/atmospherelabs-dev/cipherpay-api/blob/main/README.md Registers a merchant with a UFVK and name. The response includes api_key and dashboard_token, which are shown only once and must be saved. ```bash curl -X POST http://localhost:3080/api/merchants \ -H "Content-Type: application/json" \ -d '{"ufvk": "uview1...", "name": "My Store"}' ``` -------------------------------- ### POST /api/checkout Source: https://github.com/atmospherelabs-dev/cipherpay-api/blob/main/README.md Creates an invoice from a product/price. ```APIDOC ## POST /api/checkout ### Description Creates an invoice from a product/price. ### Method POST ### Endpoint /api/checkout ### Parameters #### Request Body - **product_id** (string) - Required - Product ID - **price_id** (string) - Required - Price ID ### Request Example { "product_id": "string", "price_id": "string" } ### Response #### Success Response (200) - **invoice** (object) - Created invoice object #### Response Example { "invoice": {} } ``` -------------------------------- ### POST /api/checkout Source: https://github.com/atmospherelabs-dev/cipherpay-api/blob/main/README.md Creates an invoice from a product and price. This is the checkout endpoint. ```APIDOC ## POST /api/checkout ### Description Creates an invoice from a product and price. This is the checkout endpoint. ### Method POST ### Endpoint /api/checkout ### Parameters #### Request Body - **product_id** (string) - Required - The ID of the product. - **price_id** (string) - Required - The ID of the price. ### Request Example { "product_id": "", "price_id": "" } ### Response #### Success Response (200) - **invoice_id** (string) - The ID of the created invoice. #### Response Example { "invoice_id": "..." } ``` -------------------------------- ### POST /api/prices Source: https://github.com/atmospherelabs-dev/cipherpay-api/blob/main/README.md Creates a new price for a product. ```APIDOC ## POST /api/prices ### Description Creates a new price for a product. ### Method POST ### Endpoint /api/prices ### Authentication API key ### Parameters #### Request Body - **price details** (object) - Required - Price information ### Request Example { "price details": {} } ### Response #### Success Response (200) - **price** (object) - Created price object #### Response Example { "price": {} } ``` -------------------------------- ### POST /api/invoices Source: https://github.com/atmospherelabs-dev/cipherpay-api/blob/main/README.md Creates an invoice directly with product details. Requires authentication with the merchant's API key. ```APIDOC ## POST /api/invoices ### Description Creates an invoice directly with product details. Requires authentication with the merchant's API key. ### Method POST ### Endpoint /api/invoices ### Parameters #### Headers - **Authorization** (string) - Required - Bearer token with the merchant's API key. #### Request Body - **product_name** (string) - Required - The name of the product. - **size** (string) - Required - The size of the product. - **price_eur** (number) - Required - The price in EUR. ### Request Example { "product_name": "T-Shirt", "size": "L", "price_eur": 65.00 } ### Response #### Success Response (200) - **invoice_id** (string) - The ID of the created invoice. #### Response Example { "invoice_id": "..." } ``` -------------------------------- ### POST /api/auth/session Source: https://github.com/atmospherelabs-dev/cipherpay-api/blob/main/README.md Logs in using a dashboard token to create a session. ```APIDOC ## POST /api/auth/session ### Description Logs in using a dashboard token to create a session. ### Method POST ### Endpoint /api/auth/session ### Parameters #### Request Body - **token** (string) - Required - Dashboard token ### Request Example { "token": "string" } ### Response #### Success Response (200) - **session** (object) - Session details #### Response Example { "session": {} } ``` -------------------------------- ### POST /api/invoices Source: https://github.com/atmospherelabs-dev/cipherpay-api/blob/main/SPEC.md Creates a payment invoice. Returns invoice details including the memo code, prices in EUR and ZEC, and expiration time. ```APIDOC ## POST /api/invoices ### Description Creates a payment invoice. Returns invoice details including the memo code, prices in EUR and ZEC, and expiration time. ### Method POST ### Endpoint /api/invoices ### Parameters #### Request Body - **product_name** (string) - Required - The name of the product. - **size** (string) - Required - The size of the product. - **price_eur** (number) - Required - The price in EUR. ### Request Example { "product_name": "[REDACTED] Tee", "size": "L", "price_eur": 65.00 } ### Response #### Success Response (201) - **invoice_id** (string) - The unique identifier for the invoice. - **memo_code** (string) - The memo code for the payment. - **price_eur** (number) - The price in EUR. - **price_zec** (number) - The price in ZEC. - **zec_rate** (number) - The ZEC exchange rate used. - **expires_at** (string) - The expiration timestamp. #### Response Example { "invoice_id": "uuid", "memo_code": "CP-A7F3B2C1", "price_eur": 65.00, "price_zec": 1.835, "zec_rate": 35.42, "expires_at": "2026-02-21T15:30:00Z" } ``` -------------------------------- ### POST /api/prices Source: https://github.com/atmospherelabs-dev/cipherpay-api/blob/main/README.md Adds a price to an existing product. Requires authentication with the merchant's API key. ```APIDOC ## POST /api/prices ### Description Adds a price to an existing product. Requires authentication with the merchant's API key. ### Method POST ### Endpoint /api/prices ### Parameters #### Headers - **Authorization** (string) - Required - Bearer token with the merchant's API key. #### Request Body - **product_id** (string) - Required - The ID of the product to which the price is added. - **unit_amount** (number) - Required - The unit amount of the price. - **currency** (string) - Required - The currency code (e.g., USD). ### Request Example { "product_id": "", "unit_amount": 29.99, "currency": "USD" } ### Response #### Success Response (200) - **price_id** (string) - The ID of the created price. #### Response Example { "price_id": "..." } ``` -------------------------------- ### POST /api/subscriptions Source: https://github.com/atmospherelabs-dev/cipherpay-api/blob/main/README.md Creates a new subscription. ```APIDOC ## POST /api/subscriptions ### Description Creates a new subscription. ### Method POST ### Endpoint /api/subscriptions ### Authentication API key ### Parameters #### Request Body - **subscription details** (object) - Required - Subscription information ### Request Example { "subscription details": {} } ### Response #### Success Response (200) - **subscription** (object) - Created subscription object #### Response Example { "subscription": {} } ``` -------------------------------- ### POST /api/x402/verify Source: https://github.com/atmospherelabs-dev/cipherpay-api/blob/main/README.md Verifies an HTTP 402 payment. ```APIDOC ## POST /api/x402/verify ### Description Verifies an HTTP 402 payment. ### Method POST ### Endpoint /api/x402/verify ### Authentication API key ### Parameters #### Request Body - **payment details** (object) - Required - Payment verification information ### Request Example { "payment details": {} } ### Response #### Success Response (200) - **verification** (object) - Verification result #### Response Example { "verification": {} } ``` -------------------------------- ### POST /api/merchants Source: https://github.com/atmospherelabs-dev/cipherpay-api/blob/main/README.md Registers a new merchant. ```APIDOC ## POST /api/merchants ### Description Registers a new merchant. ### Method POST ### Endpoint /api/merchants ### Parameters #### Request Body - **merchant details** (object) - Required - Merchant registration information ### Request Example { "merchant details": {} } ### Response #### Success Response (200) - **merchant** (object) - Created merchant object #### Response Example { "merchant": {} } ``` -------------------------------- ### PATCH /api/products/{id} Source: https://github.com/atmospherelabs-dev/cipherpay-api/blob/main/README.md Updates an existing product. ```APIDOC ## PATCH /api/products/{id} ### Description Updates an existing product. ### Method PATCH ### Endpoint /api/products/{id} ### Authentication API key ### Parameters #### Path Parameters - **id** (string) - Required - Product ID #### Request Body - **product fields** (object) - Required - Fields to update ### Request Example { "product fields": {} } ### Response #### Success Response (200) - **product** (object) - Updated product object #### Response Example { "product": {} } ``` -------------------------------- ### POST /api/merchants Source: https://github.com/atmospherelabs-dev/cipherpay-api/blob/main/README.md Registers a new merchant. Returns an API key and dashboard token that are shown only once. ```APIDOC ## POST /api/merchants ### Description Registers a new merchant. Returns an API key and dashboard token that are shown only once. ### Method POST ### Endpoint /api/merchants ### Parameters #### Request Body - **ufvk** (string) - Required - The UFVK (user-facing verification key) for the merchant. - **name** (string) - Required - The name of the merchant store. ### Request Example { "ufvk": "uview1...", "name": "My Store" } ### Response #### Success Response (200) - **api_key** (string) - The API key for authenticating subsequent requests. - **dashboard_token** (string) - The token for accessing the dashboard. #### Response Example { "api_key": "...", "dashboard_token": "..." } ``` -------------------------------- ### POST /api/invoices Source: https://github.com/atmospherelabs-dev/cipherpay-api/blob/main/README.md Creates a new invoice. ```APIDOC ## POST /api/invoices ### Description Creates a new invoice. ### Method POST ### Endpoint /api/invoices ### Authentication API key ### Parameters #### Request Body - **invoice details** (object) - Required - Invoice information ### Request Example { "invoice details": {} } ### Response #### Success Response (200) - **invoice** (object) - Created invoice object #### Response Example { "invoice": {} } ``` -------------------------------- ### POST /api/merchants Request Source: https://github.com/atmospherelabs-dev/cipherpay-api/blob/main/SPEC.md Request body for registering a new merchant. ```json { "ufvk": "uview1...", "webhook_url": "https://example.com/webhook" } ``` -------------------------------- ### POST /api/merchants Source: https://github.com/atmospherelabs-dev/cipherpay-api/blob/main/SPEC.md Registers a new merchant. Returns a merchant ID and an API key that must be stored securely as it cannot be retrieved again. ```APIDOC ## POST /api/merchants ### Description Registers a new merchant. Returns a merchant ID and an API key that must be stored securely as it cannot be retrieved again. ### Method POST ### Endpoint /api/merchants ### Parameters #### Request Body - **ufvk** (string) - Required - The UFVK (unified full viewing key) for the merchant. - **webhook_url** (string) - Required - The URL to receive webhook notifications. ### Request Example { "ufvk": "uview1...", "webhook_url": "https://example.com/webhook" } ### Response #### Success Response (201) - **merchant_id** (string) - The unique identifier for the merchant. - **api_key** (string) - The API key for the merchant. Store securely. #### Response Example { "merchant_id": "uuid", "api_key": "cpay_abc123..." } ``` -------------------------------- ### DELETE /api/products/{id} Source: https://github.com/atmospherelabs-dev/cipherpay-api/blob/main/README.md Deactivates a product. ```APIDOC ## DELETE /api/products/{id} ### Description Deactivates a product. ### Method DELETE ### Endpoint /api/products/{id} ### Authentication API key ### Parameters #### Path Parameters - **id** (string) - Required - Product ID ### Response #### Success Response (200) - **message** (string) - Confirmation message #### Response Example { "message": "Product deactivated" } ``` -------------------------------- ### POST /api/invoices Response (201) Source: https://github.com/atmospherelabs-dev/cipherpay-api/blob/main/SPEC.md Response containing invoice details including memo_code, price_zec, and expiry. ```json { "invoice_id": "uuid", "memo_code": "CP-A7F3B2C1", "price_eur": 65.00, "price_zec": 1.835, "zec_rate": 35.42, "expires_at": "2026-02-21T15:30:00Z" } ``` -------------------------------- ### POST /api/auth/recover/confirm Source: https://github.com/atmospherelabs-dev/cipherpay-api/blob/main/README.md Confirms the recovery request with a token. ```APIDOC ## POST /api/auth/recover/confirm ### Description Confirms the recovery request with a token. ### Method POST ### Endpoint /api/auth/recover/confirm ### Parameters #### Request Body - **token** (string) - Required - Recovery token ### Request Example { "token": "string" } ### Response #### Success Response (200) - **message** (string) - Confirmation message #### Response Example { "message": "Recovery confirmed" } ``` -------------------------------- ### POST /api/invoices Request Source: https://github.com/atmospherelabs-dev/cipherpay-api/blob/main/SPEC.md Request body for creating a payment invoice. ```json { "product_name": "[REDACTED] Tee", "size": "L", "price_eur": 65.00 } ``` -------------------------------- ### POST /api/auth/recover Source: https://github.com/atmospherelabs-dev/cipherpay-api/blob/main/README.md Requests a recovery email for account recovery. ```APIDOC ## POST /api/auth/recover ### Description Requests a recovery email for account recovery. ### Method POST ### Endpoint /api/auth/recover ### Parameters #### Request Body - **email** (string) - Required - Email address for recovery ### Request Example { "email": "user@example.com" } ### Response #### Success Response (200) - **message** (string) - Confirmation message #### Response Example { "message": "Recovery email sent" } ``` -------------------------------- ### POST /api/auth/logout Source: https://github.com/atmospherelabs-dev/cipherpay-api/blob/main/README.md Logs out the current session. ```APIDOC ## POST /api/auth/logout ### Description Logs out the current session. ### Method POST ### Endpoint /api/auth/logout ### Authentication Session ### Response #### Success Response (200) - **message** (string) - Logout confirmation #### Response Example { "message": "Logged out" } ``` -------------------------------- ### PATCH /api/prices/{id} Source: https://github.com/atmospherelabs-dev/cipherpay-api/blob/main/README.md Updates an existing price. ```APIDOC ## PATCH /api/prices/{id} ### Description Updates an existing price. ### Method PATCH ### Endpoint /api/prices/{id} ### Authentication API key ### Parameters #### Path Parameters - **id** (string) - Required - Price ID #### Request Body - **price fields** (object) - Required - Fields to update ### Request Example { "price fields": {} } ### Response #### Success Response (200) - **price** (object) - Updated price object #### Response Example { "price": {} } ``` -------------------------------- ### POST /api/merchants Response (201) Source: https://github.com/atmospherelabs-dev/cipherpay-api/blob/main/SPEC.md Response containing merchant_id and api_key. Store the api_key securely; it cannot be retrieved again. ```json { "merchant_id": "uuid", "api_key": "cpay_abc123..." } ``` -------------------------------- ### POST /api/invoices/{id}/refund Source: https://github.com/atmospherelabs-dev/cipherpay-api/blob/main/README.md Refunds an invoice. ```APIDOC ## POST /api/invoices/{id}/refund ### Description Refunds an invoice. ### Method POST ### Endpoint /api/invoices/{id}/refund ### Authentication API key ### Parameters #### Path Parameters - **id** (string) - Required - Invoice ID ### Response #### Success Response (200) - **invoice** (object) - Refunded invoice #### Response Example { "invoice": {} } ``` -------------------------------- ### DELETE /api/merchants/me/keys/{id} Source: https://github.com/atmospherelabs-dev/cipherpay-api/blob/main/README.md Revokes an API key immediately. ```APIDOC ## DELETE /api/merchants/me/keys/{id} ### Description Revokes an API key immediately. ### Method DELETE ### Endpoint /api/merchants/me/keys/{id} ### Authentication Full / Session ### Parameters #### Path Parameters - **id** (string) - Required - API key ID ### Response #### Success Response (200) - **message** (string) - Confirmation message #### Response Example { "message": "Key revoked" } ``` -------------------------------- ### POST /api/subscriptions/{id}/cancel Source: https://github.com/atmospherelabs-dev/cipherpay-api/blob/main/README.md Cancels a subscription. ```APIDOC ## POST /api/subscriptions/{id}/cancel ### Description Cancels a subscription. ### Method POST ### Endpoint /api/subscriptions/{id}/cancel ### Authentication API key ### Parameters #### Path Parameters - **id** (string) - Required - Subscription ID ### Response #### Success Response (200) - **subscription** (object) - Cancelled subscription #### Response Example { "subscription": {} } ``` -------------------------------- ### Embeddable Widget HTML Source: https://github.com/atmospherelabs-dev/cipherpay-api/blob/main/SPEC.md Drop this HTML into any page to embed the CipherPay payment widget. It displays ZEC amount, EUR equivalent, QR code, and memo code, polls for payment status every 5 seconds, and auto-expires when the invoice timer runs out. ```html
``` -------------------------------- ### POST /api/merchants/me/billing/settle Source: https://github.com/atmospherelabs-dev/cipherpay-api/blob/main/README.md Settles outstanding fees for the authenticated merchant. ```APIDOC ## POST /api/merchants/me/billing/settle ### Description Settles outstanding fees for the authenticated merchant. ### Method POST ### Endpoint /api/merchants/me/billing/settle ### Authentication Session ### Response #### Success Response (200) - **message** (string) - Settlement confirmation #### Response Example { "message": "Fees settled" } ``` -------------------------------- ### POST /api/invoices/{id}/finalize Source: https://github.com/atmospherelabs-dev/cipherpay-api/blob/main/README.md Locks the exchange rate for an invoice. ```APIDOC ## POST /api/invoices/{id}/finalize ### Description Locks the exchange rate for an invoice. ### Method POST ### Endpoint /api/invoices/{id}/finalize ### Parameters #### Path Parameters - **id** (string) - Required - Invoice ID ### Response #### Success Response (200) - **invoice** (object) - Updated invoice with locked rate #### Response Example { "invoice": {} } ``` -------------------------------- ### PATCH /api/invoices/{id}/refund-address Source: https://github.com/atmospherelabs-dev/cipherpay-api/blob/main/README.md Sets the refund address for an invoice. ```APIDOC ## PATCH /api/invoices/{id}/refund-address ### Description Sets the refund address for an invoice. ### Method PATCH ### Endpoint /api/invoices/{id}/refund-address ### Parameters #### Path Parameters - **id** (string) - Required - Invoice ID #### Request Body - **refund_address** (string) - Required - Refund address ### Request Example { "refund_address": "string" } ### Response #### Success Response (200) - **invoice** (object) - Updated invoice #### Response Example { "invoice": {} } ``` -------------------------------- ### POST /api/invoices/{id}/cancel Source: https://github.com/atmospherelabs-dev/cipherpay-api/blob/main/README.md Cancels an invoice. ```APIDOC ## POST /api/invoices/{id}/cancel ### Description Cancels an invoice. ### Method POST ### Endpoint /api/invoices/{id}/cancel ### Authentication API key ### Parameters #### Path Parameters - **id** (string) - Required - Invoice ID ### Response #### Success Response (200) - **invoice** (object) - Cancelled invoice #### Response Example { "invoice": {} } ```