CreateSubscription

POST/billing/v1/subscription

Request Body

required
application/json
{
  "$ref": "#/components/schemas/billing.v1.CreateSubscriptionRequest",
  "$ref-value": {
    "type": "object",
    "properties": {
      "org_id": {
        "type": "string",
        "examples": [
          "OR98234j23"
        ],
        "title": "org_id"
      },
      "stripe_price_id": {
        "type": "string",
        "title": "stripe_price_id",
        "minLength": 1
      },
      "payment_method_id": {
        "type": "string",
        "examples": [
          "XyZ9aB8cD1"
        ],
        "title": "payment_method_id"
      },
      "billing_address": {
        "allOf": [
          {
            "$ref": "#/components/schemas/billing.v1.BillingAddress",
            "$ref-value": {
              "type": "object",
              "properties": {
                "name": {
                  "type": "string",
                  "examples": [
                    "Jane Doe"
                  ],
                  "title": "name",
                  "minLength": 1
                },
                "line1": {
                  "type": "string",
                  "examples": [
                    "123 Main St"
                  ],
                  "title": "line1",
                  "minLength": 1
                },
                "line2": {
                  "type": "string",
                  "examples": [
                    "Apt 4B"
                  ],
                  "title": "line2"
                },
                "city": {
                  "type": "string",
                  "examples": [
                    "San Francisco"
                  ],
                  "title": "city",
                  "minLength": 1
                },
                "state": {
                  "type": "string",
                  "examples": [
                    "CA"
                  ],
                  "title": "state",
                  "minLength": 1
                },
                "postal_code": {
                  "type": "string",
                  "examples": [
                    "94105"
                  ],
                  "title": "postal_code",
                  "minLength": 1
                },
                "country": {
                  "type": "string",
                  "examples": [
                    "US"
                  ],
                  "title": "country",
                  "minLength": 1
                },
                "phone": {
                  "type": "string",
                  "examples": [
                    "+15551234567"
                  ],
                  "title": "phone"
                },
                "email": {
                  "type": "string",
                  "examples": [
                    "billing@example.com"
                  ],
                  "title": "email",
                  "format": "email"
                }
              },
              "title": "BillingAddress",
              "required": [
                "name",
                "line1",
                "city",
                "state",
                "postal_code",
                "country"
              ],
              "additionalProperties": false
            }
          }
        ],
        "title": "billing_address"
      }
    },
    "title": "CreateSubscriptionRequest",
    "required": [
      "stripe_price_id"
    ],
    "additionalProperties": false
  }
}

Response Body

200application/json

Success

type: unknown

{
  "$ref": "#/components/schemas/billing.v1.CreateSubscriptionResponse",
  "$ref-value": {
    "type": "object",
    "properties": {
      "id": {
        "type": "string",
        "examples": [
          "AbCdE12345"
        ],
        "title": "id"
      },
      "org_id": {
        "type": "string",
        "examples": [
          "OR98234j23"
        ],
        "title": "org_id"
      },
      "plan_id": {
        "type": "string",
        "examples": [
          "Mn0bVc9xZ8"
        ],
        "title": "plan_id"
      },
      "status": {
        "allOf": [
          {
            "$ref": "#/components/schemas/billing.v1.SubscriptionStatus",
            "$ref-value": {
              "type": "string",
              "title": "SubscriptionStatus",
              "enum": [
                "SUBSCRIPTION_STATUS_UNSPECIFIED",
                "SUBSCRIPTION_STATUS_ACTIVE",
                "SUBSCRIPTION_STATUS_INACTIVE",
                "SUBSCRIPTION_STATUS_CANCELED",
                "SUBSCRIPTION_STATUS_EXPIRED",
                "SUBSCRIPTION_STATUS_PENDING",
                "SUBSCRIPTION_STATUS_SUSPENDED",
                "SUBSCRIPTION_STATUS_TRIALING",
                "SUBSCRIPTION_STATUS_PAST_DUE",
                "SUBSCRIPTION_STATUS_UNPAID",
                "SUBSCRIPTION_STATUS_INCOMPLETE",
                "SUBSCRIPTION_STATUS_INCOMPLETE_EXPIRED",
                "SUBSCRIPTION_STATUS_PAUSED"
              ]
            }
          }
        ],
        "examples": [
          "SUBSCRIPTION_STATUS_ACTIVE"
        ],
        "title": "status"
      },
      "current_period_end": {
        "allOf": [
          {
            "$ref": "#/components/schemas/google.protobuf.Timestamp",
            "$ref-value": {
              "type": "string",
              "examples": [
                "2023-01-15T01:30:15.01Z",
                "2024-12-25T12:00:00Z"
              ],
              "format": "date-time",
              "description": "A point in time in RFC 3339 format, with up to nanosecond precision. Output uses UTC (`Z`); input may use an offset from UTC."
            }
          }
        ],
        "examples": [
          "2026-01-15T10:30:00Z"
        ],
        "title": "current_period_end"
      },
      "cancel_at_period_end": {
        "type": "boolean",
        "title": "cancel_at_period_end"
      },
      "stripe_subscription_id": {
        "type": "string",
        "title": "stripe_subscription_id"
      },
      "stripe_customer_id": {
        "type": "string",
        "title": "stripe_customer_id"
      }
    },
    "title": "CreateSubscriptionResponse",
    "additionalProperties": false
  }
}
curl -X POST "https://api.rixl.com/billing/v1/subscription" \
  -H "Content-Type: application/json" \
  -d '{
    "stripe_price_id": "string"
  }'

Success

application/json

{
  "$ref": "#/components/schemas/billing.v1.CreateSubscriptionResponse",
  "$ref-value": {
    "type": "object",
    "properties": {
      "id": {
        "type": "string",
        "examples": [
          "AbCdE12345"
        ],
        "title": "id"
      },
      "org_id": {
        "type": "string",
        "examples": [
          "OR98234j23"
        ],
        "title": "org_id"
      },
      "plan_id": {
        "type": "string",
        "examples": [
          "Mn0bVc9xZ8"
        ],
        "title": "plan_id"
      },
      "status": {
        "allOf": [
          {
            "$ref": "#/components/schemas/billing.v1.SubscriptionStatus",
            "$ref-value": {
              "type": "string",
              "title": "SubscriptionStatus",
              "enum": [
                "SUBSCRIPTION_STATUS_UNSPECIFIED",
                "SUBSCRIPTION_STATUS_ACTIVE",
                "SUBSCRIPTION_STATUS_INACTIVE",
                "SUBSCRIPTION_STATUS_CANCELED",
                "SUBSCRIPTION_STATUS_EXPIRED",
                "SUBSCRIPTION_STATUS_PENDING",
                "SUBSCRIPTION_STATUS_SUSPENDED",
                "SUBSCRIPTION_STATUS_TRIALING",
                "SUBSCRIPTION_STATUS_PAST_DUE",
                "SUBSCRIPTION_STATUS_UNPAID",
                "SUBSCRIPTION_STATUS_INCOMPLETE",
                "SUBSCRIPTION_STATUS_INCOMPLETE_EXPIRED",
                "SUBSCRIPTION_STATUS_PAUSED"
              ]
            }
          }
        ],
        "examples": [
          "SUBSCRIPTION_STATUS_ACTIVE"
        ],
        "title": "status"
      },
      "current_period_end": {
        "allOf": [
          {
            "$ref": "#/components/schemas/google.protobuf.Timestamp",
            "$ref-value": {
              "type": "string",
              "examples": [
                "2023-01-15T01:30:15.01Z",
                "2024-12-25T12:00:00Z"
              ],
              "format": "date-time",
              "description": "A point in time in RFC 3339 format, with up to nanosecond precision. Output uses UTC (`Z`); input may use an offset from UTC."
            }
          }
        ],
        "examples": [
          "2026-01-15T10:30:00Z"
        ],
        "title": "current_period_end"
      },
      "cancel_at_period_end": {
        "type": "boolean",
        "title": "cancel_at_period_end"
      },
      "stripe_subscription_id": {
        "type": "string",
        "title": "stripe_subscription_id"
      },
      "stripe_customer_id": {
        "type": "string",
        "title": "stripe_customer_id"
      }
    },
    "title": "CreateSubscriptionResponse",
    "additionalProperties": false
  }
}