Sandbox · deterministic outcomes
Simulate payment outcomes
The public artifact contains three sandbox-only operations for completing a
checkout session with a success, failure, or cancellation outcome. Create the
checkout first and use its session_id with a sandbox merchant payment-service
identifier.
Simulate success
/api/v2/sandbox/payments/simulate/successSimulate a successful sandbox payment
- Operation ID
simulate_sandbox_payment_success_api_v2_sandbox_payments_simulate_success_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 SandboxPaymentProcessRequest.
| Field | Type | Required | Constraints and meaning |
|---|---|---|---|
payment_service_id | integer | string | Yes | — Merchant payment service UUID from merchant_payment_services. During the migration window the legacy integer service id is still accepted. |
session_id | string | Yes | — Payment session ID from checkout |
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/sandbox/payments/simulate/success" \
--header "X-Merchant-API-Key: $MONEYBAG_MERCHANT_KEY" \
--header "Content-Type: application/json" \
--data '{
"payment_service_id": "8f14e45f-ceea-467a-9575-9a1b2c3d4e5f",
"session_id": "ps_1234567890abcdef"
}'Run this reviewed operation in the API Lab →
Responses
200 Successful Response
Content type: application/json. Schema: SandboxPaymentProcessResponse.
| Field | Type | Required | Constraints and meaning |
|---|---|---|---|
data | SandboxPaymentProcessData | SandboxPaymentProcessData[] | null | No | — |
data<SandboxPaymentProcessData>.redirect_url | string | When parent is present | — URL to redirect for payment completion |
data<SandboxPaymentProcessData[]>[].redirect_url | string | When parent is present | — URL to redirect for payment completion |
message | string | null | No | — |
meta | object | null | No | — |
success | boolean | Yes | — |
422 Validation Error
Content type: application/json. Schema: HTTPValidationError.
| Field | Type | Required | Constraints and meaning |
|---|---|---|---|
detail | ValidationError[] | No | — |
detail[].loc | string | integer[] | When parent is present | — |
detail[].msg | string | When parent is present | — |
detail[].type | string | When parent is present | — |
Simulate failure
/api/v2/sandbox/payments/simulate/failSimulate a failed sandbox payment
- Operation ID
simulate_sandbox_payment_fail_api_v2_sandbox_payments_simulate_fail_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 SandboxPaymentFailRequest.
| Field | Type | Required | Constraints and meaning |
|---|---|---|---|
failure_reason | string | null | No | maximum length 500 Optional reason for failure |
payment_service_id | integer | string | Yes | — Merchant payment service UUID from merchant_payment_services. During the migration window the legacy integer service id is still accepted. |
session_id | string | Yes | — Payment session ID from checkout |
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/sandbox/payments/simulate/fail" \
--header "X-Merchant-API-Key: $MONEYBAG_MERCHANT_KEY" \
--header "Content-Type: application/json" \
--data '{
"failure_reason": "Insufficient funds",
"payment_service_id": "8f14e45f-ceea-467a-9575-9a1b2c3d4e5f",
"session_id": "ps_1234567890abcdef"
}'Run this reviewed operation in the API Lab →
Responses
200 Successful Response
Content type: application/json. Schema: SandboxPaymentFailResponse.
| Field | Type | Required | Constraints and meaning |
|---|---|---|---|
data | SandboxPaymentFailData | SandboxPaymentFailData[] | null | No | — |
data<SandboxPaymentFailData>.redirect_url | string | When parent is present | — URL to redirect after failure |
data<SandboxPaymentFailData>.transaction_id | string | null | No | — Associated transaction ID if created |
data<SandboxPaymentFailData[]>[].redirect_url | string | When parent is present | — URL to redirect after failure |
data<SandboxPaymentFailData[]>[].transaction_id | string | null | No | — Associated transaction ID if created |
message | string | null | No | — |
meta | object | null | No | — |
success | boolean | Yes | — |
422 Validation Error
Content type: application/json. Schema: HTTPValidationError.
| Field | Type | Required | Constraints and meaning |
|---|---|---|---|
detail | ValidationError[] | No | — |
detail[].loc | string | integer[] | When parent is present | — |
detail[].msg | string | When parent is present | — |
detail[].type | string | When parent is present | — |
Simulate cancellation
/api/v2/sandbox/payments/simulate/cancelSimulate a cancelled sandbox payment
- Operation ID
simulate_sandbox_payment_cancel_api_v2_sandbox_payments_simulate_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
No path or query parameters.
Request body
Required application/json body using SandboxPaymentCancelRequest.
| Field | Type | Required | Constraints and meaning |
|---|---|---|---|
cancellation_reason | string | null | No | maximum length 500 Optional reason for cancellation |
payment_service_id | integer | string | Yes | — Merchant payment service UUID from merchant_payment_services. During the migration window the legacy integer service id is still accepted. |
session_id | string | Yes | — Payment session ID from checkout |
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/sandbox/payments/simulate/cancel" \
--header "X-Merchant-API-Key: $MONEYBAG_MERCHANT_KEY" \
--header "Content-Type: application/json" \
--data '{
"cancellation_reason": "User cancelled payment",
"payment_service_id": "8f14e45f-ceea-467a-9575-9a1b2c3d4e5f",
"session_id": "ps_1234567890abcdef"
}'Run this reviewed operation in the API Lab →
Responses
200 Successful Response
Content type: application/json. Schema: SandboxPaymentCancelResponse.
| Field | Type | Required | Constraints and meaning |
|---|---|---|---|
data | SandboxPaymentCancelData | SandboxPaymentCancelData[] | null | No | — |
data<SandboxPaymentCancelData>.redirect_url | string | When parent is present | — URL to redirect after cancellation |
data<SandboxPaymentCancelData>.transaction_id | string | null | No | — Associated transaction ID if created |
data<SandboxPaymentCancelData[]>[].redirect_url | string | When parent is present | — URL to redirect after cancellation |
data<SandboxPaymentCancelData[]>[].transaction_id | string | null | No | — Associated transaction ID if created |
message | string | null | No | — |
meta | object | null | No | — |
success | boolean | Yes | — |
422 Validation Error
Content type: application/json. Schema: HTTPValidationError.
| Field | Type | Required | Constraints and meaning |
|---|---|---|---|
detail | ValidationError[] | No | — |
detail[].loc | string | integer[] | When parent is present | — |
detail[].msg | string | When parent is present | — |
detail[].type | string | When parent is present | — |