Subscription - Create and Confirm
POST /subscriptions
Create and confirm a subscription. Returns subscription details including payment and invoice information.
cURL
curl --request POST \
--url https://sandbox.hyperswitch.io/subscriptions \
--header 'Content-Type: application/json' \
--header 'X-Profile-Id: <x-profile-id>' \
--header 'api-key: <api-key>' \
--data '
{
"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_id": "cust_123456789",
"description": "Hello this is description",
"item_price_id": "standard-plan-USD-Monthly",
"merchant_reference_id": "mer_ref_123456789",
"payment_details": {
"authentication_type": "no_three_ds",
"capture_method": "automatic",
"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": "4000000000000002"
}
},
"payment_method_type": "credit",
"payment_type": "setup_mandate",
"return_url": "https://google.com",
"setup_future_usage": "off_session"
},
"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"
}
}
}
'Authorization
Required headers:
Content-Type: application/json
api-key: string (required)
X-Profile-Id: string (required) — Profile ID for authentication
Request body (application/json)
Top-level required fields:
item_price_id (string) — Identifier for the associated item_price_id for the subscription. (required)
customer_id (string) — Customer identifier. (required)
payment_details (object) — Payment-related information. (required)
Other optional / related fields:
plan_id (string | null)
coupon_code (string | null)
billing (object)
shipping (object)
merchant_reference_id (string | null)
description (string)
The example request body is shown in the cURL section above.
Response
200 application/json — Subscription created and confirmed successfully.
Response fields (summary)
Related
Subscription - Confirm: https://api-reference.hyperswitch.io/v1/subscriptions/confirm
Subscription - Update: https://api-reference.hyperswitch.io/v1/subscriptions/update
Suggest edits: https://github.com/juspay/hyperswitch/edit/main/api-reference/v1/subscriptions/create-and-confirm.mdx Raise issue: https://github.com/juspay/hyperswitch/issues/new?title=Issue%20on%20docs&body=Path:%20/v1/subscriptions/create-and-confirm