🌐 US-Proxy
class="antialiased">
Skip to main content
Subscriptions allow you to automate recurring billing for a customer on a defined schedule. This guide covers the prerequisites, API flow, and how to create and manage subscription plans.

Prerequisites

Before creating a subscription, two things must be in place:
  • Stored Customer: The customer must exist in the Ecrypt system with a populated customer wallet containing at least one stored payment token (wallet payment method).
  • Reusable Payment Token: When capturing the initial payment method (via iFrame or checkout page), oneTimePayment must be set to false. This ensures the generated token can be stored to the customer wallet and used for future recurring charges. Setting this to true will prevent the token from being reused.

API Flows

iFrame and Direct API

For a first-time customer using the iFrame or direct API integration, the typical sequence is:
  1. Create Token — Tokenize the customer’s payment method via the iFrame or checkout page with oneTimePayment: false.
  2. Create CustomerPOST /v1/customers
  3. Create Customer WalletPOST /v1/customers/{Customer}/wallet — Store the token to the customer’s wallet.
  4. Create Subscription PlanPOST /v1/subscriptions — Define the billing plan (cycle, amount, label).
  5. Create Customer SubscriptionPOST /v1/customers/{Customer}/subscriptions — Link the customer and their wallet to the subscription plan.

Dynamic Checkout Page

The Dynamic Checkout page simplifies this considerably. By including a subscription object in the POST /v1/dynamiccheckout request body, the checkout page handles the entire flow in a single session:
Tokenization > create customer > store payment method > subscription enrollment.
You simply select a pre-defined billing cycle and a billing date (start date) within the pages subscription object, and the checkout page takes care of the rest.

Create a Subscription Plan

POST /v1/subscriptions This endpoint defines a reusable subscription plan that can then be assigned to one or more customers.

Required Fields

label (string, required) — A human-readable name for the subscription plan. Must be between 1 and 100 characters. cycle (object, required) — Defines the billing frequency and timing. amount (object, required) — The billing amount for each cycle occurrence.

Example Request


Enrolling a Customer in a Subscription

POST /v1/customers/{Customer}/subscriptions Once a subscription plan exists and the customer has a populated wallet, use this endpoint to activate the subscription for a specific customer.

Checkout Page Subscription Object

When using the Dynamic Checkout page (POST /v1/dynamiccheckout), include the subscription object to handle the full enrollment flow automatically. This is the simpler path for new customers. Billing Cycle Values

Subscription Management

Once active, a customer subscription can be managed via the following endpoints. See the Customer Subscription section in the API reference.
  • Modify PricePUT /v1/customers/{Customer}/subscriptions/{Subscription}
  • SuspendPUT /v1/customers/{Customer}/subscriptions/{Subscription}/suspend
  • ResumePUT /v1/customers/{Customer}/subscriptions/{Subscription}/resume
  • CancelDELETE /v1/customers/{Customer}/subscriptions/{Subscription}
  • Delete PlanDELETE /v1/subscriptions/{Subscription}