# Create a payment plan, save the customer's payment method, then subscribe the customer to the plan.

Create a payment plan, save the customer's payment method, then subscribe the customer to the plan.

1. Set up the reusable payment plan on the terminal by invoking the manage-payment-plans sub-workflow. The plan is the schedule template later subscriptions attach to; the primary path is an `automatic` plan (gateway collects each payment on schedule). Passes the merchant-assigned `paymentPlanId`, which the gateway does not mint. The sub-workflow's create step returns 201; this step surfaces the confirmed `paymentPlanId`.
 [manage-payment-plans](/workflows/manage-payment-plans)
2. Save the customer's payment method as a reusable secure token by invoking the save-a-payment-method sub-workflow. The primary path is the card branch; the bank-account branch (ach / pad) runs the same sub-workflow with a bank-account source. The sub-workflow returns 201 and both a `secureTokenId` (reference) and a `token` (the reusable VALUE). This step surfaces the `token` value, which step 3 threads into the subscription — do NOT substitute the secureTokenId.
 [save-a-payment-method](/workflows/save-a-payment-method)
3. Assign the customer to the plan by invoking the manage-subscriptions sub-workflow. Links the plan (`paymentPlanId` from step 1) and the stored secure token (`token` from step 2 — the token VALUE, sent in `paymentMethod.token`, not `secureTokenId`) and sets the `startDate`. For an `automatic` plan the gateway now collects each payment on schedule; for a `manual` plan the sub-workflow's optional pay step (paySubscription, 201) collects payments on demand — this is the "use your own software" branch. The create step returns 201; this step surfaces the confirmed `subscriptionId` and its status.
 [manage-subscriptions](/workflows/manage-subscriptions)

## Workflow diagram

```mermaid
flowchart TD
  step0["1. create plan request · Workflow"]
  step1["2. secure token request · Workflow"]
  step0 --> step1
  step2["3. create subscription request · Workflow"]
  step1 --> step2
```
