Skip to main content
Version: 0.8

Stripe

github.com/KARTIKrocks/gopay/stripe is the most complete provider — it implements every optional interface gopay defines.

import (
payment "github.com/KARTIKrocks/gopay"
"github.com/KARTIKrocks/gopay/stripe"
)

config := stripe.DefaultConfig().
WithSecretKey("sk_test_...")

provider, err := stripe.NewProvider(config)
if err != nil {
log.Fatal(err)
}

client, err := payment.NewClient(provider)

NewProvider returns payment.ErrInvalidConfig if SecretKey is empty.

Config

FieldSet viaNotes
SecretKeyWithSecretKeyRequired
WebhookSecretWithWebhookSecretRequired to call VerifyWebhook
HTTPClientWithHTTPClientOptional, for custom timeouts/transport

Support matrix

CapabilitySupported
Payments, Refunds
Customers
Payment Methods
Setup Intents✓ — the only provider that does
Subscriptions✓ (open-ended — TotalCount is ignored)
Invoices
Webhooks✓ (Stripe-Signature header)
Listing✓ (cursor = object ID, starting_after)

Notes

  • CaptureMethod maps directly onto Stripe's own manual/automatic capture on a PaymentIntent.
  • Subscriptions are open-ended by default — Stripe ignores SubscriptionRequest.TotalCount (see Subscriptions for how this differs from Razorpay).
  • Payment.Raw, Refund.Raw, etc. carry the full Stripe API response as map[string]any for anything not surfaced on the normalized struct.