Testing
Test mode is a full copy of the product on Stripe's test environment. No real money moves. Everything in this guide exists in test mode only; in live mode the helpers answer 404 unrecognized_request_url.
What is different in test mode#
- Money moves on your test Stripe connection.
- Emails to parties reach only your team and verified test recipients. Others are captured and listed at
GET /notifications?status=captured_test. Add a test recipient in Developers; they must confirm their address by opening a link, which cannot be confirmed by a mail scanner because it needs a click. - The record is separate from live, and receipts verify as a "Test record".
- Test helpers need the
test_helpers:writescope, which only test keys can carry.
Helpers act as the parties#
Each helper calls the same services the portal uses and is recorded on the test chain with an actor that shows it was a helper acting as a payer or payee.
| To test | Call |
|---|---|
| Give a payer a ready bank account | POST /test_helpers/parties/:id/payment-methods with type and a test_token such as pm_usBankAccount_success |
| Make a payee ready | POST /test_helpers/parties/:id/payee-onboarding-link |
| Accept the terms | POST /test_helpers/mandates/:id/parties/payer/accept, then /payee/accept |
| Decline | POST /test_helpers/mandates/:id/parties/:role/decline |
| Submit a stage as the payee | POST /test_helpers/stages/:id/submit |
| Approve a stage as the payer | POST /test_helpers/stages/:id/approve |
| Ask for changes | POST /test_helpers/stages/:id/request-changes |
| Raise a dispute | POST /test_helpers/stages/:id/dispute |
| Propose and accept an outcome | POST /test_helpers/disputes/:id/proposals, then /proposals/:proposalId/accept |
| Withdraw a dispute | POST /test_helpers/disputes/:id/withdraw |
Simulating money outcomes#
POST /test_helpers/collections/:id/simulate runs a real test-mode attempt with a chosen outcome:
| Outcome | What it exercises |
|---|---|
succeeded | A bank debit that succeeds. |
processing | A bank debit still in flight. |
insufficient_funds | A return code that is retried, then the backup card if the payer agreed. |
account_closed, no_account | An unusable account: no retry. |
debit_not_authorized | The payer disputed authority: no retry and no automatic backup. |
dispute | A bank dispute, which freezes the funds. |
card_declined, authentication_required | Card failures. |
weekly_limit_exceeded | A rail limit: no late clock. |
late_return | A return that arrives after success. |
Other helpers: POST /test_helpers/refunds/:id/simulate (failed_after_success) and POST /test_helpers/processor-disputes/:id/close (won or lost).
The test clock#
Holdyn's time rules (triggers, notices, grace days, automatic approval, the return hold, expiries) can be moved forward for one mandate:
curl https://holdyn-fb2e34c7cbae.herokuapp.com/api/v1/b2b/test_helpers/mandates/man_…/clock/advance \
-H "Authorization: Bearer $HOLDYN_API_KEY" \
-H "Idempotency-Key: $(uuidgen)" \
-H "Content-Type: application/json" \
-d '{ "by_seconds": 432000 }'Send exactly one of by_seconds (1 to 34,560,000, which is 400 days) or to (a later timestamp). It only moves forward. After advancing, the helper runs the sweeps for that mandate in virtual time until there is no work left, and the response lists the actions that happened, such as stage.auto_approved. Stripe's own clock does not move; test bank debits settle at once in Stripe, and the return-hold days run on the test clock.
Seed everything at once#
POST /test_helpers/sandbox/seed takes a template_key (an installed, published template) and an amount. It creates a payer with a ready bank account, a test payee, a mandate from the template that has been sent, and links, then returns all of them. Parties only receive email if the address belongs to a member or a verified test recipient.
Webhooks in test mode#
Create a test webhook endpoint and use POST /webhook-endpoints/:id/test to send a signed test.ping. Every state change you cause with the helpers produces its normal event. See Webhooks.
Reference: Test helpers.
