> ## Documentation Index
> Fetch the complete documentation index at: https://usenaive.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Retry Formation Payment

> POST /v1/formation/:id/retry-payment — Generate a fresh hosted checkout URL for a formation whose checkout session expired.

If the user doesn't complete payment within the checkout window, the original session expires and the formation status becomes `failed` (with `formation_error: "hosted checkout session expired before payment"`). Use this endpoint to generate a new checkout URL for the same formation without losing the business info or starting over.

This endpoint:

* Reverts the formation to `awaiting_payment` status
* Clears `formation_error`
* Creates a new hosted checkout session
* Returns the new `checkout_url`

<ParamField path="id" type="string" required>
  UUID of the formation.
</ParamField>

<RequestExample>
  ```bash theme={"theme":"css-variables"}
  curl -X POST https://api.usenaive.ai/v1/formation/formation-uuid/retry-payment \
    -H "Authorization: Bearer nv_sk_live_..."
  ```
</RequestExample>

<ResponseExample>
  ```json 200 theme={"theme":"css-variables"}
  {
    "id": "formation-uuid",
    "status": "awaiting_payment",
    "payment_status": "unpaid",
    "checkout_url": "https://checkout.usenaive.ai/c/pay/cs_test_new_xxx",
    "checkout_session_id": "cs_test_new_xxx",
    "price_usd": "$349",
    "next_step": "Open the checkout_url to complete payment, then call POST /v1/formation/:id/submit to submit the formation"
  }
  ```
</ResponseExample>

## Restrictions

This endpoint returns `invalid_input` if:

* The formation has already been paid for (`payment_status === "paid"`) -- use `POST /v1/formation/:id/submit` instead
* The formation has already been submitted for filing (`status === "submitted"` or `"formation_completed"`)
