Subscription - Confirm

POST /subscriptions/{subscription_id}/confirm

Description: Confirm a subscription. Request includes payment details to process the initial payment and activate the subscription.


Example — cURL

cURL
curl --request POST \
  --url https://sandbox.hyperswitch.io/subscriptions/{subscription_id}/confirm \
  --header 'Content-Type: application/json' \
  --header 'X-Profile-Id: <x-profile-id>' \
  --header 'api-key: <api-key>' \
  --data '
{
  "payment_details": {
    "billing": {
      "address": {
        "city": "San Fransico",
        "country": "US",
        "first_name": "joseph",
        "last_name": "Doe",
        "line1": "1467",
        "line2": "Harrison Street",
        "line3": "Harrison Street",
        "state": "California",
        "zip": "94122"
      },
      "phone": {
        "country_code": "+1",
        "number": "123456789"
      }
    },
    "customer_acceptance": {
      "acceptance_type": "online",
      "accepted_at": "1963-05-03T04:07:52.723Z",
      "online": {
        "ip_address": "127.0.0.1",
        "user_agent": "amet irure esse"
      }
    },
    "payment_method": "card",
    "payment_method_data": {
      "card": {
        "card_cvc": "737",
        "card_exp_month": "03",
        "card_exp_year": "2030",
        "card_holder_name": "CLBRW dffdg",
        "card_number": "4111111111111111"
      }
    },
    "payment_method_type": "credit",
    "shipping": {
      "address": {
        "city": "Banglore",
        "country": "US",
        "first_name": "joseph",
        "last_name": "doe",
        "line1": "sdsdfsdf",
        "line2": "hsgdbhd",
        "line3": "alsksoe",
        "state": "zsaasdas",
        "zip": "571201"
      },
      "phone": {
        "country_code": "+1",
        "number": "123456789"
      }
    }
  }
}
'

Example response (200)


Parameters

Authorizations
  • api-key (string, header, required)

    Use the API key created under your merchant account from the HyperSwitch dashboard. API key is used to authenticate API requests from your merchant server only. Don't expose this key on a website or embed it in a mobile application.

Headers
  • X-Profile-Id (string, required) — Profile ID for authentication

Path Parameters
  • subscription_id (string, required) — The unique identifier for the subscription

Body
  • Content-Type: application/json

  • payment_details (object, required)

    Showchild attributes (see API schema). Example body provided above.

  • client_secret (string | null)

    This is a token which expires after 15 minutes, used from the client to authenticate and create sessions from the SDK.


Response

200 — application/json — Subscription confirmed successfully

Response payload returned after successfully creating a subscription. Includes details such as subscription ID, status, plan, merchant, and customer info.

Key response fields:

  • id (string) — subscription identifier

  • status (enum) — possible subscription states: active, created, in_active, pending, trial, paused, unpaid, onetime, cancelled, failed

  • profile_id (string)

  • merchant_id (string)

  • customer_id (string)

  • merchant_reference_id (string | null)

  • plan_id (string | null)

  • item_price_id (string | null)

  • client_secret (string | null) — token expiring after 15 minutes

  • coupon_code (string | null)

  • payment (object) — payment details (see example)

  • invoice (object) — invoice details (see example)


Related:

  • Subscription - Create: https://api-reference.hyperswitch.io/v1/subscriptions/create

  • Subscription - Create and Confirm: https://api-reference.hyperswitch.io/v1/subscriptions/create-and-confirm

Edit docs: https://github.com/juspay/hyperswitch/edit/main/api-reference/v1/subscriptions/confirm.mdx Raise issue: https://github.com/juspay/hyperswitch/issues/new?title=Issue%20on%20docs&body=Path:%20/v1/subscriptions/confirm