Project

mockcard

0.0
The project is in a healthy, maintained state
Run MockCard's payment chaos scenarios (duplicate, late, missing and 3DS-abandoned webhooks, declines) against your webhook handler in CI, assert what your app did with Minitest or RSpec, and guard production against MockCard's monitoring probes. Standard library only.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies
 Project Readme

mockcard (Ruby)

Payment failure testing for Ruby. Run MockCard's chaos scenarios against your webhook handler in CI, assert what your app did, and guard production against MockCard's monitoring probes. Standard library only. Rails apps: add mockcard-rails for the middleware, credentials and generator.

Author: Arixeva Labs hello@arixevalabs.com · mockcard.io · MIT

gem "mockcard", group: :test

Chaos run (Minitest or RSpec)

include MockCard::Assertions

run = MockCard::Runner.run_chaos(MockCard::Client.new,
  project_id: "prj_…", target: "http://127.0.0.1:3000/webhooks/stripe",
  assertions: { "duplicate" => { "order fulfilled once" => ->(_ctx) { Order.paid.count == 1 } } })
assert_chaos_run_passed(run)

Works with the Pay gem: point target at Pay's webhook route.

Production probe guard

if MockCard::Probe.probe?(request.headers) && MockCard::Probe.verify(request.headers, request.raw_post, ENV["MOCKCARD_PROBE_SECRET"])
  response.set_header(MockCard::Probe::ACK_HEADER, "skipped")
  return head :ok
end

API reference: https://www.mockcard.io/openapi.yaml