Portfolio project — SAMA-inspired architecture

A payment gateway
built from scratch

Paygate abstracts Stripe and Checkout.com behind a unified API — one integration for Visa, Mastercard, Apple Pay, and Mada. Built with Rails 8, PostgreSQL, Redis, and Sidekiq.

Supported payment methods

Visa

via Stripe

Mastercard

via Stripe

Apple Pay

via Stripe

Mada

via Checkout.com

Built for real production

Every subsystem you would find in an actual payment gateway.

Idempotent by default

Every charge mutation requires an Idempotency-Key. Retry safely without risk of double-billing.

Async webhook delivery

Outbound webhooks are dispatched via Sidekiq with exponential backoff (5m → 30m → 2h → 24h) across 5 attempts, signed with HMAC-SHA256.

Double-entry ledger

Every financial state change creates a corresponding LedgerEntry. Full audit trail with no mutable records.

Smart routing

PaymentRouterService uses Strategy pattern to automatically route charges to the right provider based on payment method.

API key management

Sandbox and live key pairs. Secret keys are bcrypt-hashed at rest, shown once, and revocable at any time.

Partitioned charges table

Monthly RANGE partitions on created_at with automated partition creation via PartitionManagerJob.

Ready to integrate?

Register a sandbox account and process your first payment in under five minutes.

Start for free