Skip to main content

Claude/ChatGPT Prompt to Design a Payment Processing System

Design a marketplace payment system with idempotency keys, a payment state machine, verified webhooks, and reconciliation.

Füllen Sie die Platzhalter aus

Edit the values, then copy your finished prompt.

Ihr Prompt
prompt.txt

                                

What this prompt does

This prompt has the AI design a payment processing system tightly enough to build, with concrete contracts rather than vague intent. You set the [product_type], the [provider], the [currencies], and the [compliance_scope]. It returns an idempotency-key API design with a dedupe storage model, a per-payment state machine with legal transitions, provider webhook handling with signature verification and retry/backoff, reconciliation that flags drift across currencies, compliance minimisation via tokenization, and fraud hooks plus an immutable audit trail.

The structure works because payments are where a missing idempotency key turns a retry into a real double-charge and a chargeback. Forcing the state machine to be explicit catches impossible transitions, and treating the provider as the source of truth makes reconciliation reliable. [provider] shapes the webhook verification and reconciliation, [currencies] widens the reconciliation scope, [compliance_scope] drives what data never touches your servers, and [product_type] frames the audit trail.

When to use it

  • You're designing billing or checkout and want double-charges structurally impossible.
  • You need an explicit payment state machine with only legal transitions.
  • You're integrating a provider's webhooks and need signature verification and retries.
  • You want reconciliation that compares your records against the provider and flags drift.
  • You must minimise compliance exposure by keeping card data off your servers.
  • You need an immutable audit trail and fraud hooks designed in.

Example output

You get the design with the state diagram, the webhook flow, and the idempotency contract: an API using idempotency keys so retries never double-charge, with the dedupe storage model; a per-payment state machine (created, authorized, captured, failed, refunded) and its legal transitions; webhook handling for [provider] covering signature verification, retry/backoff, and out-of-order delivery; reconciliation comparing internal records against [provider] and flagging drift across [currencies]; [compliance_scope] minimisation via tokenization and what never touches your servers; and fraud hooks plus observability and an immutable audit trail for [product_type].

Pro tips

  • Treat the [provider] as the source of truth and reconcile relentlessly; your internal records can drift, so the reconciliation step is what catches it across [currencies].
  • Make the idempotency key contract explicit, including the dedupe storage model, since a missing key turns an innocent retry into a real double-charge.
  • Force the state machine to enumerate legal transitions only — listing the impossible ones (like captured back to created) catches bugs before they reach production.
  • Always verify the webhook signature for [provider] and handle out-of-order delivery, because webhooks arrive late, duplicated, and occasionally spoofed.
  • Use [compliance_scope] to push card data to the provider via tokenization so it never touches your servers, shrinking what you must secure and audit.
  • Keep the audit trail immutable; for a [product_type] like a marketplace, an append-only record is what lets you resolve disputes after the fact.

Frequently Asked Questions

How does it prevent double-charging on retries?
Through idempotency keys with an explicit dedupe storage model, so a retried request with the same key is recognized and not charged again. This is critical because, without it, a client or network retry can turn one intended charge into two and trigger a chargeback.
What states does the payment state machine cover?
It models created, authorized, captured, failed, and refunded, with the legal transitions between them. Enumerating only valid transitions and rejecting impossible ones, like captured back to created, catches a whole class of bugs before they reach production.
How are provider webhooks handled safely?
Deliverable 3 covers signature verification, retry with backoff, and out-of-order delivery for your `[provider]`. Verifying the signature is essential because webhooks can be spoofed, and handling out-of-order and duplicate events matters since providers do not guarantee perfect delivery.
Does it keep card data off my servers for compliance?
Yes. The `[compliance_scope]` deliverable uses tokenization so sensitive card data goes to the provider and never touches your servers. That minimisation shrinks the surface you must secure and audit, which is the practical way to reduce PCI-DSS exposure.
Why does it reconcile against the provider?
Because the provider is the source of truth and your internal records can drift through missed webhooks or failures. Reconciliation compares both sides across `[currencies]` and flags discrepancies, so money movement that your system recorded incorrectly gets caught rather than silently lost.
Engr Mejba Ahmed

Need this built for real?

Engr Mejba Ahmed

AI Developer · Software Engineer

I'm Mejba — I design and ship production AI systems, automations, and full-stack apps. If you want this turned into a working solution for your team, let's talk.

Mehr in System Design Prompts

Engr Mejba Ahmed

Engr Mejba Ahmed

Claude Code Expert · Online

👋

Hey there!

Quick Actions

WhatsApp Instant reply

Chat on WhatsApp

+880 1723 741224 · Instant reply

Popular Questions

Engr Mejba Ahmed is connected
Engr Mejba Ahmed is typing...
Engr Mejba Ahmed avatar

✉ Want me to follow up? Drop your email

Engr Mejba Ahmed avatar

📞 Connect Directly

Choose how you'd like to reach me

WhatsApp

+880 1723 741224

Email

[email protected]

✓ Details sent! I'll get back to you shortly.

Powered by OpenAI

335+

Blog Posts

25

AI Courses

63

Projects

Services & Expertise

Pricing & Process

Learning & Resources

Connect & Support