INNER CODE UNIT · Go
resolveProduct
theopenlane/core · cmd/catalog/main.go:315
func resolveProduct(ctx context.Context, sc *entitlements.StripeClient, prodMap map[string]*stripe.Product, feat catalog.Feature) (*stripe.Product, error) {
// try to discover product via price IDs
for _, p := range feat.Billing.Prices {
if p.PriceID == "" {
continue
}
pr, err := sc.GetPrice(ctx, p.PriceID)
if err == nil && pr != nil && pr.Product != nil {
return sc.GetProductByID(ctx, pr.Product.ID)
}
}
// next try lookup keys
for _, p := range feat.Billing.Prices {
if p.LookupKey == "" {
continue
}