GoCardless Scenario Simulators API — Sandbox only.
Simulate specific payment lifecycle outcomes for testing without needing real bank interactions. Use these to build and verify your webhook handlers and reconciliation logic before going live.
Available scenarios
Payment scenarios
"payment_paid_out"— payment moves to paid_out"payment_failed"— payment fails"payment_charged_back"— payment is charged back"payment_late_failure"— payment fails late (after confirmation)"payment_customer_approval_granted"— customer approves payment"payment_customer_approval_denied"— customer denies payment
Mandate scenarios
"mandate_activated"— mandate becomes active"mandate_customer_approval_granted"— customer approves mandate"mandate_customer_approval_skipped"— approval step skipped"mandate_failed"— mandate fails"mandate_cancelled"— mandate is cancelled"mandate_transferred"— mandate transferred to new bank account"mandate_expired"— mandate expires
Payout scenarios
"payout_paid"— payout is marked as paid
Refund scenarios
"refund_paid"— refund is paid to customer
Billing request scenarios
"billing_request_fulfilled"— billing request is fulfilled"billing_request_bank_authorisation_authorised"— bank auth completed"billing_request_bank_authorisation_denied"— bank auth denied"billing_request_bank_authorisation_expired"— bank auth expired
Example
# Simulate a payment being paid out
{:ok, _} = GoCardlessClient.Resources.ScenarioSimulators.run(
client,
"payment_paid_out",
%{links: %{payment: "PM123"}}
)
# Simulate a mandate failure
{:ok, _} = GoCardlessClient.Resources.ScenarioSimulators.run(
client,
"mandate_failed",
%{links: %{mandate: "MD456"}}
)
Summary
Functions
Runs a scenario simulation against a specific resource.
Returns a list of all valid scenario type strings.
Functions
@spec run(GoCardlessClient.Client.t(), String.t(), map(), keyword()) :: {:ok, map() | nil} | {:error, GoCardlessClient.APIError.t() | GoCardlessClient.Error.t()}
Runs a scenario simulation against a specific resource.
Params
Supply exactly one link matching the scenario type:
links.payment— for payment scenarioslinks.mandate— for mandate scenarioslinks.payout— for payout scenarioslinks.refund— for refund scenarioslinks.billing_request— for billing request scenarioslinks.subscription— for subscription scenarioslinks.instalment_schedule— for instalment schedule scenarios
Raises
Raises ArgumentError if an unknown scenario type is provided.
@spec valid_scenarios() :: [String.t()]
Returns a list of all valid scenario type strings.