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

# Purchase a shared plan

> Purchase the plan behind a shareable link. Resolves or creates the client from the buyer's mobile number and date of birth, then creates and charges their plan. The plan is only usable once payment is confirmed.



## OpenAPI

````yaml https://api.halth.com/v1/api-yaml post /v1/plans/templates/links/{secret}/transactions
openapi: 3.0.0
info:
  title: HaltH API
  description: The API for the HaltH platform business services
  version: 1.0.0
  contact: {}
servers:
  - url: https://api.halth.com
    description: Production
  - url: https://api.stg.halth.com
    description: Staging
security: []
tags: []
paths:
  /v1/plans/templates/links/{secret}/transactions:
    post:
      tags:
        - Plan Template Link
      summary: Purchase a shared plan
      description: >-
        Purchase the plan behind a shareable link. Resolves or creates the
        client from the buyer's mobile number and date of birth, then creates
        and charges their plan. The plan is only usable once payment is
        confirmed.
      operationId: PlanTemplateLinkPublicController_createTransaction
      parameters:
        - name: secret
          required: true
          in: path
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PlanTemplateLinkTransactionParams'
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ClientPlan'
components:
  schemas:
    PlanTemplateLinkTransactionParams:
      type: object
      properties:
        client:
          description: The buyer identity.
          allOf:
            - $ref: '#/components/schemas/PlanTemplateLinkClientParams'
        confirmationTokenId:
          type: string
          description: >-
            A Stripe confirmation token for the buyer card, resolved into a
            saved payment method before charging.
        customerId:
          type: string
          description: >-
            Optional Stripe customer id the payment method belongs to. Defaults
            to the client wallet customer.
      required:
        - client
        - confirmationTokenId
    ClientPlan:
      type: object
      properties:
        client:
          title: Client
          description: Expandable field
          allOf:
            - $ref: '#/components/schemas/Client'
        organisation:
          title: Organisation
          description: Expandable field
          allOf:
            - $ref: '#/components/schemas/Organisation'
        business:
          title: Business
          description: Expandable field
          allOf:
            - $ref: '#/components/schemas/Business'
        billingType:
          enum:
            - one_off
            - recurring
          type: string
          description: >-
            Whether the plan is billed as a one-off or on a recurring basis.
            Recurring when the plan has a subscription.
          example: one_off
        bookingCredits:
          title: Booking credits
          description: Expandable field
          type: array
          items:
            $ref: '#/components/schemas/BookingCredit'
        charges:
          title: Charges
          description: Expandable field
          type: array
          items:
            $ref: '#/components/schemas/ClientPlanCharge'
        id:
          type: string
        createdAt:
          type: string
        clientId:
          type: string
        status:
          enum:
            - created
            - active
            - inactive
            - paused
            - cancelled
            - past_due
            - completed
          type: string
        plan:
          $ref: '#/components/schemas/ClientPlanPlan'
        subscription:
          $ref: '#/components/schemas/ClientPlanSubscription'
      required:
        - billingType
        - id
        - createdAt
        - clientId
        - status
        - plan
    PlanTemplateLinkClientParams:
      type: object
      properties:
        mobileNumber:
          type: string
          format: mobile-phone
          description: The buyer mobile number.
          example: '+61412345678'
        dateOfBirth:
          type: string
          description: The buyer date of birth.
          example: '1990-01-01'
        firstName:
          type: string
        lastName:
          type: string
        email:
          type: string
          format: email
      required:
        - mobileNumber
        - dateOfBirth
    Client:
      type: object
      properties:
        memberId:
          type: string
          description: The ID of the member if the client has joined HaltH
          example: memb_38JiySr0Z0ePjHpqvosimyLQuUC
        id:
          type: string
        firstName:
          type: string
        lastName:
          type: string
        dateOfBirth:
          type: string
        mobileNumber:
          type: string
        email:
          type: string
        source:
          enum:
            - pms
            - halth
            - unknown
          type: string
        pmsPatientId:
          type: string
        pmsCreatedAt:
          format: date-time
          type: string
        deleted:
          type: boolean
        createdAt:
          format: date-time
          type: string
        profileImageUrl:
          type: string
      required:
        - id
        - deleted
        - createdAt
    Organisation:
      type: object
      properties:
        id:
          type: string
          description: Unique identifier for the organisation
          example: org_31XEcUshz1ymodA14HALnyP48g1
        name:
          type: string
          description: Name of the organisation
          example: Acme Healthcare
        slug:
          type: string
          description: URL-friendly identifier for the organisation
          example: acme-healthcare
        createdAt:
          format: date-time
          type: string
          description: Date when the organisation was created
          example: '2023-01-15T10:30:00Z'
        brandImageUrl:
          type: string
          nullable: true
          description: URL to the organisation's brand image
          example: https://example.com/brand-image.png
        bookingsEnabled:
          type: boolean
          description: True if bookings are enabled for this organisation
          example: true
        wordmarkImageUrl:
          type: string
          nullable: true
          description: URL to the organisation's wordmark image
          example: https://example.com/wordmark-image.png
        websiteUrl:
          type: string
          nullable: true
          description: URL to the organisation's website
          example: https://example.com
          deprecated: true
      required:
        - id
        - name
        - slug
        - createdAt
        - bookingsEnabled
    Business:
      type: object
      properties:
        id:
          type: string
        name:
          type: string
        taxIdentifier:
          type: string
        countryCode:
          type: string
        structure:
          enum:
            - public_corporation
            - private_corporation
            - sole_proprietorship
            - private_partnership
            - trust
            - incorporated_non_profit
            - unincorporated_association
          type: string
        merchantId:
          type: string
        capabilities:
          type: array
          items:
            $ref: '#/components/schemas/BusinessCapability'
        settings:
          $ref: '#/components/schemas/BusinessSettings'
        createdAt:
          format: date-time
          type: string
        events:
          type: object
        websiteUrl:
          type: string
        brandImageUrl:
          type: string
        address:
          $ref: '#/components/schemas/AddressDetails'
      required:
        - id
        - name
        - settings
        - createdAt
    BookingCredit:
      type: object
      properties:
        id:
          type: string
        status:
          enum:
            - available
            - booked
            - redeemed
            - voided
          type: string
        clientPlanId:
          type: string
        clientPlanItemId:
          type: string
        appointmentTypeId:
          type: string
          nullable: true
        price:
          type: number
        currency:
          type: string
        paidAt:
          format: date-time
          type: string
          nullable: true
        bookedAt:
          format: date-time
          type: string
          nullable: true
        redeemedAt:
          format: date-time
          type: string
          nullable: true
        isPaid:
          type: boolean
        isBooked:
          type: boolean
      required:
        - id
        - status
        - clientPlanId
        - clientPlanItemId
        - appointmentTypeId
        - price
        - currency
        - paidAt
        - bookedAt
        - redeemedAt
        - isPaid
        - isBooked
    ClientPlanCharge:
      type: object
      properties:
        id:
          type: string
        clientPlanId:
          type: string
        cycleNumber:
          type: number
        status:
          type: string
          enum:
            - pending
            - succeeded
            - failed
            - reversed
        amount:
          type: number
        currency:
          type: string
        businessTransactionId:
          type: string
      required:
        - id
        - clientPlanId
        - cycleNumber
        - status
        - amount
        - currency
    ClientPlanPlan:
      type: object
      properties:
        planTemplateId:
          type: string
          nullable: true
        name:
          type: string
          nullable: true
        discountRate:
          type: number
        discountAmount:
          type: number
        items:
          type: array
          items:
            $ref: '#/components/schemas/ClientPlanItem'
      required:
        - planTemplateId
        - name
        - discountRate
        - discountAmount
        - items
    ClientPlanSubscription:
      type: object
      properties:
        startsAt:
          type: string
        billingFrequency:
          type: string
          enum:
            - daily
            - weekly
            - fortnightly
            - monthly
            - quarterly
            - biannual
            - yearly
            - custom
        billingIntervalCount:
          type: number
        billingIntervalUnit:
          type: string
          enum:
            - day
            - week
            - month
            - year
        billingEndType:
          type: string
          enum:
            - none
            - date
            - cycles
        billingCycleCount:
          type: number
        endsAt:
          type: string
        nextBillingAt:
          format: date-time
          type: string
        cyclesCompleted:
          type: number
      required:
        - billingFrequency
        - cyclesCompleted
    BusinessCapability:
      type: object
      properties:
        id:
          enum:
            - bookings_client_funding_phi
            - payments
            - payouts
            - phi_funding
            - medicare_funding_onboarding
            - medicare_funding
            - client_invite
          type: string
        status:
          enum:
            - inactive
            - pending
            - active
            - paused
          type: string
      required:
        - id
        - status
    BusinessSettings:
      type: object
      properties:
        autoReconciliationEnabled:
          type: boolean
        autoInviteClientsEnabled:
          type: boolean
      required:
        - autoReconciliationEnabled
        - autoInviteClientsEnabled
    AddressDetails:
      type: object
      properties:
        line1:
          type: string
          nullable: true
        line2:
          type: string
          nullable: true
        suburb:
          type: string
          nullable: true
        city:
          type: string
          nullable: true
        state:
          type: string
          nullable: true
        postcode:
          type: string
          nullable: true
        country:
          type: string
          nullable: true
        countryCode:
          type: string
          nullable: true
    ClientPlanItem:
      type: object
      properties:
        id:
          type: string
        createdAt:
          type: string
        clientPlanId:
          type: string
        planTemplateItemId:
          type: string
          nullable: true
        appointmentTypeId:
          type: string
          nullable: true
        providerId:
          type: string
          nullable: true
        billableItemId:
          type: string
          nullable: true
        basePrice:
          type: number
        price:
          type: number
        taxRate:
          type: number
        currency:
          type: string
        name:
          type: string
      required:
        - id
        - createdAt
        - clientPlanId
        - planTemplateItemId
        - appointmentTypeId
        - providerId
        - billableItemId
        - basePrice
        - price
        - taxRate
        - currency
        - name

````