Verified against: Public OpenAPI 2.0.0 · digest cd0bbb453245

Recurring payments · API reference

Manage subscription plans

Subscription plans hold reusable amount, interval, billing, trial, invoice, past-due, and metadata settings. The reviewed contract exposes six plan operations and uses the numeric id field as plan_id in item paths.

Create and list plans

POST/api/v2/payments/subscription-plans

Create Subscription Plan

Create a new subscription plan. This endpoint allows merchants to create recurring payment plans that customers can subscribe to. Args: payload: Subscription plan data merchant_key: Merchant API key info Returns: SubscriptionPlanResponse: Created subscription plan

Operation ID
create_subscription_plan_api_v2_payments_subscription_plans_post
Environment
https://sandbox.api.moneybag.com.bd (Moneybag sandbox)
Authentication
X-Merchant-API-Key — Sandbox merchant API key. Live keys are rejected.

Parameters

No path or query parameters.

Request body

Required application/json body using SubscriptionPlanCreate.

FieldTypeRequiredConstraints and meaning
amountnumber | stringYesgreater than 0; maximum 999999.9999; pattern ^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$
Subscription amount (max 999,999)
billing_typeSubscriptionBillingTypeNoone of PREPAID, POSTPAID
PREPAID = pay upfront for the upcoming period; POSTPAID = bill in arrears at period end
cancel_immediately_on_failurebooleanNodefault false
currencystringNodefault "BDT"; maximum length 3
Currency code
interval_countintegerYesminimum 1; maximum 365
Number of interval units
interval_unitSubscriptionIntervalUnitYesone of DAY, WEEK, MONTH, YEAR
Interval unit
invoice_lead_daysintegerNodefault 0; minimum 0; maximum 364
Days before the billing date to generate/send the invoice (must be shorter than the billing interval); 0 = on the billing date
meta_dataobject | nullNo
Additional metadata
past_due_grace_daysintegerNodefault 7; minimum 0; maximum 365
past_due_warnings_enabledbooleanNodefault true
plan_descriptionstring | nullNo
Plan description
plan_namestringYesminimum length 1; maximum length 200
Plan name
trial_amountnumber | string | nullNominimum 0; maximum 999999.9999; pattern ^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$
Trial amount (null for free trial, max 999,999)
trial_notifications_enabledbooleanNodefault true
trial_period_daysinteger | nullNominimum 0
Trial period in days

Sandbox example

Set the merchant key and replace resource identifiers with values created in your sandbox workspace.

curl --request POST "https://sandbox.api.moneybag.com.bd/api/v2/payments/subscription-plans" \
  --header "X-Merchant-API-Key: $MONEYBAG_MERCHANT_KEY" \
  --header "Content-Type: application/json" \
  --data '{
    "amount": 100,
    "billing_type": "PREPAID",
    "cancel_immediately_on_failure": false,
    "currency": "BDT",
    "interval_count": 1,
    "interval_unit": "DAY",
    "invoice_lead_days": 0,
    "past_due_grace_days": 7,
    "past_due_warnings_enabled": true,
    "plan_name": "Sandbox example",
    "trial_notifications_enabled": true
  }'

Run this reviewed operation in the API Lab →

Responses

201 Successful Response

Content type: application/json. Schema: SubscriptionPlanResponse.

FieldTypeRequiredConstraints and meaning
amountnumberYes
billing_typestringYes
cancel_immediately_on_failurebooleanYes
created_atstringYes
currencystringYes
idintegerYes
interval_countintegerYes
interval_unitstringYes
invoice_lead_daysintegerYes
is_activebooleanYes
merchant_idintegerYes
merchant_namestring | nullNo
meta_dataobject | nullYes
past_due_grace_daysintegerYes
past_due_warnings_enabledbooleanYes
plan_descriptionstring | nullYes
plan_namestringYes
trial_amountnumber | nullYes
trial_notifications_enabledbooleanYes
trial_period_daysinteger | nullYes
uuidstringYes

422 Validation Error

Content type: application/json. Schema: HTTPValidationError.

FieldTypeRequiredConstraints and meaning
detailValidationError[]No
detail[].locstring | integer[]When parent is present
detail[].msgstringWhen parent is present
detail[].typestringWhen parent is present
OpenAPI 2.0.0 · operation create_subscription_plan_api_v2_payments_subscription_plans_post · contract digest cd0bbb4532452feec6b880fcc3d9190688618f7bcba1987cf518bc9107799cfe
GET/api/v2/payments/subscription-plans

List Subscription Plans

List subscription plans for the authenticated merchant. Args: merchant_key: Merchant API key info include_inactive: Include archived plans page: Page number per_page: Results per page Returns: dict: Paginated list of subscription plans

Operation ID
list_subscription_plans_api_v2_payments_subscription_plans_get
Environment
https://sandbox.api.moneybag.com.bd (Moneybag sandbox)
Authentication
X-Merchant-API-Key — Sandbox merchant API key. Live keys are rejected.

Parameters

FieldTypeRequiredConstraints and meaning
query.include_inactivebooleanNodefault false
query.pageintegerNodefault 1
query.per_pageintegerNodefault 20

Request body

No request body.

Sandbox example

Set the merchant key and replace resource identifiers with values created in your sandbox workspace.

curl --request GET "https://sandbox.api.moneybag.com.bd/api/v2/payments/subscription-plans?include_inactive=false&page=1&per_page=20" \
  --header "X-Merchant-API-Key: $MONEYBAG_MERCHANT_KEY"

Run this reviewed operation in the API Lab →

Responses

200 Successful Response

Content type: application/json. Schema: PublicSubscriptionPlanListResponse.

FieldTypeRequiredConstraints and meaning
dataSubscriptionPlanResponse[]Yes
data[].amountnumberYes
data[].billing_typestringYes
data[].cancel_immediately_on_failurebooleanYes
data[].created_atstringYes
data[].currencystringYes
data[].idintegerYes
data[].interval_countintegerYes
data[].interval_unitstringYes
data[].invoice_lead_daysintegerYes
data[].is_activebooleanYes
data[].merchant_idintegerYes
data[].merchant_namestring | nullNo
data[].meta_dataobject | nullYes
data[].past_due_grace_daysintegerYes
data[].past_due_warnings_enabledbooleanYes
data[].plan_descriptionstring | nullYes
data[].plan_namestringYes
data[].trial_amountnumber | nullYes
data[].trial_notifications_enabledbooleanYes
data[].trial_period_daysinteger | nullYes
data[].uuidstringYes
paginationPublicSubscriptionPaginationYes
Pagination shape used by merchant-key subscription APIs.
pagination.pageintegerYes
pagination.pagesintegerYes
pagination.per_pageintegerYes
pagination.totalintegerYes

422 Validation Error

Content type: application/json. Schema: HTTPValidationError.

FieldTypeRequiredConstraints and meaning
detailValidationError[]No
detail[].locstring | integer[]When parent is present
detail[].msgstringWhen parent is present
detail[].typestringWhen parent is present
OpenAPI 2.0.0 · operation list_subscription_plans_api_v2_payments_subscription_plans_get · contract digest cd0bbb4532452feec6b880fcc3d9190688618f7bcba1987cf518bc9107799cfe

Read and update a plan

GET/api/v2/payments/subscription-plans/{plan_id}

Get Subscription Plan

Get subscription plan details. Args: plan_id: ID of the subscription plan merchant_key: Merchant API key info Returns: SubscriptionPlanResponse: Subscription plan details

Operation ID
get_subscription_plan_api_v2_payments_subscription_plans__plan_id__get
Environment
https://sandbox.api.moneybag.com.bd (Moneybag sandbox)
Authentication
X-Merchant-API-Key — Sandbox merchant API key. Live keys are rejected.

Parameters

FieldTypeRequiredConstraints and meaning
path.plan_idintegerYes

Request body

No request body.

Sandbox example

Set the merchant key and replace resource identifiers with values created in your sandbox workspace.

curl --request GET "https://sandbox.api.moneybag.com.bd/api/v2/payments/subscription-plans/${PLAN_ID}" \
  --header "X-Merchant-API-Key: $MONEYBAG_MERCHANT_KEY"

Run this reviewed operation in the API Lab →

Responses

200 Successful Response

Content type: application/json. Schema: SubscriptionPlanResponse.

FieldTypeRequiredConstraints and meaning
amountnumberYes
billing_typestringYes
cancel_immediately_on_failurebooleanYes
created_atstringYes
currencystringYes
idintegerYes
interval_countintegerYes
interval_unitstringYes
invoice_lead_daysintegerYes
is_activebooleanYes
merchant_idintegerYes
merchant_namestring | nullNo
meta_dataobject | nullYes
past_due_grace_daysintegerYes
past_due_warnings_enabledbooleanYes
plan_descriptionstring | nullYes
plan_namestringYes
trial_amountnumber | nullYes
trial_notifications_enabledbooleanYes
trial_period_daysinteger | nullYes
uuidstringYes

422 Validation Error

Content type: application/json. Schema: HTTPValidationError.

FieldTypeRequiredConstraints and meaning
detailValidationError[]No
detail[].locstring | integer[]When parent is present
detail[].msgstringWhen parent is present
detail[].typestringWhen parent is present
OpenAPI 2.0.0 · operation get_subscription_plan_api_v2_payments_subscription_plans__plan_id__get · contract digest cd0bbb4532452feec6b880fcc3d9190688618f7bcba1987cf518bc9107799cfe
PATCH/api/v2/payments/subscription-plans/{plan_id}

Update Subscription Plan

Update subscription plan. Args: plan_id: ID of the subscription plan payload: Update data merchant_key: Merchant API key info Returns: SubscriptionPlanResponse: Updated subscription plan

Operation ID
update_subscription_plan_api_v2_payments_subscription_plans__plan_id__patch
Environment
https://sandbox.api.moneybag.com.bd (Moneybag sandbox)
Authentication
X-Merchant-API-Key — Sandbox merchant API key. Live keys are rejected.

Parameters

FieldTypeRequiredConstraints and meaning
path.plan_idintegerYes

Request body

Required application/json body using SubscriptionPlanUpdate.

FieldTypeRequiredConstraints and meaning
amountnumber | string | nullNogreater than 0; maximum 999999.9999; pattern ^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$
billing_typeSubscriptionBillingType | nullNoone of PREPAID, POSTPAID
cancel_immediately_on_failureboolean | nullNo
currencystring | nullNomaximum length 3
interval_countinteger | nullNominimum 1; maximum 365
interval_unitSubscriptionIntervalUnit | nullNoone of DAY, WEEK, MONTH, YEAR
invoice_lead_daysinteger | nullNominimum 0; maximum 364
meta_dataobject | nullNo
past_due_grace_daysinteger | nullNominimum 0; maximum 365
past_due_warnings_enabledboolean | nullNo
plan_descriptionstring | nullNo
plan_namestring | nullNominimum length 1; maximum length 200
trial_amountnumber | string | nullNominimum 0; maximum 999999.9999; pattern ^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$
trial_notifications_enabledboolean | nullNo
trial_period_daysinteger | nullNominimum 0

Sandbox example

Set the merchant key and replace resource identifiers with values created in your sandbox workspace.

curl --request PATCH "https://sandbox.api.moneybag.com.bd/api/v2/payments/subscription-plans/${PLAN_ID}" \
  --header "X-Merchant-API-Key: $MONEYBAG_MERCHANT_KEY" \
  --header "Content-Type: application/json" \
  --data '{
    "amount": 100
  }'

Run this reviewed operation in the API Lab →

Responses

200 Successful Response

Content type: application/json. Schema: SubscriptionPlanResponse.

FieldTypeRequiredConstraints and meaning
amountnumberYes
billing_typestringYes
cancel_immediately_on_failurebooleanYes
created_atstringYes
currencystringYes
idintegerYes
interval_countintegerYes
interval_unitstringYes
invoice_lead_daysintegerYes
is_activebooleanYes
merchant_idintegerYes
merchant_namestring | nullNo
meta_dataobject | nullYes
past_due_grace_daysintegerYes
past_due_warnings_enabledbooleanYes
plan_descriptionstring | nullYes
plan_namestringYes
trial_amountnumber | nullYes
trial_notifications_enabledbooleanYes
trial_period_daysinteger | nullYes
uuidstringYes

422 Validation Error

Content type: application/json. Schema: HTTPValidationError.

FieldTypeRequiredConstraints and meaning
detailValidationError[]No
detail[].locstring | integer[]When parent is present
detail[].msgstringWhen parent is present
detail[].typestringWhen parent is present
OpenAPI 2.0.0 · operation update_subscription_plan_api_v2_payments_subscription_plans__plan_id__patch · contract digest cd0bbb4532452feec6b880fcc3d9190688618f7bcba1987cf518bc9107799cfe

Archive and restore a plan

Archive and restore return the complete reviewed plan response. The artifact does not state how existing subscriptions behave when a plan is archived.

DELETE/api/v2/payments/subscription-plans/{plan_id}

Archive Subscription Plan

Archive a subscription plan. Args: plan_id: ID of the subscription plan merchant_key: Merchant API key info Returns: SubscriptionPlanResponse: Archived subscription plan

Operation ID
archive_subscription_plan_api_v2_payments_subscription_plans__plan_id__delete
Environment
https://sandbox.api.moneybag.com.bd (Moneybag sandbox)
Authentication
X-Merchant-API-Key — Sandbox merchant API key. Live keys are rejected.

Parameters

FieldTypeRequiredConstraints and meaning
path.plan_idintegerYes

Request body

No request body.

Sandbox example

Set the merchant key and replace resource identifiers with values created in your sandbox workspace.

curl --request DELETE "https://sandbox.api.moneybag.com.bd/api/v2/payments/subscription-plans/${PLAN_ID}" \
  --header "X-Merchant-API-Key: $MONEYBAG_MERCHANT_KEY"

Run this reviewed operation in the API Lab →

Responses

200 Successful Response

Content type: application/json. Schema: SubscriptionPlanResponse.

FieldTypeRequiredConstraints and meaning
amountnumberYes
billing_typestringYes
cancel_immediately_on_failurebooleanYes
created_atstringYes
currencystringYes
idintegerYes
interval_countintegerYes
interval_unitstringYes
invoice_lead_daysintegerYes
is_activebooleanYes
merchant_idintegerYes
merchant_namestring | nullNo
meta_dataobject | nullYes
past_due_grace_daysintegerYes
past_due_warnings_enabledbooleanYes
plan_descriptionstring | nullYes
plan_namestringYes
trial_amountnumber | nullYes
trial_notifications_enabledbooleanYes
trial_period_daysinteger | nullYes
uuidstringYes

422 Validation Error

Content type: application/json. Schema: HTTPValidationError.

FieldTypeRequiredConstraints and meaning
detailValidationError[]No
detail[].locstring | integer[]When parent is present
detail[].msgstringWhen parent is present
detail[].typestringWhen parent is present
OpenAPI 2.0.0 · operation archive_subscription_plan_api_v2_payments_subscription_plans__plan_id__delete · contract digest cd0bbb4532452feec6b880fcc3d9190688618f7bcba1987cf518bc9107799cfe
POST/api/v2/payments/subscription-plans/{plan_id}/restore

Restore Subscription Plan

Restore an archived subscription plan. Args: plan_id: ID of the subscription plan merchant_key: Merchant API key info Returns: SubscriptionPlanResponse: Restored subscription plan

Operation ID
restore_subscription_plan_api_v2_payments_subscription_plans__plan_id__restore_post
Environment
https://sandbox.api.moneybag.com.bd (Moneybag sandbox)
Authentication
X-Merchant-API-Key — Sandbox merchant API key. Live keys are rejected.

Parameters

FieldTypeRequiredConstraints and meaning
path.plan_idintegerYes

Request body

No request body.

Sandbox example

Set the merchant key and replace resource identifiers with values created in your sandbox workspace.

curl --request POST "https://sandbox.api.moneybag.com.bd/api/v2/payments/subscription-plans/${PLAN_ID}/restore" \
  --header "X-Merchant-API-Key: $MONEYBAG_MERCHANT_KEY"

Run this reviewed operation in the API Lab →

Responses

200 Successful Response

Content type: application/json. Schema: SubscriptionPlanResponse.

FieldTypeRequiredConstraints and meaning
amountnumberYes
billing_typestringYes
cancel_immediately_on_failurebooleanYes
created_atstringYes
currencystringYes
idintegerYes
interval_countintegerYes
interval_unitstringYes
invoice_lead_daysintegerYes
is_activebooleanYes
merchant_idintegerYes
merchant_namestring | nullNo
meta_dataobject | nullYes
past_due_grace_daysintegerYes
past_due_warnings_enabledbooleanYes
plan_descriptionstring | nullYes
plan_namestringYes
trial_amountnumber | nullYes
trial_notifications_enabledbooleanYes
trial_period_daysinteger | nullYes
uuidstringYes

422 Validation Error

Content type: application/json. Schema: HTTPValidationError.

FieldTypeRequiredConstraints and meaning
detailValidationError[]No
detail[].locstring | integer[]When parent is present
detail[].msgstringWhen parent is present
detail[].typestringWhen parent is present
OpenAPI 2.0.0 · operation restore_subscription_plan_api_v2_payments_subscription_plans__plan_id__restore_post · contract digest cd0bbb4532452feec6b880fcc3d9190688618f7bcba1987cf518bc9107799cfe