{"record":{"id":"13cc88be381e6cd9","repo":"antiwork/gumroad","slug":"please-provide-a-price-for-the-default-payment-opt","errorCode":null,"errorMessage":"Please provide a price for the default payment option.","messagePattern":"Please provide a price for the default payment option\\.","errorType":"validation","errorClass":"Link::LinkInvalid","httpStatus":null,"severity":"error","filePath":"app/services/product/variant_category_updater_service.rb","lineNumber":602,"sourceCode":"            raise Link::LinkInvalid, \"Please provide suggested payment options.\"\n          end\n\n          # error if \"pay what you want\" enabled but suggested price is too low\n          variant[:recurrence_price_values].each do |recurrence, price_info|\n            if price_info[:suggested_price_cents].present? && (price_info[:price_cents].to_i > price_info[:suggested_price_cents].to_i)\n              errors.add(:base, \"The suggested price you entered was too low.\")\n              raise Link::LinkInvalid, \"The suggested price you entered was too low.\"\n            end\n          end\n        end\n\n        # error if missing pricing info for the product's default recurrence\n        if product.subscription_duration.present? && (\n          !variant[:recurrence_price_values][product.subscription_duration.to_s].present? ||\n          !variant[:recurrence_price_values][product.subscription_duration.to_s][:enabled]\n        )\n          errors.add(:base, \"Please provide a price for the default payment option.\")\n          raise Link::LinkInvalid, \"Please provide a price for the default payment option.\"\n        end\n      end\n\n      # error if variants have different recurrence options:\n      # 1. Extract variant recurrence selections:\n      # Ex. [[\"monthly\", \"yearly\"], [\"monthly\"]]\n      enabled_recurrences_for_variants = variants.map do |variant|\n        variant[:recurrence_price_values].select { |k, v| v[:enabled] }.keys.sort\n      end\n      # 2. Ensure that they match\n      # Ex. [\"monthly\", \"yearly\"] != [\"monthly\"] raises error\n      enabled_recurrences_for_variants.each_with_index do |recurrences, index|\n        next_recurrences = enabled_recurrences_for_variants[index + 1]\n        if next_recurrences && recurrences != next_recurrences\n          errors.add(:base, \"All tiers must have the same set of payment options.\")\n          raise Link::LinkInvalid, \"All tiers must have the same set of payment options.\"\n        end\n      end","sourceCodeStart":584,"sourceCodeEnd":620,"githubUrl":"https://github.com/antiwork/gumroad/blob/afeacbd394069a1cbf0c6c50ee8e900925050370/app/services/product/variant_category_updater_service.rb#L584-L620","documentation":"After the PWYW checks, every tier must carry an enabled price entry for the product's default recurrence (product.subscription_duration): the recurrence key must exist in recurrence_price_values and have enabled: true, otherwise Link::LinkInvalid. Tiered memberships bill on the product's default period, so every tier needs a price for it.","triggerScenarios":"Product default duration is 'monthly' but a tier only enables the 'yearly' option, or the monthly entry exists with enabled: false — the presence/enabled check fails and the save aborts.","commonSituations":"Switching a product's default billing period after tiers were configured; selectively disabling one period on one tier.","solutions":["Enable and price the product's default payment option on every tier (e.g. monthly when subscription_duration is monthly)","Or change the product's default recurrence to the period all tiers actually offer","Verify no tier has the default period toggled off in the editor's pricing grid"],"exampleFix":"# before\n# product.subscription_duration = 'monthly'\nrecurrence_price_values = { 'yearly' => { enabled: true, price_cents: 10_000 } }\n# => Link::LinkInvalid: Please provide a price for the default payment option.\n\n# after\nrecurrence_price_values = {\n  'monthly' => { enabled: true, price_cents: 1000 },\n  'yearly' => { enabled: true, price_cents: 10_000 }\n}","handlingStrategy":"validation","validationCode":"default = product.subscription_duration.to_s\nvariants.each do |v|\n  entry = v[:recurrence_price_values][default]\n  raise %(no price for default recurrence #{default}) if entry.blank? || !entry[:enabled]\nend","typeGuard":"def tier_priced_for_default_recurrence?(variant_params, default_duration)\n  entry = variant_params[:recurrence_price_values][default_duration.to_s]\n  entry.present? && entry[:enabled]\nend","tryCatchPattern":"begin\n  VariantCategoryUpdaterService.new(product:, category_params:).process\nrescue Link::LinkInvalid\n  render_edit_form_with(product.errors.full_messages)\nend","preventionTips":["When changing a product's default billing period, sweep every tier and enable/price that period","Keep the default recurrence's toggle on in each tier's pricing grid","Pair this check with the same-options check (255) — both must hold for tiered memberships"],"tags":["ruby","rails","membership","pricing","product-validation"],"backgroundTag":"missing-required-field","analyzedSha":"afeacbd394069a1cbf0c6c50ee8e900925050370","analyzedAt":"2026-08-21T17:58:52.159Z","schemaVersion":2},"datasetVersion":"2026-08-21T18:17:14.833Z"}