Skip to content

POST legal_entity_applications/[id]/checkout_session

Create a payment checkout session for a legal entity application invoice.

Endpoint

text
POST /api/v1/legal_entity_applications/{id}/checkout_session

Authentication

This endpoint accepts:

  • a standard API key (sk-)
  • an Agent Key (ak-) with the agent:payment.initiate scope

Send the key in the Authorization header:

text
Authorization: Bearer <your-secret-key>
Authorization: Bearer <your-agent-key> (requires `agent:payment.initiate`)

Prerequisites

  • The application must be in Draft status
  • The application must have been created via the API
  • The application must belong to the authenticated account

Path Parameters

ParameterTypeRequiredDescription
idstringYesThe unique identifier of the legal entity application

Request Body

FieldTypeRequiredDescription
paymentProviderstringYesPayment provider to initialize
redirectUrlstringYesRedirect URL to return to after checkout
emailstring | nullNoOptional email address for the checkout session

Supported Payment Providers

  • stripe
  • stripe-crypto
  • lnbits
  • solana-pay-ptc

Example Request

bash
curl -X POST https://portal.eprospera.com/api/v1/legal_entity_applications/12345678-abcd-1234-abcd-123456789012/checkout_session \
  -H "Authorization: Bearer ak-REDACTED" \
  -H "Content-Type: application/json" \
  -d '{
    "paymentProvider": "stripe",
    "email": "founder@example.com",
    "redirectUrl": "https://example.com/payment-complete"
  }'

Response

Success Response (200 OK)

FieldTypeDescription
dataobjectProvider-specific checkout session payload
invoiceIdstringInvoice associated with the application

Example Response

json
{
  "data": {
    "url": "https://checkout.stripe.com/c/pay/cs_test_..."
  },
  "invoiceId": "inv_1234567890"
}

Error Responses

400 Bad Request

Invalid request body — includes a details array describing each schema violation (matches the Zod issue shape):

json
{
  "error": "Invalid request body",
  "details": [
    {
      "code": "invalid_type",
      "expected": "string",
      "received": "undefined",
      "path": ["paymentProvider"],
      "message": "Required"
    }
  ]
}

Application not in draft status:

json
{
  "error": "Legal entity application is not in draft status"
}

Application not created via API:

json
{
  "error": "This endpoint can only be used for API-created applications"
}

Invoice already paid:

json
{
  "error": "Legal entity application invoice is already paid"
}

Invoice not open for payment:

json
{
  "error": "Legal entity application invoice is not open for payment"
}

401 Unauthorized

Missing or invalid API key:

json
{
  "error": "Invalid API key"
}

403 Forbidden

Agent Key missing the required scope:

json
{
  "error": "Insufficient permissions"
}

404 Not Found

Application not found or not owned by the authenticated account:

json
{
  "error": "Legal entity application not found"
}

500 Internal Server Error

json
{
  "error": "Internal server error"
}

Notes

  • The API creates or reuses the application invoice automatically
  • Successful responses currently use data.url for the provider redirect URL
  • Successful Agent Key calls to this endpoint are audited and notify the account owner by email
  • This endpoint creates a checkout session only; it does not submit the application by itself