Skip to main content
Version: Lab (preview)

Sandbox

Sandbox-only GraphQL mutations for triggering test events in lab environments.

Sandbox Only

These mutations only work with sandbox API keys (paytheorylab or paytheorystudy).


Create Sandbox ACH Return​

Use this mutation to create an ACH return for a completed ACH transaction.

mutation CreateSandboxAchReturn($input: CreateSandboxAchReturnInput!) {
createSandboxAchReturn(input: $input) {
success
ach_return_transaction_id
return_code
}
}

Parameters

Keytypedescription
inputCreateSandboxAchReturnInputThe ACH return request details.

CreateSandboxAchReturnInput

Keytypedescription
transaction_idString!The ACH transaction ID to return.
return_codeAchReturnCode!The ACH return code (for example, R01, R02, R03).

Returns

{
"data": {
"createSandboxAchReturn": {
"success": true,
"ach_return_transaction_id": "pt_txn_return_123",
"return_code": "R01"
}
}
}
Keytypedescription
successBooleanWhether the return was created successfully.
ach_return_transaction_idStringThe transaction ID of the ACH return.
return_codeStringThe ACH return code used.
ACH return codes

Use standard ACH return codes from the AchReturnCode enum (R01-R85). Common test codes include R01 (insufficient funds) and R02 (account closed).


Create Sandbox Dispute​

Use this mutation to create a dispute for a card transaction.

mutation CreateSandboxDispute($input: CreateSandboxDisputeInput!) {
createSandboxDispute(input: $input) {
success
dispute_id
transaction_id
}
}

Parameters

Keytypedescription
inputCreateSandboxDisputeInputThe dispute creation details.

CreateSandboxDisputeInput

Keytypedescription
transaction_idString!The card transaction ID to dispute.
reasonDisputeReason!The dispute reason. See Dispute Reason.

Returns

{
"data": {
"createSandboxDispute": {
"success": true,
"dispute_id": "pt_disp_123",
"transaction_id": "pt_txn_123"
}
}
}
Keytypedescription
successBooleanWhether the dispute was created successfully.
dispute_idStringThe Pay Theory dispute identifier.
transaction_idStringThe transaction ID that is now in dispute.

Update Sandbox Dispute Status​

Use this mutation to move a dispute through its lifecycle.

mutation UpdateSandboxDisputeStatus($input: UpdateSandboxDisputeStatusInput!) {
updateSandboxDisputeStatus(input: $input) {
success
}
}

Parameters

Keytypedescription
inputUpdateSandboxDisputeStatusInputThe dispute status update details.

UpdateSandboxDisputeStatusInput

Keytypedescription
dispute_idString!The Pay Theory dispute identifier.
statusDisputeStatus!The new dispute status. See Dispute Status.

Returns

{
"data": {
"updateSandboxDisputeStatus": {
"success": true
}
}
}
Keytypedescription
successBooleanWhether the dispute status update succeeded.
Status transitions

Supported transitions are INQUIRY to PENDING, and PENDING to WON or LOST. WON and LOST are terminal states.


Prepare Sandbox Settlement Batch​

Prepare a settlement batch to lock in line items and calculate totals for a merchant.

mutation PrepareSandboxSettlementBatch($input: PrepareSandboxSettlementBatchInput!) {
prepareSandboxSettlementBatch(input: $input) {
success
prep_id
merchant_uid
debit_ids
reversal_ids
ach_return_ids
dispute_withdrawal_ids
dispute_deposit_ids
split_ids
calculated_gross_amount
calculated_net_amount
instructional_hold_balance
reserve_balance
}
}

Parameters

Keytypedescription
inputPrepareSandboxSettlementBatchInputThe batch prep details.

PrepareSandboxSettlementBatchInput

Keytypedescription
merchant_uidID!The Pay Theory unique identifier for the merchant.

Returns

{
"data": {
"prepareSandboxSettlementBatch": {
"success": true,
"prep_id": "prep_123",
"merchant_uid": "mer_123",
"calculated_gross_amount": 250000,
"calculated_net_amount": 240000
}
}
}
Keytypedescription
successBooleanWhether the prep record was created.
prep_idIDThe prep record identifier for the settlement batch.
merchant_uidIDThe Pay Theory unique identifier for the merchant.
debit_ids[String]Debit transaction IDs included in the batch.
reversal_ids[String]Reversal transaction IDs included in the batch.
ach_return_ids[String]ACH return transaction IDs included in the batch.
dispute_withdrawal_ids[String]Dispute IDs for withdrawals included in the batch.
dispute_deposit_ids[String]Dispute IDs for deposits included in the batch.
split_ids[String]Split IDs included in the batch.
calculated_gross_amountIntCalculated gross amount in cents.
calculated_net_amountIntCalculated net amount in cents.
instructional_hold_balanceIntCurrent instructional hold balance in cents, if available.
reserve_balanceIntCurrent reserve balance in cents, if available.

Create Sandbox Settlement​

Create a settlement from a prepared sandbox batch.

mutation CreateSandboxSettlement($input: CreateSandboxSettlementInput!) {
createSandboxSettlement(input: $input) {
success
}
}

Parameters

Keytypedescription
inputCreateSandboxSettlementInputThe settlement creation details.

CreateSandboxSettlementInput

Keytypedescription
merchant_uidID!The Pay Theory unique identifier for the merchant.

Returns

{
"data": {
"createSandboxSettlement": {
"success": true
}
}
}
Keytypedescription
successBooleanWhether the settlement was created.
Typical flow

Run prepareSandboxSettlementBatch first, then createSandboxSettlement to generate a full settlement in sandbox.