## As Presented Subscriptions: Flexible On-Demand Charging of Merchants

As Presented Subscriptions allow merchants to charge customers on-demand, without committing to a fixed billing schedule at the time of subscription creation. Unlike standard subscriptions, where Glomopay automatically charges customers on predefined intervals (monthly, quarterly, etc.) with a predefined amount, As Presented frequency gives merchants full control over when a charge is initiated - while still benefiting from card tokenization, recurring consent, and subscription lifecycle management.

This model is particularly useful for industries such as insurance, logistics, usage-based services, and event-driven billing, where charges depend on real-world actions rather than a fixed calendar.

### How As Presented Subscriptions Work

1. Merchant creates a subscription with frequency = AS_PRESENTED.
2. Customer completes the first payment, providing consent and card authorization.
3. Glomopay securely tokenizes the customer’s card.
4. Merchant initiates future charges on demand via:
  - API or
  - Glomopay Dashboard
5. Each charge is processed independently under the same subscription context.


Glomopay does not automatically schedule or trigger payments for As Presented subscriptions.

## Steps to Create a Subscription

### Via API

Create a subscription with interval_type = `as_presented`.

Example:

```http
curl -i -X POST \
  https://api.glomopay.com/api/v1/subscriptions \
  -H 'Authorization: Bearer <YOUR_JWT_HERE>' \
  -H 'Content-Type: application/json' \
  -d '{
    "customer_id": "cust_5JU9yv0lGSUP",
    "product_name": "ShieldGuard Insurance",
    "product_description": "Flexible insurance for belongings easy to manage",
    "plan_name": "ShieldGuard Lite",
    "plan_description": "As presented billing plan",
    "amount": 1000,
    "max_amount": 3000,
    "currency": "USD",
    "interval_type": "as_presented",
    "expires_at": "2026-02-01",
    "notify_customer": true,
    "starts_with_first_payment": true
  }'
```

## Charging an As Presented Subscription

Once the subscription is Active, merchants can initiate charges at any time.

### Via API

```http
curl -i -X POST \
  https://api.glomopay.com/api/v1/payment \
  -H 'Authorization: Bearer <YOUR_JWT_HERE>' \
  -H 'Content-Type: application/json' \
  -d '{
    "subscription_id": "sub_6979fa805EFmv",
    "sequence": "subsequent",
    "request_id": "abcd",
    "amount": 50,
    "currency": "USD",
    "notes": {
        "internal_ref": "ref_12345"
    }
}'
```

Since subsequent payments are merchant-initiated, `card`, `callback_url`, and `method` are not needed — the card from the initial payment is reused automatically.

### Via Dashboard

- Open the subscription details page.
- Click Charge Subscription.
- Confirm the charge.


All charges appear under Recent Payments for the subscription.

| State | Description |
|  --- | --- |
|  Created  | Subscription is created by the merchant. No payment has been made yet. |
|  Active  | Subscription is active after the first successful payment, or resumed after a pause. Recurring billing continues. |
|  Expired  | The customer didn’t complete payment before the link expired. The subscription is no longer valid. |
|  Halted  | A scheduled payment failed (after retries). Subscription is paused pending manual reactivation. |
|  Cancelled  | Subscription is cancelled by the merchant. No further billing will occur. |