Verified against: Public OpenAPI 2.0.0 · subscription review 2026-07-30

Recurring payments · API reference

Operate subscriptions

Create a subscription from a reusable plan or inline billing fields, then read and update it through its public UUID. The reviewed contract exposes ten merchant-key subscription operations.

Use subscription plans to create and manage reusable billing definitions. The request contract accepts either customer_uuid for an existing merchant customer or a customer object that identifies one by phone and email.

Create and list

POST/api/v2/payments/subscriptions

Create Subscription

Create a new subscription for a customer. This endpoint creates a recurring payment subscription. You can provide either: - customer object: Customer will be get-or-created using phone/email (same as checkout API) - customer_uuid: Use an existing customer of yours, by public uuid If a trial period is configured, the subscription will start in TRIALING status. Otherwise, it will start as PENDING and require immediate payment. Args: payload: Subscription data with customer information merchant_key: Merchant API key info Returns: SubscriptionResponse: Created subscription

Operation ID
create_subscription_api_v2_payments_subscriptions_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 SubscriptionCreate.

FieldTypeRequiredConstraints and meaning
amountnumber | string | nullNogreater than 0; maximum 999999.9999; pattern ^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$
Override plan amount (max 999,999)
billing_typeSubscriptionBillingType | nullNoone of PREPAID, POSTPAID
Billing mode; inherited from the plan when omitted (defaults to PREPAID for ad-hoc subscriptions)
currencystringNodefault "BDT"; maximum length 3
Currency code
customerCustomer | nullNo
Customer information (will be created or fetched)
customer.addressstring | nullNo
Customer's address
customer.citystring | nullNo
Customer's city
customer.countrystring | nullNo
Customer's country
customer.emailstringWhen parent is presentformat email
Customer's email address
customer.metadataobject | nullNo
Additional customer-specific data
customer.namestringWhen parent is present
Customer's full name
customer.phonestringWhen parent is present
Customer's phone number
customer.postcodestring | nullNo
Customer's postal code
customer_uuidstring | nullNopattern ^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$
Public uuid of an existing customer of this merchant
interval_countinteger | nullNominimum 1; maximum 365
Override plan interval count
interval_unitSubscriptionIntervalUnit | nullNoone of DAY, WEEK, MONTH, YEAR
Override plan interval unit
invoice_lead_daysinteger | nullNominimum 0; maximum 364
Invoice lead time in days; inherited from the plan when omitted (defaults to 0)
meta_dataobject | nullNo
Additional metadata
subscription_plan_idinteger | nullNo
Plan ID (optional, can specify inline)
trial_period_daysinteger | nullNominimum 0
Override plan trial period

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/subscriptions" \
  --header "X-Merchant-API-Key: $MONEYBAG_MERCHANT_KEY" \
  --header "Content-Type: application/json" \
  --data '{
    "subscription_plan_id": 1,
    "customer": {
      "name": "Sandbox Customer",
      "email": "sandbox.customer@example.com",
      "phone": "+8801700000000"
    }
  }'

Run this reviewed operation in the API Lab →

Responses

201 Successful Response

Content type: application/json. Schema: SubscriptionResponse.

FieldTypeRequiredConstraints and meaning
amountnumberYes
billing_cycle_countintegerYes
billing_typestringYes
cancellation_reasonstring | nullYes
cancelled_atstring | nullYes
created_atstringYes
currencystringYes
current_period_endstringYes
current_period_startstringYes
customerCustomerBasicInfo | nullNo
customer.emailstring | nullWhen parent is present
customer.idintegerWhen parent is present
customer.namestringWhen parent is present
customer.phonestringWhen parent is present
customer.uuidstring | nullNo
customer_idintegerYes
days_until_trial_endinteger | nullYes
Calculate days remaining in trial period
failed_payment_countintegerYes
idintegerYes
interval_countintegerYes
interval_unitstringYes
invoice_lead_daysintegerYes
is_in_trialbooleanYesread only
Check if subscription is currently in trial period
is_simulationbooleanYesread only
True when this subscription belongs to a simulation (test) clock.
merchant_idintegerYes
merchant_namestring | nullNo
meta_dataobject | nullYes
next_billing_datestringYes
planSubscriptionPlanResponse | nullNo
plan.amountnumberWhen parent is present
plan.billing_typestringWhen parent is present
plan.cancel_immediately_on_failurebooleanWhen parent is present
plan.created_atstringWhen parent is present
plan.currencystringWhen parent is present
plan.idintegerWhen parent is present
plan.interval_countintegerWhen parent is present
plan.interval_unitstringWhen parent is present
plan.invoice_lead_daysintegerWhen parent is present
plan.is_activebooleanWhen parent is present
plan.merchant_idintegerWhen parent is present
plan.merchant_namestring | nullNo
plan.meta_dataobject | nullWhen parent is present
plan.past_due_grace_daysintegerWhen parent is present
plan.past_due_warnings_enabledbooleanWhen parent is present
plan.plan_descriptionstring | nullWhen parent is present
plan.plan_namestringWhen parent is present
plan.trial_amountnumber | nullWhen parent is present
plan.trial_notifications_enabledbooleanWhen parent is present
plan.trial_period_daysinteger | nullWhen parent is present
plan.uuidstringWhen parent is present
simulation_clock_idinteger | nullNo
simulation_clock_uuidstring | nullNo
statusstringYes
subscription_plan_idinteger | nullYes
trial_end_datestring | 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_api_v2_payments_subscriptions_post · contract digest cd0bbb4532452feec6b880fcc3d9190688618f7bcba1987cf518bc9107799cfe
GET/api/v2/payments/subscriptions

List Subscriptions

List subscriptions for the authenticated merchant. Args: merchant_key: Merchant API key info customer_uuid: Filter by customer uuid (must be a customer of this merchant) subscription_status: Filter by status (TRIALING, ACTIVE, PAST_DUE, PAUSED, CANCELLED, EXPIRED) page: Page number per_page: Results per page Returns: dict: Paginated list of subscriptions

Operation ID
list_subscriptions_api_v2_payments_subscriptions_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.customer_uuidstring | nullNopattern ^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$
query.subscription_statusstring | nullNo
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/subscriptions?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: PublicSubscriptionListResponse.

FieldTypeRequiredConstraints and meaning
dataSubscriptionResponse[]Yes
data[].amountnumberYes
data[].billing_cycle_countintegerYes
data[].billing_typestringYes
data[].cancellation_reasonstring | nullYes
data[].cancelled_atstring | nullYes
data[].created_atstringYes
data[].currencystringYes
data[].current_period_endstringYes
data[].current_period_startstringYes
data[].customerCustomerBasicInfo | nullNo
data[].customer.emailstring | nullWhen parent is present
data[].customer.idintegerWhen parent is present
data[].customer.namestringWhen parent is present
data[].customer.phonestringWhen parent is present
data[].customer.uuidstring | nullNo
data[].customer_idintegerYes
data[].days_until_trial_endinteger | nullYes
Calculate days remaining in trial period
data[].failed_payment_countintegerYes
data[].idintegerYes
data[].interval_countintegerYes
data[].interval_unitstringYes
data[].invoice_lead_daysintegerYes
data[].is_in_trialbooleanYesread only
Check if subscription is currently in trial period
data[].is_simulationbooleanYesread only
True when this subscription belongs to a simulation (test) clock.
data[].merchant_idintegerYes
data[].merchant_namestring | nullNo
data[].meta_dataobject | nullYes
data[].next_billing_datestringYes
data[].planSubscriptionPlanResponse | nullNo
data[].plan.amountnumberWhen parent is present
data[].plan.billing_typestringWhen parent is present
data[].plan.cancel_immediately_on_failurebooleanWhen parent is present
data[].plan.created_atstringWhen parent is present
data[].plan.currencystringWhen parent is present
data[].plan.idintegerWhen parent is present
data[].plan.interval_countintegerWhen parent is present
data[].plan.interval_unitstringWhen parent is present
data[].plan.invoice_lead_daysintegerWhen parent is present
data[].plan.is_activebooleanWhen parent is present
data[].plan.merchant_idintegerWhen parent is present
data[].plan.merchant_namestring | nullNo
data[].plan.meta_dataobject | nullWhen parent is present
data[].plan.past_due_grace_daysintegerWhen parent is present
data[].plan.past_due_warnings_enabledbooleanWhen parent is present
data[].plan.plan_descriptionstring | nullWhen parent is present
data[].plan.plan_namestringWhen parent is present
data[].plan.trial_amountnumber | nullWhen parent is present
data[].plan.trial_notifications_enabledbooleanWhen parent is present
data[].plan.trial_period_daysinteger | nullWhen parent is present
data[].plan.uuidstringWhen parent is present
data[].simulation_clock_idinteger | nullNo
data[].simulation_clock_uuidstring | nullNo
data[].statusstringYes
data[].subscription_plan_idinteger | nullYes
data[].trial_end_datestring | 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_subscriptions_api_v2_payments_subscriptions_get · contract digest cd0bbb4532452feec6b880fcc3d9190688618f7bcba1987cf518bc9107799cfe

Read and update one subscription

All item and lifecycle paths use the uuid returned as the subscription's public identifier. The artifact requires UUID syntax for each subscription_id path parameter.

GET/api/v2/payments/subscriptions/{subscription_id}

Get Subscription

Get subscription details by UUID. Args: subscription_id: UUID of the subscription merchant_key: Merchant API key info Returns: SubscriptionResponse: Subscription details

Operation ID
get_subscription_api_v2_payments_subscriptions__subscription_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.subscription_idstringYespattern ^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$

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/subscriptions/${SUBSCRIPTION_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: SubscriptionResponse.

FieldTypeRequiredConstraints and meaning
amountnumberYes
billing_cycle_countintegerYes
billing_typestringYes
cancellation_reasonstring | nullYes
cancelled_atstring | nullYes
created_atstringYes
currencystringYes
current_period_endstringYes
current_period_startstringYes
customerCustomerBasicInfo | nullNo
customer.emailstring | nullWhen parent is present
customer.idintegerWhen parent is present
customer.namestringWhen parent is present
customer.phonestringWhen parent is present
customer.uuidstring | nullNo
customer_idintegerYes
days_until_trial_endinteger | nullYes
Calculate days remaining in trial period
failed_payment_countintegerYes
idintegerYes
interval_countintegerYes
interval_unitstringYes
invoice_lead_daysintegerYes
is_in_trialbooleanYesread only
Check if subscription is currently in trial period
is_simulationbooleanYesread only
True when this subscription belongs to a simulation (test) clock.
merchant_idintegerYes
merchant_namestring | nullNo
meta_dataobject | nullYes
next_billing_datestringYes
planSubscriptionPlanResponse | nullNo
plan.amountnumberWhen parent is present
plan.billing_typestringWhen parent is present
plan.cancel_immediately_on_failurebooleanWhen parent is present
plan.created_atstringWhen parent is present
plan.currencystringWhen parent is present
plan.idintegerWhen parent is present
plan.interval_countintegerWhen parent is present
plan.interval_unitstringWhen parent is present
plan.invoice_lead_daysintegerWhen parent is present
plan.is_activebooleanWhen parent is present
plan.merchant_idintegerWhen parent is present
plan.merchant_namestring | nullNo
plan.meta_dataobject | nullWhen parent is present
plan.past_due_grace_daysintegerWhen parent is present
plan.past_due_warnings_enabledbooleanWhen parent is present
plan.plan_descriptionstring | nullWhen parent is present
plan.plan_namestringWhen parent is present
plan.trial_amountnumber | nullWhen parent is present
plan.trial_notifications_enabledbooleanWhen parent is present
plan.trial_period_daysinteger | nullWhen parent is present
plan.uuidstringWhen parent is present
simulation_clock_idinteger | nullNo
simulation_clock_uuidstring | nullNo
statusstringYes
subscription_plan_idinteger | nullYes
trial_end_datestring | 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_api_v2_payments_subscriptions__subscription_id__get · contract digest cd0bbb4532452feec6b880fcc3d9190688618f7bcba1987cf518bc9107799cfe
PATCH/api/v2/payments/subscriptions/{subscription_id}

Update Subscription

Update subscription details. Args: subscription_id: UUID of the subscription payload: Update data merchant_key: Merchant API key info Returns: SubscriptionResponse: Updated subscription

Operation ID
update_subscription_api_v2_payments_subscriptions__subscription_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.subscription_idstringYespattern ^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$

Request body

Required application/json body using SubscriptionUpdate.

FieldTypeRequiredConstraints and meaning
amountnumber | string | nullNogreater than 0; maximum 999999.9999; pattern ^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$
Update amount for next billing (max 999,999)
interval_countinteger | nullNominimum 1; maximum 365
interval_unitSubscriptionIntervalUnit | nullNoone of DAY, WEEK, MONTH, YEAR
meta_dataobject | nullNo

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/subscriptions/${SUBSCRIPTION_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: SubscriptionResponse.

FieldTypeRequiredConstraints and meaning
amountnumberYes
billing_cycle_countintegerYes
billing_typestringYes
cancellation_reasonstring | nullYes
cancelled_atstring | nullYes
created_atstringYes
currencystringYes
current_period_endstringYes
current_period_startstringYes
customerCustomerBasicInfo | nullNo
customer.emailstring | nullWhen parent is present
customer.idintegerWhen parent is present
customer.namestringWhen parent is present
customer.phonestringWhen parent is present
customer.uuidstring | nullNo
customer_idintegerYes
days_until_trial_endinteger | nullYes
Calculate days remaining in trial period
failed_payment_countintegerYes
idintegerYes
interval_countintegerYes
interval_unitstringYes
invoice_lead_daysintegerYes
is_in_trialbooleanYesread only
Check if subscription is currently in trial period
is_simulationbooleanYesread only
True when this subscription belongs to a simulation (test) clock.
merchant_idintegerYes
merchant_namestring | nullNo
meta_dataobject | nullYes
next_billing_datestringYes
planSubscriptionPlanResponse | nullNo
plan.amountnumberWhen parent is present
plan.billing_typestringWhen parent is present
plan.cancel_immediately_on_failurebooleanWhen parent is present
plan.created_atstringWhen parent is present
plan.currencystringWhen parent is present
plan.idintegerWhen parent is present
plan.interval_countintegerWhen parent is present
plan.interval_unitstringWhen parent is present
plan.invoice_lead_daysintegerWhen parent is present
plan.is_activebooleanWhen parent is present
plan.merchant_idintegerWhen parent is present
plan.merchant_namestring | nullNo
plan.meta_dataobject | nullWhen parent is present
plan.past_due_grace_daysintegerWhen parent is present
plan.past_due_warnings_enabledbooleanWhen parent is present
plan.plan_descriptionstring | nullWhen parent is present
plan.plan_namestringWhen parent is present
plan.trial_amountnumber | nullWhen parent is present
plan.trial_notifications_enabledbooleanWhen parent is present
plan.trial_period_daysinteger | nullWhen parent is present
plan.uuidstringWhen parent is present
simulation_clock_idinteger | nullNo
simulation_clock_uuidstring | nullNo
statusstringYes
subscription_plan_idinteger | nullYes
trial_end_datestring | 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_api_v2_payments_subscriptions__subscription_id__patch · contract digest cd0bbb4532452feec6b880fcc3d9190688618f7bcba1987cf518bc9107799cfe

Lifecycle actions

These actions return the contract's complete SubscriptionResponse. Do not infer undocumented transition rules, retry timing, or customer-notification behavior from the existence of an action.

POST/api/v2/payments/subscriptions/{subscription_id}/pause

Pause Subscription

Pause a subscription. Args: subscription_id: UUID of the subscription merchant_key: Merchant API key info Returns: SubscriptionResponse: Paused subscription

Operation ID
pause_subscription_api_v2_payments_subscriptions__subscription_id__pause_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.subscription_idstringYespattern ^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$

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/subscriptions/${SUBSCRIPTION_ID}/pause" \
  --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: SubscriptionResponse.

FieldTypeRequiredConstraints and meaning
amountnumberYes
billing_cycle_countintegerYes
billing_typestringYes
cancellation_reasonstring | nullYes
cancelled_atstring | nullYes
created_atstringYes
currencystringYes
current_period_endstringYes
current_period_startstringYes
customerCustomerBasicInfo | nullNo
customer.emailstring | nullWhen parent is present
customer.idintegerWhen parent is present
customer.namestringWhen parent is present
customer.phonestringWhen parent is present
customer.uuidstring | nullNo
customer_idintegerYes
days_until_trial_endinteger | nullYes
Calculate days remaining in trial period
failed_payment_countintegerYes
idintegerYes
interval_countintegerYes
interval_unitstringYes
invoice_lead_daysintegerYes
is_in_trialbooleanYesread only
Check if subscription is currently in trial period
is_simulationbooleanYesread only
True when this subscription belongs to a simulation (test) clock.
merchant_idintegerYes
merchant_namestring | nullNo
meta_dataobject | nullYes
next_billing_datestringYes
planSubscriptionPlanResponse | nullNo
plan.amountnumberWhen parent is present
plan.billing_typestringWhen parent is present
plan.cancel_immediately_on_failurebooleanWhen parent is present
plan.created_atstringWhen parent is present
plan.currencystringWhen parent is present
plan.idintegerWhen parent is present
plan.interval_countintegerWhen parent is present
plan.interval_unitstringWhen parent is present
plan.invoice_lead_daysintegerWhen parent is present
plan.is_activebooleanWhen parent is present
plan.merchant_idintegerWhen parent is present
plan.merchant_namestring | nullNo
plan.meta_dataobject | nullWhen parent is present
plan.past_due_grace_daysintegerWhen parent is present
plan.past_due_warnings_enabledbooleanWhen parent is present
plan.plan_descriptionstring | nullWhen parent is present
plan.plan_namestringWhen parent is present
plan.trial_amountnumber | nullWhen parent is present
plan.trial_notifications_enabledbooleanWhen parent is present
plan.trial_period_daysinteger | nullWhen parent is present
plan.uuidstringWhen parent is present
simulation_clock_idinteger | nullNo
simulation_clock_uuidstring | nullNo
statusstringYes
subscription_plan_idinteger | nullYes
trial_end_datestring | 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 pause_subscription_api_v2_payments_subscriptions__subscription_id__pause_post · contract digest cd0bbb4532452feec6b880fcc3d9190688618f7bcba1987cf518bc9107799cfe
POST/api/v2/payments/subscriptions/{subscription_id}/resume

Resume Subscription

Resume a paused subscription. Args: subscription_id: UUID of the subscription merchant_key: Merchant API key info Returns: SubscriptionResponse: Resumed subscription

Operation ID
resume_subscription_api_v2_payments_subscriptions__subscription_id__resume_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.subscription_idstringYespattern ^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$

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/subscriptions/${SUBSCRIPTION_ID}/resume" \
  --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: SubscriptionResponse.

FieldTypeRequiredConstraints and meaning
amountnumberYes
billing_cycle_countintegerYes
billing_typestringYes
cancellation_reasonstring | nullYes
cancelled_atstring | nullYes
created_atstringYes
currencystringYes
current_period_endstringYes
current_period_startstringYes
customerCustomerBasicInfo | nullNo
customer.emailstring | nullWhen parent is present
customer.idintegerWhen parent is present
customer.namestringWhen parent is present
customer.phonestringWhen parent is present
customer.uuidstring | nullNo
customer_idintegerYes
days_until_trial_endinteger | nullYes
Calculate days remaining in trial period
failed_payment_countintegerYes
idintegerYes
interval_countintegerYes
interval_unitstringYes
invoice_lead_daysintegerYes
is_in_trialbooleanYesread only
Check if subscription is currently in trial period
is_simulationbooleanYesread only
True when this subscription belongs to a simulation (test) clock.
merchant_idintegerYes
merchant_namestring | nullNo
meta_dataobject | nullYes
next_billing_datestringYes
planSubscriptionPlanResponse | nullNo
plan.amountnumberWhen parent is present
plan.billing_typestringWhen parent is present
plan.cancel_immediately_on_failurebooleanWhen parent is present
plan.created_atstringWhen parent is present
plan.currencystringWhen parent is present
plan.idintegerWhen parent is present
plan.interval_countintegerWhen parent is present
plan.interval_unitstringWhen parent is present
plan.invoice_lead_daysintegerWhen parent is present
plan.is_activebooleanWhen parent is present
plan.merchant_idintegerWhen parent is present
plan.merchant_namestring | nullNo
plan.meta_dataobject | nullWhen parent is present
plan.past_due_grace_daysintegerWhen parent is present
plan.past_due_warnings_enabledbooleanWhen parent is present
plan.plan_descriptionstring | nullWhen parent is present
plan.plan_namestringWhen parent is present
plan.trial_amountnumber | nullWhen parent is present
plan.trial_notifications_enabledbooleanWhen parent is present
plan.trial_period_daysinteger | nullWhen parent is present
plan.uuidstringWhen parent is present
simulation_clock_idinteger | nullNo
simulation_clock_uuidstring | nullNo
statusstringYes
subscription_plan_idinteger | nullYes
trial_end_datestring | 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 resume_subscription_api_v2_payments_subscriptions__subscription_id__resume_post · contract digest cd0bbb4532452feec6b880fcc3d9190688618f7bcba1987cf518bc9107799cfe
POST/api/v2/payments/subscriptions/{subscription_id}/cancel

Cancel Subscription

Cancel a subscription. Args: subscription_id: UUID of the subscription payload: Cancellation data (reason, cancel_at_period_end) merchant_key: Merchant API key info Returns: SubscriptionResponse: Cancelled subscription

Operation ID
cancel_subscription_api_v2_payments_subscriptions__subscription_id__cancel_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.subscription_idstringYespattern ^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$

Request body

Required application/json body using SubscriptionCancelRequest.

FieldTypeRequiredConstraints and meaning
cancel_at_period_endbooleanNodefault false
Cancel at end of current period
cancellation_reasonstring | nullNo
Reason for cancellation

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/subscriptions/${SUBSCRIPTION_ID}/cancel" \
  --header "X-Merchant-API-Key: $MONEYBAG_MERCHANT_KEY" \
  --header "Content-Type: application/json" \
  --data '{
    "cancel_at_period_end": false
  }'

Run this reviewed operation in the API Lab →

Responses

200 Successful Response

Content type: application/json. Schema: SubscriptionResponse.

FieldTypeRequiredConstraints and meaning
amountnumberYes
billing_cycle_countintegerYes
billing_typestringYes
cancellation_reasonstring | nullYes
cancelled_atstring | nullYes
created_atstringYes
currencystringYes
current_period_endstringYes
current_period_startstringYes
customerCustomerBasicInfo | nullNo
customer.emailstring | nullWhen parent is present
customer.idintegerWhen parent is present
customer.namestringWhen parent is present
customer.phonestringWhen parent is present
customer.uuidstring | nullNo
customer_idintegerYes
days_until_trial_endinteger | nullYes
Calculate days remaining in trial period
failed_payment_countintegerYes
idintegerYes
interval_countintegerYes
interval_unitstringYes
invoice_lead_daysintegerYes
is_in_trialbooleanYesread only
Check if subscription is currently in trial period
is_simulationbooleanYesread only
True when this subscription belongs to a simulation (test) clock.
merchant_idintegerYes
merchant_namestring | nullNo
meta_dataobject | nullYes
next_billing_datestringYes
planSubscriptionPlanResponse | nullNo
plan.amountnumberWhen parent is present
plan.billing_typestringWhen parent is present
plan.cancel_immediately_on_failurebooleanWhen parent is present
plan.created_atstringWhen parent is present
plan.currencystringWhen parent is present
plan.idintegerWhen parent is present
plan.interval_countintegerWhen parent is present
plan.interval_unitstringWhen parent is present
plan.invoice_lead_daysintegerWhen parent is present
plan.is_activebooleanWhen parent is present
plan.merchant_idintegerWhen parent is present
plan.merchant_namestring | nullNo
plan.meta_dataobject | nullWhen parent is present
plan.past_due_grace_daysintegerWhen parent is present
plan.past_due_warnings_enabledbooleanWhen parent is present
plan.plan_descriptionstring | nullWhen parent is present
plan.plan_namestringWhen parent is present
plan.trial_amountnumber | nullWhen parent is present
plan.trial_notifications_enabledbooleanWhen parent is present
plan.trial_period_daysinteger | nullWhen parent is present
plan.uuidstringWhen parent is present
simulation_clock_idinteger | nullNo
simulation_clock_uuidstring | nullNo
statusstringYes
subscription_plan_idinteger | nullYes
trial_end_datestring | 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 cancel_subscription_api_v2_payments_subscriptions__subscription_id__cancel_post · contract digest cd0bbb4532452feec6b880fcc3d9190688618f7bcba1987cf518bc9107799cfe

Billing and checkout

Billing history is paginated. Invoice generation returns the reviewed invoice detail schema, while subscription checkout returns the same public payment response envelope used by hosted checkout.

GET/api/v2/payments/subscriptions/{subscription_id}/billing-history

Get Subscription Billing History

Get billing history for a subscription. Args: subscription_id: UUID of the subscription merchant_key: Merchant API key info page: Page number per_page: Results per page Returns: dict: Paginated billing history

Operation ID
get_subscription_billing_history_api_v2_payments_subscriptions__subscription_id__billing_history_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.subscription_idstringYespattern ^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$
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/subscriptions/${SUBSCRIPTION_ID}/billing-history?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: PublicBillingHistoryListResponse.

FieldTypeRequiredConstraints and meaning
dataBillingHistoryResponse[]Yes
data[].amountnumberYes
data[].billing_datestringYes
data[].created_atstringYes
data[].currencystringYes
data[].failure_reasonstring | nullYes
data[].invoiceInvoiceBasicInfo | nullNo
data[].invoice.created_atstringWhen parent is present
data[].invoice.due_datestring | nullWhen parent is present
data[].invoice.invoice_idstringWhen parent is present
data[].invoice.invoice_statusstringWhen parent is present
data[].invoice.payable_amountnumberWhen parent is present
data[].invoice.uuidstringWhen parent is present
data[].next_retry_atstring | nullYes
data[].payment_session_idstring | nullYes
data[].retry_countintegerYes
data[].statusstringYes
data[].subscription_uuidstringYes
data[].transaction_idstring | 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 get_subscription_billing_history_api_v2_payments_subscriptions__subscription_id__billing_history_get · contract digest cd0bbb4532452feec6b880fcc3d9190688618f7bcba1987cf518bc9107799cfe
POST/api/v2/payments/subscriptions/{subscription_id}/generate-invoice

Generate Subscription Invoice

Manually generate an invoice for a subscription. This endpoint allows merchants to manually trigger invoice generation for a subscription. Useful when payment fails and you want to send a new invoice immediately instead of waiting for automatic retry. The invoice will be created with the current subscription amount and billing period, and an email will be automatically sent to the customer with payment link. Args: subscription_id: UUID of the subscription merchant_key: Merchant API key info Returns: InvoiceDetailsResponse: Created invoice details Raises: 400: If subscription is not in a valid state for billing 404: If subscription not found

Operation ID
generate_subscription_invoice_api_v2_payments_subscriptions__subscription_id__generate_invoice_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.subscription_idstringYespattern ^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$

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/subscriptions/${SUBSCRIPTION_ID}/generate-invoice" \
  --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: InvoiceDetailsResponse.

FieldTypeRequiredConstraints and meaning
all_totalnumberYes
business_namestringYes
customerobject | nullYes
due_datestring | nullYes
gross_discountnumberYes
invoice_idstringYes
invoice_itemsobject[]Yes
invoice_statusstringYes
invoice_typestring | nullNo
merchant_logostring | nullNo
payable_amountnumberYes
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 generate_subscription_invoice_api_v2_payments_subscriptions__subscription_id__generate_invoice_post · contract digest cd0bbb4532452feec6b880fcc3d9190688618f7bcba1987cf518bc9107799cfe
POST/api/v2/payments/subscriptions/{subscription_id}/checkout

Create Subscription Checkout

Create a checkout session for a subscription payment. This endpoint creates a direct payment checkout session for a subscription, allowing customers to pay for the subscription amount immediately. This is useful for: - Collecting payment when trial period ends - Resuming paused subscriptions with payment - Retrying failed payments with new checkout - Manual billing with direct customer payment The subscription must be in a valid state (ACTIVE, PAST_DUE, PAUSED, or TRIALING ending soon). A payment session will be created and the customer can complete payment via the checkout URL. Args: subscription_id: UUID of the subscription payload: Checkout configuration (redirect URLs, etc.) merchant_key: Merchant API key info Returns: CheckoutResponse: Checkout URL and session details Raises: 400: If subscription is not in a valid state for checkout 404: If subscription not found

Operation ID
create_subscription_checkout_api_v2_payments_subscriptions__subscription_id__checkout_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.subscription_idstringYespattern ^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$

Request body

Required application/json body using SubscriptionCheckoutRequest.

FieldTypeRequiredConstraints and meaning
cancel_urlstring | nullNomaximum length 500
Callback URL if user cancels (uses merchant config default if not provided)
fail_urlstring | nullNomaximum length 500
Callback URL if payment fails (uses merchant config default if not provided)
ipn_urlstring | nullNomaximum length 500
Instant Payment Notification URL (uses merchant config default if not provided)
metadataobject | nullNo
Additional checkout metadata
success_urlstring | nullNomaximum length 500
Callback URL after successful payment (uses merchant config default if not provided)

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/subscriptions/${SUBSCRIPTION_ID}/checkout" \
  --header "X-Merchant-API-Key: $MONEYBAG_MERCHANT_KEY" \
  --header "Content-Type: application/json" \
  --data '{}'

Run this reviewed operation in the API Lab →

Responses

200 Successful Response

Content type: application/json. Schema: PaymentResponses.

FieldTypeRequiredConstraints and meaning
dataCheckoutResponse | SessionResponse | ProcessResponse | VerificationResponse | InvoiceDetailsResponse | CancelResponse | CheckoutResponse | SessionResponse | ProcessResponse | VerificationResponse | InvoiceDetailsResponse | CancelResponse[] | nullNo
data<CheckoutResponse>.checkout_urlstringWhen parent is present
data<CheckoutResponse>.expires_atstringWhen parent is present
data<CheckoutResponse>.session_idstringWhen parent is present
data<SessionResponse>.bleedingbooleanNodefault false
Whether merchant pays service charges (bleeding)
data<SessionResponse>.business_namestring | nullNo
data<SessionResponse>.currencystringWhen parent is present
data<SessionResponse>.customerobject | nullNo
data<SessionResponse>.emi_checkout_idstring | nullNo
Selected EMI configuration UUID if pre-selected
data<SessionResponse>.emi_fee_bleedingbooleanNodefault false
Whether merchant pays EMI fees (emi_fee_bleeding)
data<SessionResponse>.emi_payment_optionsobject[] | nullNo
EMI payment options with calculations
data<SessionResponse>.expires_atstringWhen parent is present
data<SessionResponse>.merchant_logostring | nullNo
data<SessionResponse>.order_amountstringWhen parent is presentpattern ^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$
data<SessionResponse>.order_descriptionstring | nullNo
data<SessionResponse>.order_idstringWhen parent is present
data<SessionResponse>.payment_optionsobject[]When parent is present
data<SessionResponse>.requires_emibooleanNodefault false
Whether EMI payment options are available
data<SessionResponse>.selected_emi_configurationSelectedEMIConfiguration | nullNo
Selected EMI configuration with emi_configuration_id, service_id and service_uuid
data<SessionResponse>.selected_emi_configuration.emi_configuration_idstringWhen parent is present
Selected EMI configuration ID
data<SessionResponse>.selected_emi_configuration.payment_service_idinteger | string | nullNo
Deprecated alias of service_id, kept for backward compatibility
data<SessionResponse>.selected_emi_configuration.service_idinteger | nullNo
Internal merchant payment service id, matches payment_options[].service_id
data<SessionResponse>.selected_emi_configuration.service_uuidstring | nullNo
Public merchant payment service UUID, matches payment_options[].service_uuid
data<SessionResponse>.session_idstringWhen parent is present
data<SessionResponse>.statusstringWhen parent is present
data<ProcessResponse>.metaobject | nullNo
data<ProcessResponse>.redirect_urlstring | nullNoformat uri; minimum length 1
data<ProcessResponse>.transaction_idstringWhen parent is present
data<VerificationResponse>.amountstringWhen parent is presentpattern ^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$
data<VerificationResponse>.charge_amountstringWhen parent is presentpattern ^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$
data<VerificationResponse>.currencystringWhen parent is present
data<VerificationResponse>.customerCustomerWhen parent is present
data<VerificationResponse>.customer.addressstring | nullNo
Customer's address
data<VerificationResponse>.customer.citystring | nullNo
Customer's city
data<VerificationResponse>.customer.countrystring | nullNo
Customer's country
data<VerificationResponse>.customer.emailstringWhen parent is presentformat email
Customer's email address
data<VerificationResponse>.customer.metadataobject | nullNo
Additional customer-specific data
data<VerificationResponse>.customer.namestringWhen parent is present
Customer's full name
data<VerificationResponse>.customer.phonestringWhen parent is present
Customer's phone number
data<VerificationResponse>.customer.postcodestring | nullNo
Customer's postal code
data<VerificationResponse>.order_idstringWhen parent is present
data<VerificationResponse>.payment_methodstringWhen parent is present
data<VerificationResponse>.payment_reference_idstringWhen parent is present
data<VerificationResponse>.statusstringWhen parent is present
data<VerificationResponse>.transaction_idstringWhen parent is present
data<VerificationResponse>.verifiedbooleanWhen parent is present
data<InvoiceDetailsResponse>.all_totalnumberWhen parent is present
data<InvoiceDetailsResponse>.business_namestringWhen parent is present
data<InvoiceDetailsResponse>.customerobject | nullWhen parent is present
data<InvoiceDetailsResponse>.due_datestring | nullWhen parent is present
data<InvoiceDetailsResponse>.gross_discountnumberWhen parent is present
data<InvoiceDetailsResponse>.invoice_idstringWhen parent is present
data<InvoiceDetailsResponse>.invoice_itemsobject[]When parent is present
data<InvoiceDetailsResponse>.invoice_statusstringWhen parent is present
data<InvoiceDetailsResponse>.invoice_typestring | nullNo
data<InvoiceDetailsResponse>.merchant_logostring | nullNo
data<InvoiceDetailsResponse>.payable_amountnumberWhen parent is present
data<InvoiceDetailsResponse>.uuidstringWhen parent is present
data<CancelResponse>.order_idstringWhen parent is present
data<CancelResponse>.redirect_urlstringWhen parent is present
data<CancelResponse>.session_idstringWhen parent is present
data<CancelResponse>.statusstringNodefault "CANCELLED"
messagestring | nullNo
metaobject | nullNo
successbooleanYes

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_checkout_api_v2_payments_subscriptions__subscription_id__checkout_post · contract digest cd0bbb4532452feec6b880fcc3d9190688618f7bcba1987cf518bc9107799cfe