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

# Create Checkout Session API

> Creates a checkout session.



## OpenAPI

````yaml openapi-create-checkout-session.json POST /checkout/v1/session
openapi: 3.0.0
info:
  title: Create Checkout Session API
  version: 1.0.0
  description: API for creating checkout sessions using Appcharge.
servers:
  - url: https://api-sandbox.appcharge.com
security: []
paths:
  /checkout/v1/session:
    post:
      summary: Create Checkout Session
      description: Creates a checkout session.
      parameters:
        - in: header
          name: x-publisher-token
          required: true
          schema:
            type: string
          description: >-
            Your checkout token that will be presented at Appcharge's dashboard
            under Admin section -> Integration tab -> Publisher token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CheckoutSessionRequest'
      responses:
        '201':
          description: Checkout session created successfully.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CheckoutSessionResponse'
        '400':
          description: Invalid input
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    description: Detailed message describing the error.
                    example: >-
                      Blocked player: this player has been blocked. See the
                      blocked player list in the dashboard for more info.
components:
  schemas:
    CheckoutSessionRequest:
      type: object
      required:
        - priceDetails
        - offer
        - customer
      properties:
        priceDetails:
          type: object
          required:
            - price
            - currency
          properties:
            price:
              type: integer
              description: >-
                Price in the smallest currency unit. For example, if the price
                is $10.00, pass `1000`, not `10.00`. For currencies with no
                subunit, such as JPY, the value represents the full unit. See
                [Supported
                Currencies](/../../merchant-of-record/finance/supported-currencies)
                for per-currency decimal rules.
              default: 1000
            currency:
              type: string
              description: Currency in ISO 4217 format.
              default: USD
        displayOptions:
          type: object
          description: Information about display options in the checkout.
          properties:
            strikethroughPrice:
              type: integer
              description: >-
                Use this display-only comparison price to show a strikethrough
                next to the subtotal for tax-exclusive prices, or next to the
                total for tax-inclusive prices.


                Pass an integer in the lowest currency unit, using the same
                currency as `priceDetails.price`.


                To show a sale, pass the original price as `strikethroughPrice`
                and the discounted price as `priceDetails.price`. For example,
                for a $9.99 item on sale for $4.99, pass `999` as
                `strikethroughPrice` and `499` as `priceDetails.price`.


                Checkout shows this value only when it's greater than
                `priceDetails.price`. This value doesn't affect coupons.
              example: 1500
        offer:
          type: object
          required:
            - name
            - sku
          properties:
            name:
              type: string
              description: Offer name. Cannot be an empty string.
              example: Treasure Chest
            sku:
              type: string
              description: Offer ID (SKU).
              example: 68452829c5e8
            displayName:
              type: string
              description: Localized offer name.
            pricePointMetadata:
              type: integer
              description: Base price of the price point in USD cents.
        items:
          type: array
          description: List of items in the offer.
          items:
            type: object
            required:
              - name
              - sku
              - quantity
            properties:
              name:
                type: string
                description: Item name.
                example: coins
              assetUrl:
                type: string
                format: uri
                description: URL of the asset (should be on a CDN).
                example: https://media-dev.appcharge.com/coin.png
              sku:
                type: string
                description: Item SKU.
                example: coins_386f9b
              quantity:
                type: integer
                description: >-
                  Item quantity. Should be minimum 0 and equal to or less than
                  30 digits long.
                example: 3300000
              quantityDisplay:
                type: string
                description: >-
                  Overrides the `quantity` value displayed in the checkout.
                  Useful for presenting time-based products or showing
                  abbreviated values.
                example: 3.3M
              displayName:
                type: string
                description: Localized item name.
        countryCode2:
          type: string
          description: >-
            Two-letter country code in [ISO-3166
            alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) format.
            Required if `playerIp` is not provided. Example: `US`.
          example: US
        playerIp:
          type: string
          description: >-
            Player IP address in [IPv4](https://en.wikipedia.org/wiki/IPv4)
            format.  Required if `countryCode2` is not provided. Example:
            `192.0.2.1`.
        customer:
          type: object
          required:
            - id
          properties:
            id:
              type: string
              description: Unique customer identifier.
              example: 7c99fba665c4a
            email:
              type: string
              format: email
              description: Customer email address.
              example: customer@appcharge.com
            identitySignals:
              type: object
              description: >-
                Information regarding the player's identity. Pass this field to
                improve risk decisions and reduce false declines.
              properties:
                firstSeenAt:
                  type: string
                  format: date-time
                  description: >-
                    Timestamp when the player was first observed on your
                    monetization platform in [UTC ISO
                    8601](https://en.wikipedia.org/wiki/ISO_8601) format. For
                    example, the player's account creation date in your game.
                    Used to differentiate veteran players from new accounts
                    during risk evaluation. Must be a past date.
                  example: '2021-01-01T00:00:00Z'
        receiptMetadata:
          type: object
          description: |-
            Metadata for the receipt. 

             **Note:** If you want the receipt to be sent in a specific language, first configure your translations in the Publisher Dashboard or via the [Translations API service](/../../api-reference/translations/introduction), and then include the desired locale here.
          properties:
            locale:
              type: string
              description: >-
                The locale code. Both ISO-639 language code and ISO-3166 country
                code formats are supported. 

                 **Note:** This value must match the language code configured in the Publisher Dashboard, or the `locale` used in the [Set Translations API](/../../api-reference/translations/set-translations).
              default: en
              example: fr-CA
        sessionMetadata:
          type: object
          format: json
          description: >-
            This entity serves as a versatile container for storing any
            pertinent information related to the player's session. You can add
            any additional data you wish to pass as a payload.
        attributes:
          type: object
          description: >-
            A set of custom key-value pairs that you can define to tag players
            for segmentation and A/B testing. These attributes can then be used
            to filter players in the Publisher Dashboard.


            Example:

            {
              "BF_test": "test",
              "monetization_persona": "non_payer"
            }
        redirectUrl:
          type: string
          format: uri
          description: >-
            A deeplink URL for redirecting the player to your domain, bringing
            them back to the game. For more information, see [Link Out Without
            SDK](/../../guides/payment-links/link-out-without-sdk). 

             **Note:** This property is not relevant if you're using the Payment Links SDK.
    CheckoutSessionResponse:
      type: object
      properties:
        checkoutSessionToken:
          type: string
          description: >-
            Checkout session token. Use this token when calling the [Cancel
            Checkout Session API](./cancel-checkout-session) to cancel the
            session.
          example: 61ed143b22d24815a713e215e99b0ea6
        purchaseId:
          type: string
          description: Purchase ID.
          example: purchase_abc123def456
        url:
          type: string
          description: Checkout session URL hosted on Appcharge.
          example: https://checkout-v2.appcharge.com
          deprecated: true
        parsedUrl:
          type: string
          description: New checkout session URL hosted on Appcharge.
          example: >-
            https://pay.appcharge.com/61a164d563c54014b1959a5c78704964#boot={PUBLISHER_BOOT_DATA}
    ErrorResponse:
      type: object
      properties:
        errorCode:
          type: integer
          format: int32
          description: Error code indicating the type of failure.
          default: 0
        errorMessage:
          type: string
          description: Detailed message describing the error.

````