Billing

The billing endpoints allow you to manage your billing information, including adding, deleting, and listing payment methods, as well as handling invoices and orders.


GET/billing/stripe/cards

List Cards

This endpoint allows you to list all cards.

Request

GET
/billing/stripe/cards
curl -G https://api.puregpu.com/billing/stripe/cards \
  -H "X-API-Key: {token}"

Response

{
    "result": "success",
    "payment_methods": [
        {
            "id": 15, // Card ID
            "type": "RemoteCreditCard",
            "description": "STRIPE CARD",
            "gateway_name": "stripe",
            "contact_type": "Client",
            "contact_id": 2,
            "card_last_four": "4242",
            "expiry_date": "01/30",
            "start_date": "",
            "issue_number": "",
            "card_type": "Visa",
            "remote_token": "{\"customer\":\"cus_Pil9K60xftjZ88\",\"method\":\"pm_1P6wzCFTTwwr4vA7vu6Rb5Iz\"}",
            "last_updated": "04/18/2024 13:49"
        },
    ]
}

POST/billing/stripe/cards

Add Card

This endpoint allows you to add a new card for payments.

Required attributes

  • Name
    stripe_payment_method_id
    Type
    string
    Description

    The ID of the Stripe payment method.

Request

POST
/billing/stripe/cards
curl -X POST https://api.puregpu.com/billing/stripe/cards \
  -H "X-API-Key: {token}" \
  -H "Content-Type: application/json" \
  -d '{
    "stripe_payment_method_id": "pm_1P6wzCFTTwwr4vA7vu6Rb5Iz"
  }'

Response

{
  "result": "success"
}

DELETE/billing/stripe/cards/:cardId

Delete Card

This endpoint allows you to delete a card.

Required attributes

  • Name
    cardId
    Type
    string
    Description

    The ID of the card to delete, fetched from the list cards endpoint.

Request

DELETE
/billing/stripe/cards/:cardId
curl -X DELETE https://api.puregpu.com/billing/stripe/cards/15 \
  -H "X-API-Key: {token}"

Response

{
  "result": "success"
}

PUT/billing/stripe/cards/:cardId/default

Set Default Card

This endpoint allows you to set a default card for payments.

Required attributes

  • Name
    paymethodid
    Type
    string
    Description

    The ID of the card to set as default, fetched from the list cards endpoint.

Request

PUT
/billing/stripe/cards/:cardId/default
curl -X PUT https://api.puregpu.com/billing/stripe/cards/15/default \
  -H "X-API-Key: {token}"

Response

{
  "result": "success"
}

GET/billing/crypto/currencies

List Currencies

This endpoint allows you to list all supported cryptocurrencies.

Request

GET
/billing/crypto/currencies
curl -G https://api.puregpu.com/billing/crypto/currencies \
  -H "X-API-Key: {token}"

Response

{
  "result": "success",
  "currencies": [...]
}

POST/billing/crypto/payments

Create Payment

This endpoint allows you to create a cryptocurrency payment.

Required attributes

  • Name
    invoice_id
    Type
    integer
    Description

    The ID of the invoice to pay.

Request

POST
/billing/crypto/payments
curl -X POST https://api.puregpu.com/billing/crypto/payments \
  -H "X-API-Key: {token}" \
  -H "Content-Type: application/json" \
  -d '{
    "invoice_id": 34,
    "currency": "BTC"
  }'

Response

{
  "result": "success",
  {
    "result": "success",
    "payment": {
        "id": "4465327355", // Payment ID
        "status": "waiting",
        "pay_address": "377WTjsTJ7ixVTJPqzFvYWh24HKyjKKXKj",
        "price_amount": 25,
        "price_currency": "usd",
        "pay_amount": 0.0006047,
        "pay_currency": "btc",
        "created_at": "2024-06-09T15:23:43.444Z",
        "updated_at": "2024-06-09T15:23:43.444Z",
        "payin_extra_id": null,
        "network": "btc",
        "time_limit": null,
        "expiration_estimate_date": "2024-06-09T15:43:43.443Z",
        "valid_until": "2024-06-16T15:23:43.443Z"
    }
  }
}

GET/billing/crypto/payments/:id

Get Payment

This endpoint allows you to get details of a cryptocurrency payment.

Required attributes

Request

GET
/billing/crypto/payments/:paymentId
curl -G https://api.puregpu.com/billing/crypto/payments/34 \
  -H "X-API-Key: {token}"

Response

{
  "result": "success",
  "payment": {
      "id": 4465327355,
      "status": "finished",
      "pay_address": "377WTjsTJ7ixVTJPqzFvYWh24HKyjKKXKj",
      "price_amount": 25,
      "price_currency": "usd",
      "pay_amount": 0.0006047,
      "pay_currency": "btc",
      "created_at": "2024-06-09T15:23:43.444Z",
      "updated_at": "2024-06-09T15:23:53.689Z",
      "payin_extra_id": null
  }
}

GET/billing/products

List Products

This endpoint allows you to list all available products.

Request

GET
/billing/products
curl -G https://api.puregpu.com/billing/products \
  -H "X-API-Key: {token}"

Response

{
  "result": "success",
  "products": [
      {
          "pid": 1,
          "type": "server",
          "name": "4090-1x-server",
          "meta": {
              "gpu_name": "RTX 4090",
              "gpu_vram": "24",
              "gpu_manufacturer": "NVIDIA",
              "gpu_count": "1",
              "cpu_name": "AMD EPYC 9334",
              "cpu_cores": "16",
              "cpu_clock": "3.9",
              "cpu_manufacturer": "AMD",
              "ram": "128",
              "ram_type": "DDR5",
              "disk_space": "1024",
              "disk_type": "NVME"
          },
          "pricing": {
              "hourly": 0.5,
              "monthly": 400
          }
      }
  ]
}

GET/billing/products/:productId

Get Product

This endpoint allows you to get details of a specific product.

Required attributes

Request

GET
/billing/products/:productId
curl -G https://api.puregpu.com/billing/products/1 \
  -H "X-API-Key: {token}"

Response

{
  "result": "success",
  "product": {
      "pid": 1,
      "type": "server",
      "name": "4090-1x-server",
      "meta": {
          "gpu_name": "RTX 4090",
          "gpu_vram": "24",
          "gpu_manufacturer": "NVIDIA",
          "gpu_count": "1",
          "cpu_name": "AMD EPYC 9334",
          "cpu_cores": "16",
          "cpu_clock": "3.9",
          "cpu_manufacturer": "AMD",
          "ram": "128",
          "ram_type": "DDR5",
          "disk_space": "1024",
          "disk_type": "NVME"
      },
      "pricing": {
          "hourly": 0.5,
          "monthly": 400
      }
  }
}

POST/billing/orders

Add Order

This endpoint allows you to create a new order for a product.

Required attributes

  • Name
    pid
    Type
    integer
    Description

    The ID of the product to order, fetched from the list products endpoint.

  • Name
    billingcycle
    Type
    string
    Description

    The billing cycle for the order (e.g., hourly).

  • Name
    hostname
    Type
    string
    Description

    The hostname for the order.

  • Name
    os
    Type
    string
    Description

    The operating system for the order.

  • Name
    sshkeys
    Type
    string
    Description

    SSH keys for the order.

Request

POST
/billing/orders
curl -X POST https://api.puregpu.com/billing/orders \
  -H "X-API-Key: {token}" \
  -H "Content-Type: application/json" \
  -d '{
    "pid": 1,
    "billingcycle": "hourly",
    "hostname": "test",
    "os": "",
    "sshkeys": ""
  }'

Response

{
  "result": "success"
}

POST/billing/invoices/funds

Add Funds Invoice

This endpoint allows you to add funds to your account.

Required attributes

  • Name
    amount
    Type
    integer|float
    Description

    The amount to add in USD.

Request

POST
/billing/invoices/funds
curl -X POST https://api.puregpu.com/billing/invoices/funds \
  -H "X-API-Key: {token}" \
  -H "Content-Type: application/json" \
  -d '{
    "amount": 10
  }'

Response

{
  "result": "success",
  "invoice_id": 42
}

GET/billing/balance

Get Balance

This endpoint allows you to get your current balance.

Request

GET
/billing/balance
curl -G https://api.puregpu.com/billing/balance \
  -H "X-API-Key: {token}"

Response

{
  "result": "success",
  "balance": 100.0
}

GET/billing/invoices

List Invoices

This endpoint allows you to list all invoices.

Request

GET
/billing/invoices
curl -G https://api.puregpu.com/billing/invoices \
  -H "X-API-Key: {token}"

Response

{
  "result": "success",
  "invoices": [
      {
          "id": 71,
          "date": "2024-06-09",
          "duedate": "2024-06-23",
          "datepaid": "0000-00-00 00:00:00",
          "subtotal": "10.00",
          "credit": "0.00",
          "total": "10.00",
          "status": "Unpaid"
      },
      {
          "id": 70,
          "date": "2024-06-09",
          "duedate": "2024-06-23",
          "datepaid": "2024-06-09 11:23:54",
          "subtotal": "25.00",
          "credit": "0.00",
          "total": "25.00",
          "status": "Paid"
      }
  ]
}

GET/billing/invoices/:invoiceId

Get Invoice

This endpoint allows you to get details of a specific invoice.

Required attributes

  • Name
    invoiceId
    Type
    integer
    Description

    The ID of the invoice to retrieve, fetched from the list invoices endpoint.

Request

GET
/billing/invoices/:invoiceId
curl -G https://api.puregpu.com/billing/invoices/41 \
  -H "X-API-Key: {token}"

Response

{
  "result": "success",
  "invoice": {
      "date": "2024-06-09",
      "duedate": "2024-06-23",
      "datepaid": "0000-00-00 00:00:00",
      "subtotal": "10.00",
      "credit": "0.00",
      "total": "10.00",
      "balance": "10.00",
      "status": "Unpaid",
      "items": [
          {
              "id": 77,
              "type": "AddFunds",
              "description": "Add Funds",
              "amount": "10.00"
          }
      ]
  }
}