Using On-Demand Subscriptions

On-demand subscriptions allow you to charge customers flexibly, rather than strictly on a recurring schedule.

Enabling On-Demand Subscriptions

To enable on-demand subscriptions, contact Dodo Payments Support. Once enabled for your business, you’ll have access to create and manage on-demand subscriptions.

Creating an On-Demand Subscription

To create an on-demand subscription, use the POST /subscriptions API endpoint.

Include the on_demand field in your request body to activate on-demand functionality:

"on_demand": {
  "mandate_only": true, // Set to true to authorize payment method without immediate charge
  "product_price": 5000 // Optional: initial product price; defaults to stored product price if omitted
}

Fields Description:

  • mandate_only (boolean, required):
    • If set to true, no immediate charge is performed. Instead, this authorizes the payment method details for future charges.
  • product_price (integer, optional):
    • Sets the initial price for the product charged to the customer.
    • If not provided, the system defaults to the stored product price.

Charging an On-Demand Subscription

For subsequent charges on an existing on-demand subscription, use the following endpoint. Try it out in the API Explorer:

POST /subscriptions/{subscription_id}/charge

Parameters

  • subscription_id (string, path, required): Subscription ID.

Request Body

{
  "product_price": 7500
}

  • product_price (integer, required): The amount you wish to charge the customer for this transaction.

Response

A successful charge will return HTTP status 200 with the following response body:

{
  "payment_id": "string"
}

This flexibility allows you to manage charges according to your business requirements.