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

# Create Checkout

> This endpoint creates a checkout for the authenticated user based on the provided data. It supports
different payment platforms, promotional codes, and can handle both one-time and recurring payments.
You can either specify a `product_code` directly or supply the traditional combination of
`product_type`, `country_id`, and `product_protocol`.

**Important considerations**
- If `product_code` is provided alongside `product_type`/`country_id`/`product_protocol`, their values must match the actual product attributes.
- If the invoice amount remaining is `0`, it means your available credit fully covered the cost and the service is considered immediately paid.
- If the invoice needs payment, you will be returned an `invoice_url` to complete checkout.




## OpenAPI

````yaml post /public/user/checkout/create
openapi: 3.0.1
info:
  title: Byteful Public User API
  description: Public API used for third-party usage.
  termsOfService: https://byteful.com
  contact:
    url: https://byteful.com
    email: developer@byteful.com
  version: '1.0'
  x-logo:
    altText: Byteful
    backgroundColor: '#6354eb'
    url: >-
      https://pbs.twimg.com/profile_banners/1038803520605118464/1729783007/1500x500
servers:
  - url: https://api.byteful.com/1.0/
security: []
paths:
  /public/user/checkout/create:
    post:
      tags:
        - Checkout
      summary: Create Checkout
      description: >
        This endpoint creates a checkout for the authenticated user based on the
        provided data. It supports

        different payment platforms, promotional codes, and can handle both
        one-time and recurring payments.

        You can either specify a `product_code` directly or supply the
        traditional combination of

        `product_type`, `country_id`, and `product_protocol`.


        **Important considerations**

        - If `product_code` is provided alongside
        `product_type`/`country_id`/`product_protocol`, their values must match
        the actual product attributes.

        - If the invoice amount remaining is `0`, it means your available credit
        fully covered the cost and the service is considered immediately paid.

        - If the invoice needs payment, you will be returned an `invoice_url` to
        complete checkout.
      parameters:
        - name: Content-Type
          in: header
          description: Content type for the request body as application/json.
          required: true
          schema:
            type: string
            default: application/json
      requestBody:
        description: The data needed to create the checkout.
        content:
          application/json:
            schema:
              required:
                - quantity
              type: object
              properties:
                country_id:
                  type: string
                  description: >-
                    An ISO country code used for region-specific datacenter or
                    ISP products.
                cycle_interval:
                  type: string
                  description: The billing interval for recurring purchases.
                  default: month
                  enum:
                    - year
                    - month
                    - week
                    - day
                cycle_interval_count:
                  type: integer
                  description: >-
                    The number of intervals for a recurring cycle (e.g. 1 month,
                    2 months, etc.).
                product_code:
                  type: string
                  description: >-
                    A direct product code (e.g. "datacenter_us"). If this is
                    provided, you do not need `product_type`, `country_id`, or
                    `product_protocol`.
                product_protocol:
                  type: string
                  description: The protocol of the product.
                  default: ipv4
                  enum:
                    - ipv4
                    - ipv6
                    - dual
                product_type:
                  type: string
                  description: >-
                    The type of product to purchase (if `product_code` is not
                    used).
                  enum:
                    - datacenter
                    - isp
                    - residential
                    - mobile
                promotional_code:
                  type: string
                  description: A promotional code to apply a discount to the checkout.
                quantity:
                  type: integer
                  description: The quantity of the product to purchase.
                service_fulfillment_filter:
                  type: object
                  properties: {}
                  description: >-
                    An optional filter object for advanced product/service
                    configurations.
              example:
                cycle_interval: month
                cycle_interval_count: 1
                product_code: isp_us
                promotional_code: HALFOFF
                quantity: 5
        required: true
      responses:
        '201':
          description: >-
            Successfully created a checkout. Depending on the remaining invoice
            amount, it may already be paid by credit, or you may need to
            complete payment at the returned invoice URL.
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: object
                    properties:
                      created:
                        type: array
                        description: >-
                          A list of service IDs created during checkout (usually
                          contains only one).
                        example:
                          - API-1234-5678
                        items:
                          type: string
                      invoice_is_paid:
                        type: boolean
                        description: Indicates whether the invoice is already paid.
                        example: true
                      invoice_url:
                        type: string
                        description: >-
                          URL where the user should be redirected to complete
                          payment (null if paid in full).
                        example: >-
                          https://invoice.stripe.com/i/acct_1H7dAB2BUlqim5l/test_123
                      mobile_ledger_created:
                        type: array
                        description: >-
                          A list of mobile ledger entries created (may be
                          empty).
                        example: []
                        items:
                          type: string
                      proxies:
                        type: array
                        description: >-
                          A list of proxy objects tied to the newly created
                          service.
                        items:
                          type: object
                          properties:
                            asn_id:
                              type: integer
                              example: 7018
                            asn_name:
                              type: string
                              example: AT&T Enterprises, LLC
                            city_example_postcode:
                              type: string
                              example: '75202'
                            city_id:
                              type: integer
                              example: 75202
                            city_latitude:
                              type: number
                              format: float
                              example: 32.7767
                            city_longitude:
                              type: number
                              format: float
                              example: -96.797
                            city_name:
                              type: string
                              example: Dallas
                            city_timezone:
                              type: string
                              example: America/Chicago
                            country_id:
                              type: string
                              example: us
                            country_name:
                              type: string
                              example: United States
                            customer_id:
                              type: integer
                              example: 1976
                            default_proxy_user_password:
                              type: string
                              example: apple1984
                            default_proxy_user_username:
                              type: string
                              example: stevejobs
                            ip_address_id_v4:
                              type: string
                              example: 107.225.73.142
                            ip_address_id_v6:
                              type: string
                              description: IPv6 address if dual protocol is used
                              example: 2600:1000:b12a:6351:8523:997e:93c4:f124
                            proxy_http_port:
                              type: integer
                              example: 8080
                            proxy_id:
                              type: string
                              example: 7a018d34-76c2-4c23-b14d-f7b9a7054e25
                            proxy_ip_address:
                              type: string
                              example: 107.225.73.142
                            proxy_ip_address_v6:
                              type: string
                              description: IPv6 address if dual protocol is used
                              example: 2600:1000:b12a:6351:8523:997e:93c4:f124
                            proxy_last_update_datetime:
                              type: string
                              format: date-time
                            proxy_protocol:
                              type: string
                              example: ipv4
                            proxy_socks5_port:
                              type: integer
                              example: 1080
                            proxy_status:
                              type: string
                              example: in_use
                            proxy_type:
                              type: string
                              example: isp
                            service_id:
                              type: string
                              example: API-1234-5678
                            subdivision_id:
                              type: string
                              example: us-tx
                            subdivision_name:
                              type: string
                              example: Texas
                            subnet_id:
                              type: string
                              example: 107.225.72.0/22
                            subnet_id_v6:
                              type: string
                              description: IPv6 subnet if dual protocol is used
                              example: 2600:1000::/28
                      proxy_edited:
                        type: array
                        description: >-
                          A list of proxies edited or updated in the process
                          (may be empty).
                        example:
                          - 7a018d34-76c2-4c23-b14d-f7b9a7054e25
                        items:
                          type: string
                      residential_ledger_created:
                        type: array
                        description: >-
                          A list of residential ledger entries created (may be
                          empty).
                        example: []
                        items:
                          type: string
                      service:
                        type: object
                        properties:
                          country_id:
                            type: string
                            example: us
                          customer_id:
                            type: integer
                            example: 1976
                          open_invoice_id:
                            type: string
                            example: 'null'
                          payment_method_id:
                            type: string
                            example: 'null'
                          product_id:
                            type: string
                            example: prod_ATT7018
                          service_creation_datetime:
                            type: string
                            format: date-time
                          service_cycle:
                            type: string
                            example: 1:month
                          service_dispatch_datetime:
                            type: string
                            format: date-time
                          service_earliest_cancellation_datetime:
                            type: string
                            format: date-time
                          service_expiry_datetime:
                            type: string
                            format: date-time
                          service_fulfillment_filter:
                            type: object
                            properties: {}
                            example:
                              asn_id: 7018
                          service_id:
                            type: string
                            example: API-1234-5678
                          service_image:
                            type: string
                            example: >-
                              https://files.stripe.com/links/MDB8YWNjdF8xSDdkOEFCMkJVbHFpbTVsfGZsX2xpdmVfZFZ6TTZjUG01Q0NuR1IzSTZsVzNjVVFX00kUPPfQE9
                          service_is_automatic_collection:
                            type: boolean
                            example: true
                          service_is_cancellable:
                            type: boolean
                            example: true
                          service_is_off_catalog:
                            type: boolean
                            example: false
                          service_is_pending_cancellation:
                            type: boolean
                            example: false
                          service_is_reconfigurable:
                            type: boolean
                            example: true
                          service_last_update_datetime:
                            type: string
                            format: date-time
                          service_metadata:
                            type: object
                            properties: {}
                            example: {}
                          service_name:
                            type: string
                            example: AT&T ISP Proxies [US]
                          service_price_id:
                            type: string
                            example: price_1QJx2DB2BUlqim5lxmO3aT2v
                          service_promotional_code:
                            type: string
                            example: HALFOFF
                          service_protocol:
                            type: string
                            example: ipv4
                          service_quantity:
                            type: integer
                            example: 5
                          service_status:
                            type: string
                            example: active
                          service_subscription_id:
                            type: string
                            example: sub_1QxSHmB2BUlqim5lTUH8HvKa
                          service_subscription_is_paused:
                            type: boolean
                            example: false
                          service_total:
                            type: integer
                            example: 450
                          service_type:
                            type: string
                            example: isp
                          subscription_schedule_id:
                            type: string
                            example: 'null'
                        description: >-
                          Detailed information about the provisioned service
                          (null if not yet provisioned).
                      service_id:
                        type: string
                        description: The ID of the newly created service.
                        example: API-1234-5678
                  message:
                    type: string
                    description: Success message.
                    example: >-
                      Successfully created checkout and paid with credit. Your
                      service will be provisioned shortly.
      security:
        - APIPrivateKey: []
          APIPublicKey: []
components:
  securitySchemes:
    APIPrivateKey:
      type: apiKey
      description: ' Private API key for user-level authentication.'
      name: X-API-Private-Key
      in: header
    APIPublicKey:
      type: apiKey
      description: ' Public API key for user-level authentication.'
      name: X-API-Public-Key
      in: header

````