Problem
The method in the provider interface doesn't receive customer details (email, name), but many payment gateways require this information to initialize a transaction.
Currently, the method signature is:
createSubscriptionCheckout(data: {
providerCustomerId: string;
providerPriceId: string;
successUrl: string;
cancelUrl?: string;
metadata?: Record<string, string>;
}): Promise<{ paymentUrl: string; providerCheckoutSessionId: string }>;
Why This Matters
Payment gateways often require customer details to:
- Display customer information on the checkout page
- Send payment confirmation emails
- Meet compliance and KYC requirements
- Prevent fraud by validating customer identity
Current Workarounds
Provider implementers are forced to use workarounds:
- Store customer data in provider config (architecturally incorrect - config should be app-level, not per-customer)
- Fetch from application database (wrong layer - provider adapter shouldn't know about app's DB)
- Use placeholder values (causes API errors)
- Make fields optional (may violate gateway requirements)
Proposed Solution
Add customer details to the createSubscriptionCheckout interface:
createSubscriptionCheckout(data: {
providerCustomerId: string;
providerPriceId: string;
successUrl: string;
cancelUrl?: string;
metadata?: Record<string, string>;
customer?: {
email?: string;
firstName?: string;
lastName?: string;
};
}): Promise<{ paymentUrl: string; providerCheckoutSessionId string }>;
This allows providers to pass customer information when the gateway requires it, while keeping it optional for gateways that don't need it.
Benefits
- Cleaner architecture - no need for workarounds
- Better support for gateway-specific requirements
- Consistent with how other provider methods handle customer data
- Backward compatible (fields are optional)
I'm happy to help I can implement this change and open a PR if you agree.
Problem
The method in the provider interface doesn't receive customer details (email, name), but many payment gateways require this information to initialize a transaction.
Currently, the method signature is:
Why This Matters
Payment gateways often require customer details to:
Current Workarounds
Provider implementers are forced to use workarounds:
Proposed Solution
Add customer details to the createSubscriptionCheckout interface:
This allows providers to pass customer information when the gateway requires it, while keeping it optional for gateways that don't need it.
Benefits
I'm happy to help I can implement this change and open a PR if you agree.