# Purchase plan

## OpenAPI Specification

```yaml
openapi: 3.0.1
info:
  title: ''
  description: ''
  version: 1.0.0
paths:
  /v2/placement-tests/purchase-plan:
    post:
      summary: Purchase plan
      deprecated: false
      description: >-
        Purchase a placement test subscription plan (Monthly or LTD). Payment is
        automatically deducted from your wallet balance.


        Monthly plans provide recurring credits each billing cycle. LTD
        (Lifetime Deal) plans are one-time purchases with monthly credit resets.


        ## Plans


        | Plan | Price | Concurrent Slots | Max Mailboxes | Tests/Month |
        Credits/Month | Type |

        |------|-------|------------------|---------------|-------------|---------------|------|

        | Starter | $29/month | 1 | 30 | 1 | 30 | Monthly |

        | Growth | $99/month | 2 | 100 | 2 | 200 | Monthly |

        | Pro | $199/month | 2 | Unlimited | 2 | 500 | Monthly |

        | Starter LTD | $99 | 1 | 30 | 1 | 30 | LTD (One-time) |

        | Growth LTD | $299 | 2 | 100 | 2 | 200 | LTD (One-time) |

        | Pro LTD | $999 | 2 | 2000 | 2 | 500 | LTD (One-time) |
      tags:
        - placement test
      parameters:
        - name: x-auth-zapmail
          in: header
          description: ''
          required: true
          example: ''
          schema:
            type: string
        - name: x-workspace-key
          in: header
          description: ''
          required: false
          example: ''
          schema:
            type: string
        - name: x-service-provider
          in: header
          description: ''
          required: true
          example: ''
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                planName:
                  type: string
              required:
                - planName
              x-apidog-orders:
                - planName
            example:
              planName: starter
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: integer
                  message:
                    type: string
                  data:
                    type: object
                    properties:
                      subscription:
                        type: object
                        properties:
                          id:
                            type: string
                          subscriptionId:
                            type: string
                          planType:
                            type: string
                          billingCycle:
                            type: string
                          lookupKey:
                            type: string
                          status:
                            type: string
                          monthlyCredits:
                            type: integer
                          availableCredits:
                            type: integer
                          periodStart:
                            type: string
                          periodEnd:
                            type: string
                          price:
                            type: integer
                          currency:
                            type: string
                        required:
                          - id
                          - subscriptionId
                          - planType
                          - billingCycle
                          - lookupKey
                          - status
                          - monthlyCredits
                          - availableCredits
                          - periodStart
                          - periodEnd
                          - price
                          - currency
                        x-apidog-orders:
                          - id
                          - subscriptionId
                          - planType
                          - billingCycle
                          - lookupKey
                          - status
                          - monthlyCredits
                          - availableCredits
                          - periodStart
                          - periodEnd
                          - price
                          - currency
                      invoice:
                        type: object
                        properties:
                          invoiceId:
                            type: string
                          invoiceUrl:
                            type: string
                          amount:
                            type: integer
                          status:
                            type: string
                        required:
                          - invoiceId
                          - invoiceUrl
                          - amount
                          - status
                        x-apidog-orders:
                          - invoiceId
                          - invoiceUrl
                          - amount
                          - status
                      walletBalance:
                        type: object
                        properties:
                          previousBalance:
                            type: integer
                          amountDeducted:
                            type: integer
                          currentBalance:
                            type: integer
                        required:
                          - previousBalance
                          - amountDeducted
                          - currentBalance
                        x-apidog-orders:
                          - previousBalance
                          - amountDeducted
                          - currentBalance
                    required:
                      - subscription
                      - invoice
                      - walletBalance
                    x-apidog-orders:
                      - subscription
                      - invoice
                      - walletBalance
                required:
                  - status
                  - message
                  - data
                x-apidog-orders:
                  - status
                  - message
                  - data
              example:
                status: 200
                message: Placement test plan purchased successfully
                data:
                  subscription:
                    id: sub_abc123
                    subscriptionId: sub_1AbcDefGhiJklMnop
                    planType: STARTER
                    billingCycle: LTD
                    lookupKey: placement_test_starter_ltd
                    status: ACTIVE
                    monthlyCredits: 30
                    availableCredits: 30
                    periodStart: '2024-12-15T10:30:00.000Z'
                    periodEnd: '2025-12-15T10:30:00.000Z'
                    price: 99
                    currency: USD
                  invoice:
                    invoiceId: in_1AbcDefGhiJklMnop
                    invoiceUrl: <https://invoice.stripe.com/i/acct_xxx/test_xxx>
                    amount: 99
                    status: paid
                  walletBalance:
                    previousBalance: 500
                    amountDeducted: 99
                    currentBalance: 401
          headers: {}
          x-apidog-name: Success
        '400':
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: integer
                  message:
                    type: string
                  errorId:
                    type: string
                required:
                  - status
                  - message
                  - errorId
                x-apidog-orders:
                  - status
                  - message
                  - errorId
              example:
                status: 400
                message: planName is required
                errorId: uuid-v4-error-id
          headers: {}
          x-apidog-name: Bad Request
        '401':
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: integer
                  message:
                    type: string
                  errorId:
                    type: string
                required:
                  - status
                  - message
                  - errorId
                x-apidog-orders:
                  - status
                  - message
                  - errorId
              example:
                status: 401
                message: API key is required
                errorId: uuid-v4-error-id
          headers: {}
          x-apidog-name: Unauthorized
        '500':
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: integer
                  message:
                    type: string
                  errorId:
                    type: string
                required:
                  - status
                  - message
                  - errorId
                x-apidog-orders:
                  - status
                  - message
                  - errorId
              example:
                status: 500
                message: Failed to retrieve invoice from subscription
                errorId: uuid-v4-error-id
          headers: {}
          x-apidog-name: Internal Server Error
      security: []
      x-apidog-folder: placement test
      x-apidog-status: released
      x-run-in-apidog: https://app.apidog.com/web/project/797058/apis/api-25780426-run
components:
  schemas: {}
  securitySchemes: {}
servers:
  - url: https://api.zapmail.ai/api
    description: Prod Env
security: []

```
