Payments API

The Payments API allows you to manage payments and payment methods for your customers. This includes retrieving payment details, listing payments, and managing payment methods.

Overview

The Payments API is split into two main resources:

  • Payments: Individual payment transactions.
  • Payment Methods: Saved payment methods for customers (e.g., credit cards).

Authentication

All API requests require authentication via merchant credentials.

Payment Methods Endpoints

Get Payment Method by ID

Retrieves a specific payment method by its ID.

GET https://api.getlumen.dev/v1/payment-methods/{paymentMethodId}

Parameters

ParameterTypeDescription
paymentMethodIdstringThe ID of the payment method.

Response

{
  "paymentMethod": {
    "id": "pm_123",
    "provider": "stripe",
    "paymentType": "card",
    "status": "active",
    "cardBrand": "visa",
    "cardLastFour": "4242"
  }
}

Create Payment Method

Creates a new payment method for a customer.

POST https://api.getlumen.dev/v1/payment-methods

Request Body

{
  "customerId": "cust_123",
  "provider": "stripe",
  "paymentType": "card",
  "externalPaymentMethodId": "pm_ext_123",
  "status": "active",
  "cardBrand": "visa",
  "cardLastFour": "4242"
}

Payments Endpoints

Get All Payments

Retrieves a list of all payments for the merchant, optionally filtered by customer ID.

GET https://api.getlumen.dev/v1/payments?customerId={customerId}

Query Parameters

ParameterTypeDescription
customerIdstringThe ID of the customer to filter payments by.

Response

{
  "payments": [
    {
      "id": "pay_123",
      "amountCents": 5000,
      "currency": "usd",
      "status": "succeeded",
      "customerName": "John Doe",
      "planName": "Pro Plan"
    }
  ]
}

Get Payment by ID

Retrieves a specific payment by its ID, including detailed information about the associated invoice, customer, and subscription.

GET https://api.getlumen.dev/v1/payments/{id}

Parameters

ParameterTypeDescription
idstringThe ID of the payment.

Response

{
  "payment": {
    "id": "pay_123",
    "amountCents": 5000,
    "currency": "usd",
    "status": "succeeded",
    "customer": {
      "id": "cust_456",
      "name": "John Doe"
    },
    "invoice": {
      "id": "inv_789",
      "customerInvoiceNumber": "INV-0001"
    }
  }
}