v1

latestOpenAPI 3.0.02026-07-26168846732.2 KB
Subscriptions

Subscription - Create and Confirm

Creates and confirms a subscription in a single request.

post/subscriptions

Headers

X-Profile-Idstring required

Profile ID for authentication

Request body

plan_idstring nullable

Identifier for the associated plan_id.

item_price_idstring required

Identifier for the associated item_price_id for the subscription.

coupon_codestring nullable

Identifier for the coupon code for the subscription.

customer_idstring required

A type for customer_id that can be used for customer ids

merchant_reference_idstring nullable

Merchant specific Unique identifier.

Example request

{
  "billing": {
    "address": {
      "city": "New York",
      "line1": "123, King Street",
      "line2": "Powelson Avenue",
      "line3": "Bridgewater",
      "zip": "08807",
      "state": "New York",
      "first_name": "John",
      "last_name": "Doe",
      "origin_zip": "08807"
    },
    "phone": {
      "number": "9123456789",
      "country_code": "+1"
    }
  },
  "shipping": {
    "address": {
      "city": "New York",
      "line1": "123, King Street",
      "line2": "Powelson Avenue",
      "line3": "Bridgewater",
      "zip": "08807",
      "state": "New York",
      "first_name": "John",
      "last_name": "Doe",
      "origin_zip": "08807"
    },
    "phone": {
      "number": "9123456789",
      "country_code": "+1"
    }
  },
  "payment_details": {
    "payment_method_data": {
      "card": {
        "card_number": "4242424242424242",
        "card_exp_month": "24",
        "card_exp_year": "24",
        "card_holder_name": "John Test",
        "card_cvc": "242",
        "card_issuer": "chase",
        "card_type": "CREDIT",
        "card_issuing_country": "INDIA",
        "card_issuing_country_code": "IN",
        "bank_code": "JP_AMEX",
        "nick_name": "John Test"
      },
      "billing": {
        "address": {
          "city": "New York",
          "line1": "123, King Street",
          "line2": "Powelson Avenue",
          "line3": "Bridgewater",
          "zip": "08807",
          "state": "New York",
          "first_name": "John",
          "last_name": "Doe",
          "origin_zip": "08807"
        },
        "phone": {
          "number": "9123456789",
          "country_code": "+1"
        }
      }
    },
    "customer_acceptance": {
      "accepted_at": "2022-09-10T10:11:12Z",
      "online": {
        "ip_address": "123.32.25.123"
      }
    },
    "payment_method_id": "pm_01926c58bc6e77c09e809964e72af8c8"
  }
}

Response

Subscription created and confirmed successfully

idstring required

A type for subscription_id that can be used for subscription ids

merchant_reference_idstring nullable

Merchant specific Unique identifier.

status'active' | 'created' | 'in_active' | 'pending' | 'trial' | 'paused' | 'unpaid' | 'onetime' | 'cancelled' | 'failed' required

Possible states of a subscription lifecycle.

  • Created: Subscription was created but not yet activated.
  • Active: Subscription is currently active.
  • InActive: Subscription is inactive.
  • Pending: Subscription is pending activation.
  • Trial: Subscription is in a trial period.
  • Paused: Subscription is paused.
  • Unpaid: Subscription is unpaid.
  • Onetime: Subscription is a one-time payment.
  • Cancelled: Subscription has been cancelled.
  • Failed: Subscription has failed.
plan_idstring nullable

Identifier for the associated subscription plan.

item_price_idstring nullable

Identifier for the associated item_price_id for the subscription.

profile_idstring required

A type for profile_id that can be used for business profile ids

client_secretstring nullable

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

merchant_idstring required

A type for merchant_id that can be used for merchant ids

coupon_codestring nullable

Optional coupon code applied to this subscription.

customer_idstring required

A type for customer_id that can be used for customer ids

Example response

{
  "payment": {
    "payment_method_id": "pm_01926c58bc6e77c09e809964e72af8c8",
    "next_action": {
      "redirect_to_url": "https://example.com/redirect"
    },
    "billing": {
      "address": {
        "city": "New York",
        "line1": "123, King Street",
        "line2": "Powelson Avenue",
        "line3": "Bridgewater",
        "zip": "08807",
        "state": "New York",
        "first_name": "John",
        "last_name": "Doe",
        "origin_zip": "08807"
      },
      "phone": {
        "number": "9123456789",
        "country_code": "+1"
      }
    },
    "shipping": {
      "address": {
        "city": "New York",
        "line1": "123, King Street",
        "line2": "Powelson Avenue",
        "line3": "Bridgewater",
        "zip": "08807",
        "state": "New York",
        "first_name": "John",
        "last_name": "Doe",
        "origin_zip": "08807"
      },
      "phone": {
        "number": "9123456789",
        "country_code": "+1"
      }
    },
    "payment_token": "token_sxJdmpUnpNsJk5VWzcjl"
  },
  "invoice": {
    "payment_method_id": "pm_01926c58bc6e77c09e809964e72af8c8"
  }
}