Skip to main content
POST
/
v1
/
compute
/
ledger
/
credit-purchases
Create Credit Purchase
curl --request POST \
  --url https://api.dispersed.com/v1/compute/ledger/credit-purchases \
  --header 'Content-Type: application/json' \
  --data '
{
  "amount": 25,
  "cancel_url": "https://console.dispersed.com/billing?checkout=cancelled",
  "redirect_url": "https://console.dispersed.com/billing?checkout=success",
  "memo": "<string>"
}
'
{
  "created_at": "2023-11-07T05:31:56Z",
  "session_id": "<string>",
  "session_url": "<string>",
  "submitted_amount": 123,
  "checkout_session": {
    "id": "<string>",
    "object": "checkout.session",
    "currency": "<string>",
    "mode": "<string>",
    "payment_status": "<string>",
    "created": 123,
    "expires_at": 123,
    "client_reference_id": "<string>",
    "amount_subtotal": 123,
    "amount_total": 123,
    "status": "<string>",
    "metadata": {},
    "payment_intent": "<string>",
    "url": "<string>",
    "success_url": "<string>",
    "cancel_url": "<string>",
    "return_url": "<string>"
  }
}

Body

application/json
amount
number
required

Purchase amount in EUR.

Example:

25

cancel_url
string<uri>
required

URL to redirect to if the user cancels the Stripe Checkout. Must be an allowed Console domain.

Example:

"https://console.dispersed.com/billing?checkout=cancelled"

redirect_url
string<uri>
required

URL to redirect to after successful Stripe Checkout. Must be an allowed Console domain.

Example:

"https://console.dispersed.com/billing?checkout=success"

memo
string

Optional memo for the purchase

Response

Credit purchase checkout session created

created_at
string<date-time> | null
required

When the purchase was created

session_id
string
required

Stripe Checkout session ID. Deprecated: use checkout_session.id

session_url
string | null
required

Stripe Checkout URL. Deprecated: use checkout_session.url

submitted_amount
number | null
required

The submitted purchase amount in EUR

checkout_session
object

Full Stripe Checkout session metadata. Null when the upstream API has not yet been updated.