> For the complete documentation index, see [llms.txt](https://docs.mithril.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.mithril.ai/compute-api/compute-api-reference/prepaid-payments.md).

# Prepaid Payments

## Create Prepaid Session

> Open a Customer Session for the Payment Element.

```json
{"openapi":"3.1.0","info":{"title":"Mithril","version":"1.0.0"},"servers":[{"url":"https://api.mithril.ai"}],"security":[{"MithrilAPIKey":[]}],"components":{"securitySchemes":{"MithrilAPIKey":{"type":"http","scheme":"bearer","bearerFormat":"fkey_<key>"}},"schemas":{"PrepaidSessionModel":{"properties":{"customer_session_client_secret":{"type":"string","title":"Customer Session Client Secret"},"card_fee_rate":{"type":"number","title":"Card Fee Rate"},"min_credit_cents":{"type":"integer","title":"Min Credit Cents"},"max_credit_cents":{"type":"integer","title":"Max Credit Cents"},"billing_address":{"$ref":"#/components/schemas/BillingAddressModel","nullable":true}},"type":"object","required":["customer_session_client_secret","card_fee_rate","min_credit_cents","max_credit_cents","billing_address"],"title":"PrepaidSessionModel","description":"Return the Customer Session secret, fee and limits."},"BillingAddressModel":{"properties":{"name":{"type":"string","nullable":true},"country":{"type":"string","nullable":true},"line1":{"type":"string","nullable":true},"line2":{"type":"string","nullable":true},"city":{"type":"string","nullable":true},"state":{"type":"string","nullable":true},"postal_code":{"type":"string","nullable":true}},"type":"object","required":["name","country","line1","line2","city","state","postal_code"],"title":"BillingAddressModel","description":"Return the Stripe customer's billing address."},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"ValidationError":{"properties":{"loc":{"items":{"oneOf":[{"type":"string"},{"type":"integer"}]},"type":"array","title":"Location"},"msg":{"type":"string","title":"Message"},"type":{"type":"string","title":"Error Type"}},"type":"object","required":["loc","msg","type"],"title":"ValidationError"}}},"paths":{"/v2/organizations/{organization_id}/prepaid-payments/session":{"post":{"tags":["prepaid-payments"],"summary":"Create Prepaid Session","description":"Open a Customer Session for the Payment Element.","operationId":"create_prepaid_session_v2_organizations__organization_id__prepaid_payments_session_post","parameters":[{"name":"organization_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Organization Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PrepaidSessionModel"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}}}}
```

## List Prepaid Payments

> List pending payments and recent failures.

```json
{"openapi":"3.1.0","info":{"title":"Mithril","version":"1.0.0"},"servers":[{"url":"https://api.mithril.ai"}],"security":[{"MithrilAPIKey":[]}],"components":{"securitySchemes":{"MithrilAPIKey":{"type":"http","scheme":"bearer","bearerFormat":"fkey_<key>"}},"schemas":{"PrepaidPaymentModel":{"properties":{"payment_intent_id":{"type":"string","title":"Payment Intent Id"},"status":{"$ref":"#/components/schemas/PaymentStatus"},"payment_method":{"$ref":"#/components/schemas/PrepaidMethod"},"credit_cents":{"type":"integer","title":"Credit Cents"},"fee_cents":{"type":"integer","title":"Fee Cents"},"brand":{"type":"string","nullable":true},"bank_name":{"type":"string","nullable":true},"last4":{"type":"string","nullable":true},"expected_settlement_at":{"type":"string","format":"datetime","nullable":true},"settled_at":{"type":"string","format":"datetime","nullable":true},"created_at":{"type":"string","format":"datetime","title":"Created At"},"updated_at":{"type":"string","format":"datetime","title":"Updated At"}},"type":"object","required":["payment_intent_id","status","payment_method","credit_cents","fee_cents","brand","bank_name","last4","expected_settlement_at","settled_at","created_at","updated_at"],"title":"PrepaidPaymentModel","description":"Return one payment for the Credits page."},"PaymentStatus":{"type":"string","enum":["processing","settled","failed","returned"]},"PrepaidMethod":{"type":"string","enum":["ach","credit_card"]},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"ValidationError":{"properties":{"loc":{"items":{"oneOf":[{"type":"string"},{"type":"integer"}]},"type":"array","title":"Location"},"msg":{"type":"string","title":"Message"},"type":{"type":"string","title":"Error Type"}},"type":"object","required":["loc","msg","type"],"title":"ValidationError"}}},"paths":{"/v2/organizations/{organization_id}/prepaid-payments":{"get":{"tags":["prepaid-payments"],"summary":"List Prepaid Payments","description":"List pending payments and recent failures.","operationId":"list_prepaid_payments_v2_organizations__organization_id__prepaid_payments_get","parameters":[{"name":"organization_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Organization Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/PrepaidPaymentModel"},"title":"Response List Prepaid Payments V2 Organizations  Organization Id  Prepaid Payments Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}}}}
```

## Create Prepaid Payment

> Charge the confirmation token and record the payment.

```json
{"openapi":"3.1.0","info":{"title":"Mithril","version":"1.0.0"},"servers":[{"url":"https://api.mithril.ai"}],"security":[{"MithrilAPIKey":[]}],"components":{"securitySchemes":{"MithrilAPIKey":{"type":"http","scheme":"bearer","bearerFormat":"fkey_<key>"}},"schemas":{"CreatePrepaidPaymentBody":{"properties":{"credit_cents":{"type":"integer","minimum":1000,"title":"Credit Cents"},"confirmation_token":{"type":"string","minLength":1,"title":"Confirmation Token"},"idempotency_key":{"type":"string","format":"uuid","title":"Idempotency Key"},"billing_address":{"$ref":"#/components/schemas/JsonValue"}},"additionalProperties":false,"type":"object","required":["credit_cents","confirmation_token","idempotency_key"],"title":"CreatePrepaidPaymentBody","description":"Buy credit with a confirmation token."},"JsonValue":{},"CreatePrepaidPaymentModel":{"properties":{"payment_intent_id":{"type":"string","title":"Payment Intent Id"},"status":{"$ref":"#/components/schemas/PaymentStatus"},"payment_method":{"$ref":"#/components/schemas/PrepaidMethod"},"credit_cents":{"type":"integer","title":"Credit Cents"},"fee_cents":{"type":"integer","title":"Fee Cents"},"client_secret":{"type":"string","nullable":true},"brand":{"type":"string","nullable":true},"bank_name":{"type":"string","nullable":true},"last4":{"type":"string","nullable":true}},"type":"object","required":["payment_intent_id","status","payment_method","credit_cents","fee_cents"],"title":"CreatePrepaidPaymentModel","description":"Return the new payment and any browser action."},"PaymentStatus":{"type":"string","enum":["processing","settled","failed","returned"]},"PrepaidMethod":{"type":"string","enum":["ach","credit_card"]},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"ValidationError":{"properties":{"loc":{"items":{"oneOf":[{"type":"string"},{"type":"integer"}]},"type":"array","title":"Location"},"msg":{"type":"string","title":"Message"},"type":{"type":"string","title":"Error Type"}},"type":"object","required":["loc","msg","type"],"title":"ValidationError"}}},"paths":{"/v2/organizations/{organization_id}/prepaid-payments":{"post":{"tags":["prepaid-payments"],"summary":"Create Prepaid Payment","description":"Charge the confirmation token and record the payment.","operationId":"create_prepaid_payment_v2_organizations__organization_id__prepaid_payments_post","parameters":[{"name":"organization_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Organization Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreatePrepaidPaymentBody"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreatePrepaidPaymentModel"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}}}}
```

## Get Prepaid Payment

> Return one payment for polling.

```json
{"openapi":"3.1.0","info":{"title":"Mithril","version":"1.0.0"},"servers":[{"url":"https://api.mithril.ai"}],"security":[{"MithrilAPIKey":[]}],"components":{"securitySchemes":{"MithrilAPIKey":{"type":"http","scheme":"bearer","bearerFormat":"fkey_<key>"}},"schemas":{"PrepaidPaymentDetailModel":{"properties":{"payment_intent_id":{"type":"string","title":"Payment Intent Id"},"status":{"$ref":"#/components/schemas/PaymentStatus"},"payment_method":{"$ref":"#/components/schemas/PrepaidMethod"},"credit_cents":{"type":"integer","title":"Credit Cents"},"fee_cents":{"type":"integer","title":"Fee Cents"},"brand":{"type":"string","nullable":true},"bank_name":{"type":"string","nullable":true},"last4":{"type":"string","nullable":true},"expected_settlement_at":{"type":"string","format":"datetime","nullable":true},"settled_at":{"type":"string","format":"datetime","nullable":true},"created_at":{"type":"string","format":"datetime","title":"Created At"},"updated_at":{"type":"string","format":"datetime","title":"Updated At"},"receipt_url":{"type":"string","nullable":true},"failure_reason":{"type":"string","nullable":true}},"type":"object","required":["payment_intent_id","status","payment_method","credit_cents","fee_cents","brand","bank_name","last4","expected_settlement_at","settled_at","created_at","updated_at","receipt_url","failure_reason"],"title":"PrepaidPaymentDetailModel","description":"Return one payment with its receipt."},"PaymentStatus":{"type":"string","enum":["processing","settled","failed","returned"]},"PrepaidMethod":{"type":"string","enum":["ach","credit_card"]},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"ValidationError":{"properties":{"loc":{"items":{"oneOf":[{"type":"string"},{"type":"integer"}]},"type":"array","title":"Location"},"msg":{"type":"string","title":"Message"},"type":{"type":"string","title":"Error Type"}},"type":"object","required":["loc","msg","type"],"title":"ValidationError"}}},"paths":{"/v2/organizations/{organization_id}/prepaid-payments/{payment_intent_id}":{"get":{"tags":["prepaid-payments"],"summary":"Get Prepaid Payment","description":"Return one payment for polling.","operationId":"get_prepaid_payment_v2_organizations__organization_id__prepaid_payments__payment_intent_id__get","parameters":[{"name":"organization_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Organization Id"}},{"name":"payment_intent_id","in":"path","required":true,"schema":{"type":"string","title":"Payment Intent Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PrepaidPaymentDetailModel"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}}}}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.mithril.ai/compute-api/compute-api-reference/prepaid-payments.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
