Unified Interface
One API across Stripe, PayPal, and Razorpay
gopay is a unified payment-processing library for Go — provider-agnostic types, sentinel errors, and a mock provider for tests. Each provider ships as its own Go module, so importing one never pulls in the SDKs of the others.
go get github.com/KARTIKrocks/gopayOne API across Stripe, PayPal, and Razorpay
Each provider is its own Go module — only pull in the SDKs you use
Create, capture (automatic or manual), get, and cancel
Full and partial refund processing
Create and manage customers (Stripe, Razorpay)
Attach and manage saved payment methods
Save a card for later, off-session charges (Stripe)
Plans and recurring billing (Stripe, Razorpay)
Read-only invoice retrieval with hosted invoice URLs
Signature-verified, normalized events across providers
A consistent List/paginate pattern across providers
A full-featured in-memory provider for tests — no network
Calling a payment provider's SDK directly gets you a working integration with exactly one provider. Everything past that — the parts that turn "I can charge a card with Stripe" into "I can swap in Razorpay for a region without rewriting my checkout code" — is what gopay provides.
| Capability |
|---|
| One interface across Stripe, PayPal, and Razorpay |
| Sentinel errors (errors.Is) instead of per-SDK error types |
| Builder + Validate() requests catch mistakes before the API call |
| Cursor-based pagination, normalized across providers |
| Webhook signature verification + normalized event kinds |
| Mock provider for tests — no network, no API keys |
| Dependency isolation — only the SDKs you actually use |
Providers only implement what they support — PayPal's Orders API has no customer or list endpoint, and only Stripe implements setup intents. See the docs for provider-specific quirks.
| Provider | Payments | Refunds | Customers | Payment Methods | Setup Intents | Subscriptions | Invoices | Webhooks | Listing |
|---|---|---|---|---|---|---|---|---|---|
| Stripe | Supported | Supported | Supported | Supported | Supported | Supported | Supported | Supported | Supported |
| PayPal | Supported | Supported | Not supported | Not supported | Not supported | Not supported | Not supported | Supported | Not supported |
| Razorpay | Supported | Supported | Supported | Not supported | Not supported | Supported | Supported | Supported | Supported |