POST /v1/checkout/prepare-payment
application/json

Body

  • basketId string Required

    ID of the basket to retrieve

  • enrolments array[object] Required

    Enrolments to prepare

    Hide enrolments attributes Show enrolments attributes object
    • basketItem object Required
      Hide basketItem attributes Show basketItem attributes object
      • studentId string Required
      • courseId string Required
    • acceptedQuote object Required
      Hide acceptedQuote attributes Show acceptedQuote attributes object
      • name string Required
      • paymentPlanId string
      • paymentMethods array[object] Required
        Hide paymentMethods attributes Show paymentMethods attributes object
        • amount integer Required
        • method string Required
  • dropIns array[object] Required

    Drop-ins to prepare

    Hide dropIns attributes Show dropIns attributes object
    • basketItem object Required
      Hide basketItem attributes Show basketItem attributes object
      • studentId string Required
      • courseId string Required
      • date string(date) Required
      • time string Required
      • type string Required

        Values are trial or payg.

    • acceptedQuote object Required
      Hide acceptedQuote attributes Show acceptedQuote attributes object
      • name string Required
      • paymentMethods array[object] Required
        Hide paymentMethods attributes Show paymentMethods attributes object
        • amount integer Required
        • method string Required
  • products array[object] Required

    Products to prepare

    Hide products attributes Show products attributes object
    • basketItem object Required
      Hide basketItem attributes Show basketItem attributes object
      • variantId string Required
      • quantity integer Required
    • acceptedQuote object Required
      Hide acceptedQuote attributes Show acceptedQuote attributes object
      • name string Required
      • paymentMethods array[object] Required
        Hide paymentMethods attributes Show paymentMethods attributes object
        • amount integer Required
        • method string Required
  • additionals array[object] Required

    Additionals to prepare for payment

    Hide additionals attributes Show additionals attributes object
    • basketItem object Required
      Hide basketItem attributes Show basketItem attributes object
      • studentId string Required
      • entityId string Required
      • type string Required
    • acceptedQuote object Required
      Hide acceptedQuote attributes Show acceptedQuote attributes object
      • name string Required
      • paymentMethods array[object] Required
        Hide paymentMethods attributes Show paymentMethods attributes object
        • amount integer Required
        • method string Required

Responses

  • 200 application/json

    The checkout

    Hide response attribute Show response attribute object
    • paymentMethods array[object] Required
      Hide paymentMethods attributes Show paymentMethods attributes object
      • paymentMethod string

        For launch, we'll only be supporting "stripe" as a payment method. It makes sense to use the term Stripe here because we'll be displaying Stripe Elements on the frontend for it, and it gives us options in the future to expand to other payment methods (gocardless, for example))

        Values are account-credit, classpass, discount-code, stripe, or manual.

      • amount integer Required
      • cardProcessingFee integer
      • paymentIntentClientSecret string

        Only included when paymentMethod is stripe

      • customerSessionClientSecret string

        Only included when paymentMethod is stripe

      • customerId string

        Only included when paymentMethod is stripe

      • ephemeralKey string

        Only included when paymentMethod is stripe

      • paymentIntentId string

        Only included when paymentMethod is stripe

POST /v1/checkout/prepare-payment
curl \
 --request POST 'https://classmanager.test/v1/checkout/prepare-payment' \
 --header "Content-Type: application/json" \
 --data '{"basketId":"bskt_xxx","enrolments":[{"basketItem":{"studentId":"stu_xxx","courseId":"cls_xxx"},"acceptedQuote":{"name":"enrolment-monthly","paymentPlanId":"pp_01k5vjs0zw09xq8f0yb2nzef7x","paymentMethods":[{"amount":1000,"method":"stripe"}]}}],"dropIns":[{"basketItem":{"studentId":"stu_xxx","courseId":"cls_xxx","date":"2025-01-01","time":"09:30","type":"trial"},"acceptedQuote":{"name":"enrolment-monthly","paymentMethods":[{"amount":1000,"method":"stripe"}]}}],"products":[{"basketItem":{"variantId":"var_xxx","quantity":1},"acceptedQuote":{"name":"product-upfront","paymentMethods":[{"amount":1000,"method":"stripe"}]}}],"additionals":[{"basketItem":{"studentId":"stu_xxxxxx","entityId":"reg_xxxxxx","type":"registration"},"acceptedQuote":{"name":"registration-fee-upfront","paymentMethods":[{"amount":1000,"method":"stripe"}]}}]}'
Request examples
{
  "basketId": "bskt_xxx",
  "enrolments": [
    {
      "basketItem": {
        "studentId": "stu_xxx",
        "courseId": "cls_xxx"
      },
      "acceptedQuote": {
        "name": "enrolment-monthly",
        "paymentPlanId": "pp_01k5vjs0zw09xq8f0yb2nzef7x",
        "paymentMethods": [
          {
            "amount": 1000,
            "method": "stripe"
          }
        ]
      }
    }
  ],
  "dropIns": [
    {
      "basketItem": {
        "studentId": "stu_xxx",
        "courseId": "cls_xxx",
        "date": "2025-01-01",
        "time": "09:30",
        "type": "trial"
      },
      "acceptedQuote": {
        "name": "enrolment-monthly",
        "paymentMethods": [
          {
            "amount": 1000,
            "method": "stripe"
          }
        ]
      }
    }
  ],
  "products": [
    {
      "basketItem": {
        "variantId": "var_xxx",
        "quantity": 1
      },
      "acceptedQuote": {
        "name": "product-upfront",
        "paymentMethods": [
          {
            "amount": 1000,
            "method": "stripe"
          }
        ]
      }
    }
  ],
  "additionals": [
    {
      "basketItem": {
        "studentId": "stu_xxxxxx",
        "entityId": "reg_xxxxxx",
        "type": "registration"
      },
      "acceptedQuote": {
        "name": "registration-fee-upfront",
        "paymentMethods": [
          {
            "amount": 1000,
            "method": "stripe"
          }
        ]
      }
    }
  ]
}
Response examples (200)
{
  "paymentMethods": [
    {
      "paymentMethod": "account-credit",
      "amount": 2000,
      "cardProcessingFee": 33,
      "paymentIntentClientSecret": "string",
      "customerSessionClientSecret": "string",
      "customerId": "string",
      "ephemeralKey": "string",
      "paymentIntentId": "string"
    }
  ]
}