Skip to main content
Docs

Test helpers

Test helpers exist in test mode only; in live mode they answer 404 unrecognized_request_url. They need the test_helpers:write scope. Each helper calls the same services the portal and the engine use and is recorded on the test chain with an actor that shows it is a helper acting as a party. See Testing.

The base is https://holdyn-fb2e34c7cbae.herokuapp.com/api/v1/b2b. Every endpoint below lists who may call it.

At a glance#

Objects

TestClock

TestClock (example values)
{ "id": "clk_6543a1b2c3d4e5f6a7b8d000", "object": "test_clock", "livemode": false, "mandate": "man_6543a1b2c3d4e5f6a7b8cc00",
  "offset_seconds": 864000, "now": "2026-11-15T10:00:00.000Z",
  "history": [ { "by_seconds": 432000, "at": "2026-11-05T10:00:00.000Z", "actor": { "type": "api_key", "id": "key_6543a1b2c3d4e5f6a7b8cfc0" } } ] }

Endpoints

GET/test_helpers/mandates/:id/clock

Credential

Response

200 TestClock (id: null, offset_seconds: 0 when the mandate has no clock yet).

POST/test_helpers/mandates/:id/clock/advance

Credential

Request

exactly one of by_seconds integer (1 to 34,560,000 = 400 days) or to timestamp (> current mandate time, ≤ 400 days ahead). Forward only.

Response

200 {"object": "test_clock_advance_result", "clock": TestClock, "mandate": Mandate, "passes": 3, "actions": [{"type": "stage.auto_approved", "object": {"kind": "stage", "id": "stg_…"}, "summary": "…"}]} (after advancing, the helper runs the sub-sweeps for this mandate in virtual time, repeated until no work is left (at most 20 passes): triggers, pre-debit notices, grace/late/default, return-hold settlement, auto-approval reminders and expiry, invitation/setup expiry, not-before dates, cooling, new-payee hold, hold-limit alerts, dispute reminders, re-evaluations and execution).

Errors

400 parameter_invalid (backwards or > 400 days). · Records: test_clock.advanced · Events: test_clock.advanced (+ effects).

Notes

stored due times of a clocked mandate are virtual. Stripe's own clock does not move; test ACH settles instantly in Stripe; return-hold days run on the test clock.

POST/test_helpers/collections/:id/simulate

Credential

Request

outcome string required: succeeded (pm_usBankAccount_success), processing (pm_usBankAccount_processing), insufficient_funds, account_closed, no_account, debit_not_authorized, dispute (pm_usBankAccount_dispute), card_declined (pm_card_chargeDeclined), authentication_required (pm_card_authenticationRequired), weekly_limit_exceeded (pm_usBankAccount_weeklyLimitExceeded → category rail_limit), late_return (injected through the processor dispute handler with simulated: true; only on a succeeded/settled collection).

Response

200 Collection (a real test-mode attempt went through the normal engine; webhook-driven states follow within seconds).

Errors

409 invalid_state_transition (collection not attemptable or, for late_return, not succeeded). · Records: test.outcome_simulated + engine entries.

POST/test_helpers/refunds/:id/simulate

Credential

Request

outcome string required (failed_after_success: Stripe returns the refunded amount, as a closed account would,; failure_reason optional, default merchant_request).

Response

200 Refund (succeeded → failed through the same handler as a late refund.failed, simulated: true).

Errors

409 invalid_state_transition (the refund is not succeeded). · Records: test.outcome_simulated, refund.returned, recon.break_opened (refund_returned).

POST/test_helpers/processor-disputes/:id/close

Credential

Request

outcome string required (won, lost).

Response

200 ProcessorDispute (closed through the same handler as charge.dispute.closed, simulated: true).

Record and events

test.outcome_simulated, processor_dispute.closed, funds.unfrozen or funds.lost, mandate.hold_lifted.

POST/test_helpers/parties/:id/payment-methods

Credential

Request

type string required (us_bank_account, card); test_token string required (pm_usBankAccount_success, pm_usBankAccount_insufficientFunds, pm_usBankAccount_accountClosed, pm_usBankAccount_noAccount, pm_usBankAccount_debitNotAuthorized, pm_usBankAccount_dispute, pm_usBankAccount_processing, pm_usBankAccount_weeklyLimitExceeded, pm_card_visa, pm_card_chargeDeclined, pm_card_authenticationRequired); role string optional (primary default, backup); backup_consent_mandate string optional (man_; records a backup consent for a card); mandate string optional (man_: scope the method to that mandate when it uses on_behalf_of).

Response

201 PaymentMethod (active; created through a SetupIntent confirmed with the test method and offline mandate_data.customer_acceptance, storing the resulting stripe_mandate_id exactly like a real setup).

Errors

400 parameter_invalid (party not a payer). · Records: payer.customer_created (if needed), payer.payment_method_ready (+ payer.backup_consent_given) · Events: payment_method.ready.

POST/test_helpers/parties/:id/payee-onboarding-link

Credential

Response

200 OnboardingLink for the payee's TEST connected account (Stripe test onboarding accepts test data; a member may complete it).

Errors

409 invalid_state_transition (no connected account; call POST /parties/:id/payee-account first).

POST/test_helpers/mandates/:id/parties/:role/accept

Credential

Request

:role = payer or payee; body typed_name string optional (default the party display name).

Response

200 Mandate (accepts whatever version awaits that role: initial, amendment, cancellation, dispute settlement or reschedule; all consents recorded as given; acceptance method: test_helper).

Errors

409 nothing_to_accept. · Records: mandate.party_accepted (+ mandate.accepted, mandate.activated, … as they follow).

POST/test_helpers/mandates/:id/parties/:role/decline

Credential

Request

reason string optional. · Response: 200 Mandate. · Records: mandate.party_declined (or mandate.amendment_rejected).

POST/test_helpers/stages/:id/submit

- Acting as the payee. Request: note optional. · Response: 200 Stage. · Errors: 422 evidence_incomplete; 409 invalid_state_transition.

Credential

Record and events

stage.submitted.

POST/test_helpers/stages/:id/approve

- Acting as the payer. · Response: 200 Stage. · Errors: 409 invalid_state_transition, dispute_already_open. · Records: stage.approved (+ release).

Credential

POST/test_helpers/stages/:id/request-changes

- Acting as the payer. Request: reason string required. · Response: 200 Stage. · Errors: 409 change_request_limit_reached.

Credential

Record and events

stage.changes_requested.

POST/test_helpers/stages/:id/dispute

Credential

Request

acting_as string required (payer, payee); reason_code, description (20–4000) required.

Response

201 Dispute. · Errors: 409 dispute_already_open. · Records: dispute.opened, mandate.hold_placed.

POST/test_helpers/disputes/:id/proposals

Credential

Request

acting_as required; type required; release_amount, refund_amount as needed; schedule_changes, recollect optional.

Response

201 DisputeProposal. · Errors: 409 outcome_not_feasible. · Records: dispute.proposal_created.

POST/test_helpers/disputes/:id/proposals/:proposalId/accept

Credential

Request

acting_as required (the OTHER party). · Response: 200 Dispute (resolving). · Records: dispute.proposal_accepted, dispute.outcome_executing (a settlement version is accepted in the same step).

POST/test_helpers/disputes/:id/withdraw

- Acting as the raiser. · Response: 200 Dispute (withdrawn). · Records: dispute.withdrawn, mandate.hold_lifted.

Credential

POST/test_helpers/sandbox/seed

Credential

Request

template_key string required (an installed, published template); amount integer required; payer_email, payee_email optional (default: the caller's own email for a member, or the API key creator's; any other address only receives mail if it belongs to a member or a verified test recipient); notify_parties boolean optional (default false).

Response

201 {"object": "sandbox_seed_result", "mandate": Mandate, "payer": Party, "payee": Party, "payment_method": PaymentMethod, "grants": [IssuedGrant], "payee_onboarding_link": OnboardingLink}.

Errors

409 preset_not_installed, template_not_published, connection_missing.

Notes

test payer through a SetupIntent with pm_usBankAccount_success and offline mandate data, test Express payee, mandate created from the template and sent; a full Acme-style flow then runs in minutes with the clock and party helpers.

Test helpers · Holdyn Business docs