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

# Preview Subscription Swap

> Calculates the prorated cost of swapping an active subscription to a new product or variant.

Calculates the prorated cost of swapping an active subscription to a new product or variant.

This endpoint generates an upcoming invoice preview from Stripe, allowing you to show the customer exactly how much they will be charged or credited before they confirm the upgrade or downgrade.


## OpenAPI

````yaml GET /subscriptions/{id}/preview-swap
openapi: 3.0.0
info:
  title: Blink API
  description: Comprehensive API documentation for Blink.
  version: 1.0.0
servers:
  - url: https://api.blink.store/v1
security:
  - storeIdHeader: []
tags:
  - name: Invoices
    description: Unified merchant of record invoices for products and subscriptions.
  - name: Geo Pricing
    description: Resolve Purchasing Power Parity (PPP) localized pricing.
paths:
  /subscriptions/{id}/preview-swap:
    get:
      summary: Preview Subscription Swap
      description: >-
        Calculates the prorated cost of swapping an active subscription to a new
        product or variant.
      operationId: previewSubscriptionSwap
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
          description: The ID of the subscription
        - name: variant_id
          in: query
          required: false
          schema:
            type: string
          description: The target variant ID for the swap.
        - name: product_id
          in: query
          required: false
          schema:
            type: string
          description: The target product ID for the swap.
      responses:
        '200':
          description: Successfully calculated proration
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: object
                    properties:
                      amount_due:
                        type: integer
                        description: The total prorated amount due in cents.
                      subtotal:
                        type: integer
                      currency:
                        type: string
                      prorations:
                        type: array
                        items:
                          type: object
                          properties:
                            id:
                              type: string
                            amount:
                              type: integer
                            description:
                              type: string
                            period:
                              type: object
      security:
        - bearerAuth: []
components:
  securitySchemes:
    storeIdHeader:
      type: apiKey
      in: header
      name: x-store-id
    bearerAuth:
      type: http
      scheme: bearer

````