Skip to main content

Overview

Invoices are the core of Shoppex. Every payment starts with an invoice that tracks the customer, products, and payment status.

Invoice Lifecycle

Invoice Statuses

StatusDescription
PENDINGInvoice created, awaiting payment
COMPLETEDPayment completed successfully
PARTIALPartial payment received (crypto underpayment)
VOIDEDInvoice cancelled or expired
WAITING_FOR_CONFIRMATIONSCrypto payment pending blockchain confirmations
CUSTOMER_DISPUTE_ONGOINGCustomer opened a dispute/chargeback
REVERSEDPayment reversed (chargeback won by customer)
REFUNDEDPayment was refunded

Creating an Invoice

Via Dashboard

  1. Go to Invoices → Create Invoice
  2. Select products and quantities
  3. Enter customer email (optional)
  4. Choose allowed payment methods
  5. Click Create

Via API

Use the POST /payments endpoint to create an invoice programmatically:
const response = await fetch('https://api.shoppex.io/dev/v1/payments', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_API_KEY',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    title: 'Order #456',
    email: '[email protected]',
    value: 29.99,
    currency: 'EUR'
  })
});

const { data } = await response.json();
// Redirect to data.url for checkout

Invoice Expiration

By default, invoices expire after 24 hours. You can customize this:
  • Set expires_at when creating the invoice
  • Configure default expiration in Settings → Invoices
Expired invoices cannot be paid. Create a new invoice for the customer if needed.

Partial Payments

Partial payments can occur with cryptocurrency when the customer sends slightly less than required. You can:
  1. Accept as paid - Mark the invoice as paid manually
  2. Request remaining - Customer pays the difference
  3. Refund - Cancel and refund the partial payment

Webhooks

Get notified when invoice status changes:
{
  "event": "order:paid",
  "data": {
    "uniqid": "abc123def456",
    "type": "PRODUCT",
    "status": "COMPLETED",
    "gateway": "STRIPE",
    "total": 29.99,
    "total_display": 29.99,
    "currency": "USD",
    "customer_email": "[email protected]",
    "product_id": "prod_xyz",
    "product_title": "Pro License",
    "created_at": 1705314600,
    "updated_at": 1705314650
  },
  "created_at": 1705314650
}
See Webhooks Guide for setup instructions.