Payment Gateway Pattern
PaymentGatewayInterface, registration flow, and active gateway config keys
Last updated: Feb 09, 2026
Payment Gateway Pattern
Payment gateways implement Cartxis\Core\Contracts\PaymentGatewayInterface:
interface PaymentGatewayInterface
{
public function getCode(): string;
public function getName(): string;
public function supports(string $paymentMethod): bool;
public function processPayment(Order $order, array $data = []);
public function handleCallback(array $data): array;
public function verifyPayment(Order $order): bool;
public function refund(Order $order, ?float $amount = null, ?string $reason = null): array;
public function getConfigFields(): array;
public function isConfigured(): bool;
}
Registration Flow
- Gateway package implements
PaymentGatewayInterfacein its Service class. - Gateway's
ServiceProvider::boot()registers itself withPaymentGatewayManager:
$gatewayManager = app('vortex.payment.gateway');
$gatewayManager->register(new StripeGateway());
- Gateway seeds a record into the
payment_methodstable. - Gateway checks
extension.jsonactive status before booting.
Active Payment Gateways
| Gateway | Config Keys |
|---|---|
| Stripe | STRIPE_KEY, STRIPE_SECRET, STRIPE_WEBHOOK_SECRET |
| RazorPay | RAZORPAY_KEY, RAZORPAY_SECRET |
| PayPal | PAYPAL_CLIENT_ID, PAYPAL_SECRET |
| PayUMoney | PAYU_MERCHANT_KEY, PAYU_SALT |
| PhonePe | PHONEPE_MERCHANT_ID, PHONEPE_SALT_KEY |
