From 4aa0070e3d0ac672e514713eec5b8194ce4160b2 Mon Sep 17 00:00:00 2001 From: erio Date: Tue, 14 Apr 2026 11:31:44 +0800 Subject: [PATCH] fix: Stripe payment type matching in load balancer Checkout page aggregates Stripe sub-types (card,link,alipay,wxpay) under "stripe", but SelectInstance matched against supported_types literally, which doesn't contain "stripe". Now matches by provider_key for Stripe. --- backend/internal/payment/load_balancer.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/backend/internal/payment/load_balancer.go b/backend/internal/payment/load_balancer.go index 55cb2043..f0353173 100644 --- a/backend/internal/payment/load_balancer.go +++ b/backend/internal/payment/load_balancer.go @@ -117,7 +117,13 @@ func (lb *DefaultLoadBalancer) queryEnabledInstances( var matched []*dbent.PaymentProviderInstance for _, inst := range instances { - if InstanceSupportsType(inst.SupportedTypes, paymentType) { + // Stripe: match by provider_key because supported_types lists sub-types (card,link,alipay,wxpay), + // not "stripe" itself. The checkout page aggregates all sub-types under "stripe". + if paymentType == TypeStripe { + if inst.ProviderKey == TypeStripe { + matched = append(matched, inst) + } + } else if InstanceSupportsType(inst.SupportedTypes, paymentType) { matched = append(matched, inst) } }