Verified against: Public OpenAPI 2.0.0

Hosted payments

Create a checkout

Create checkout from your backend, then redirect the customer to Moneybag's hosted payment experience.

POST/api/v2/payments/checkout
Create a merchant-scoped sandbox checkout.

Generate and persist a unique order_id before calling Moneybag. The reference below is rendered from the reviewed public artifact, including nested customer, shipping, line-item, metadata, and EMI fields.

Rendering diagram…
The merchant backend creates and verifies checkout. The browser only follows hosted redirects and never receives the merchant API key.
Text alternative

The merchant backend creates and verifies checkout. The browser only follows hosted redirects and never receives the merchant API key.

Do not fulfill from the customer redirect. Continue with payment verification.

API reference

POST/api/v2/payments/checkout

Checkout

Checkout API This endpoint initiates the payment process for a merchant order. It creates a payment session, processes the initial payment request, and returns a redirect URL to the payment gateway. The merchant must provide a valid API key in the X-Merchant-API-Key header. Args: order_req: Order request data merchant_key: Merchant API key info Returns: CheckoutResponse: Response with checkout details and redirect URL Raises: HTTPException: For any validation or processing errors

Operation ID
checkout_api_v2_payments_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

No path or query parameters.

Request body

Required application/json body using OrderRequest.

FieldTypeRequiredConstraints and meaning
cancel_urlstringYesmaximum length 255
Callback URL if user cancels the transaction
currencystringYes
Three-letter currency code (e.g., BDT, USD, EUR)
customerCustomerYes
customer.addressstring | nullNo
Customer's address
customer.citystring | nullNo
Customer's city
customer.countrystring | nullNo
Customer's country
customer.emailstringYesformat email
Customer's email address
customer.metadataobject | nullNo
Additional customer-specific data
customer.namestringYes
Customer's full name
customer.phonestringYes
Customer's phone number
customer.postcodestring | nullNo
Customer's postal code
fail_urlstringYesmaximum length 255
Callback URL if payment failure occurs
ipn_urlstring | nullNo
Instant Payment Notification URL
metadataobject | nullNo
Additional order-specific data
order_amountnumber | stringYespattern ^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$
Transaction amount between 10.00 and 1000000.00 BDT
order_descriptionstringYesmaximum length 255
Description of the order
order_idstringYesminimum length 10; maximum length 36
Unique transaction ID to identify your order
order_itemsOrderItem[] | nullNo
List of items in the order
order_items[].convenience_feenumber | string | nullNopattern ^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$
Convenience fee (decimal value)
order_items[].discount_amountnumber | string | nullNopattern ^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$
Discount amount (decimal value)
order_items[].metadataobject | nullNo
Additional product-specific data
order_items[].net_amountnumber | string | nullNopattern ^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$
Net amount after adding VAT and fees, subtracting discounts
order_items[].product_categorystring | nullNomaximum length 100
Product category (e.g., Electronic, topup)
order_items[].product_namestring | nullNomaximum length 255
Product name
order_items[].quantityinteger | nullNo
Product quantity
order_items[].skustring | nullNo
Product SKU
order_items[].unit_pricenumber | string | nullNopattern ^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$
Unit price of the product
order_items[].vatnumber | string | nullNopattern ^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$
VAT amount (decimal value)
payment_infoPaymentInfo | nullNo
Payment-related information
payment_info.currency_conversionbooleanNodefault false
Whether currency conversion is applied
payment_info.emi_configuration_idstring | nullNo
Selected EMI configuration ID (if customer selected specific EMI option)
payment_info.emi_payment_idinteger | string | nullNo
Selected merchant payment service for EMI payment. Accepts the public UUID or, during the migration window, the legacy integer service id.
payment_info.requires_emibooleanNodefault false
Whether EMI payment options should be shown
shippingShipping | nullNo
Shipping information
shipping.addressstringWhen parent is present
Shipping address line 1
shipping.citystringWhen parent is present
Shipping city
shipping.countrystringWhen parent is present
Shipping country
shipping.metadataobject | nullNo
Additional shipping-specific data
shipping.namestringWhen parent is present
Shipping recipient's full name
shipping.postcodestringWhen parent is present
Shipping postal code
shipping.statestring | nullNo
Shipping state/province
success_urlstringYesmaximum length 255
Callback URL after successful payment

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/checkout" \
  --header "X-Merchant-API-Key: $MONEYBAG_MERCHANT_KEY" \
  --header "Content-Type: application/json" \
  --data '{
    "cancel_url": "https://example.com/payment/cancel",
    "currency": "BDT",
    "customer": {
      "address": "123 Main Street",
      "city": "Dhaka",
      "country": "Bangladesh",
      "email": "john.doe@example.com",
      "metadata": {
        "customer_id": "CUST12345",
        "loyalty_level": "gold"
      },
      "name": "John Doe",
      "phone": "+8801700000000",
      "postcode": "1000"
    },
    "fail_url": "https://example.com/payment/fail",
    "ipn_url": "https://example.com/payment/ipn",
    "metadata": {
      "ip_address": "192.168.1.1",
      "platform": "web",
      "session_id": "SESSION12345",
      "source": "web",
      "user_agent": "Mozilla/5.0"
    },
    "order_amount": "1280.00",
    "order_description": "Online purchase of electronics",
    "order_id": "TXN12345678",
    "order_items": [
      {
        "convenience_fee": "80.00",
        "discount_amount": "100.00",
        "net_amount": "1300.00",
        "product_category": "Electronic",
        "product_name": "iPhone 15",
        "quantity": 1,
        "sku": "PROD001",
        "unit_price": "1200.00",
        "vat": "120.00"
      },
      {
        "convenience_fee": "0",
        "discount_amount": "0",
        "net_amount": "1650.00",
        "product_category": "Electronic",
        "product_name": "iPhone 15 Pro",
        "quantity": 1,
        "sku": "PROD002",
        "unit_price": "1500.00",
        "vat": "150.00"
      }
    ],
    "payment_info": {
      "currency_conversion": false,
      "requires_emi": false
    },
    "shipping": {
      "address": "123 Main Street",
      "city": "Dhaka",
      "country": "Bangladesh",
      "name": "John Doe",
      "postcode": "1000"
    },
    "success_url": "https://example.com/payment/success"
  }'

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