{"record":{"id":"d12ba63780bab901","repo":"antiwork/gumroad","slug":"the-creator-has-disabled-gifting-for-their-product","errorCode":null,"errorMessage":"The creator has disabled gifting for their products.","messagePattern":"The creator has disabled gifting for their products\\.","errorType":"exception","errorClass":"Purchase::PurchaseInvalid","httpStatus":null,"severity":"error","filePath":"app/services/purchase/create_service.rb","lineNumber":341,"sourceCode":"    def create_gift\n      # A seller buying their own product can only ever be a test purchase, and test purchases were\n      # never built for gifts, so this case has to be rejected. The message names what the seller\n      # actually did and points at the supported way to give a product away, because the old wording\n      # (\"Test gift purchases have not been enabled yet.\") described an internal capability and read\n      # as a flag we could switch on for them, which generated support tickets asking us to do that.\n      raise Purchase::PurchaseInvalid, \"You can't gift your own product. To give it away for free, create a 100% off discount code under Checkout > Discounts and share the checkout link.\" if buyer == product.user\n      raise Purchase::PurchaseInvalid, \"You cannot gift a product to yourself. Please try gifting to another email.\" if giftee_email == purchase_params[:email]\n      raise Purchase::PurchaseInvalid, \"Gift purchases cannot be on installment plans.\" if params[:pay_in_installments]\n\n      if product.can_gift?\n        gift = product.gifts.build(giftee_email:, gift_note: gift_params[:gift_note], gifter_email: params[:purchase][:email], is_recipient_hidden: gift_params[:giftee_email].blank?)\n        error_message = gift.save ? nil : gift.errors.full_messages[0]\n        raise Purchase::PurchaseInvalid, error_message if error_message.present?\n\n        gift\n      else\n        error_message = product.user.gifting_disabled? ? \"The creator has disabled gifting for their products.\" : \"Gifting is not yet enabled for pre-orders.\"\n        raise Purchase::PurchaseInvalid, error_message\n      end\n    end\n\n    def validate_perceived_price\n      if purchase_params[:perceived_price_cents] && !Purchase::MAX_PRICE_RANGE.cover?(purchase_params[:perceived_price_cents])\n        raise Purchase::PurchaseInvalid, \"Purchase price is invalid. Please check the price.\"\n      end\n    end\n\n    def validate_zip_code\n      country_code_for_validation = purchase_params[:country].presence || purchase_params[:sales_tax_country_code_election]\n\n      if purchase_params[:perceived_price_cents].to_i > 0 && country_code_for_validation == Compliance::Countries::USA.alpha2 && UsZipCodes.identify_state_code(purchase_params[:zip_code]).nil?\n        Rails.logger.info(\"Zip code #{purchase_params[:zip_code]} is invalid, customer email #{purchase_params[:email]}\")\n        raise Purchase::PurchaseInvalid, \"You entered a ZIP Code that doesn't exist within your country.\"\n      end\n    end\n","sourceCodeStart":323,"sourceCodeEnd":359,"githubUrl":"https://github.com/antiwork/gumroad/blob/afeacbd394069a1cbf0c6c50ee8e900925050370/app/services/purchase/create_service.rb#L323-L359","documentation":"product.can_gift? returned false and the reason is the seller-side opt-out: user.gifting_disabled? is a checkout-settings flag that removes 'Give as a gift' for all of a seller's products. create_gift surfaces it as 'The creator has disabled gifting for their products.' so the buyer knows it is the seller's choice, not a bug.","triggerScenarios":"params[:gift] present, product.can_gift? false (link.rb:899 - !is_in_preorder_state && !user.gifting_disabled?), and product.user.gifting_disabled? true.","commonSituations":"Buyer uses a stale checkout page from before the seller disabled gifting; deep links to the gift flow on a seller who has opted out.","solutions":["Complete a normal, non-gift purchase instead - the buyer cannot work around the opt-out.","Seller: re-enable gifting under checkout settings.","Integrators: check seller.gifting_disabled? before rendering the gift option."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"params.delete(:gift) if params[:gift].present? && product.user.gifting_disabled?","typeGuard":"def gifting_available?(product)\n  product.can_gift? && !product.user.gifting_disabled?\nend","tryCatchPattern":"begin\n  Purchase::CreateService.new(product:, params:, buyer:).perform\nrescue Purchase::PurchaseInvalid => e\n  # seller-side setting; nothing the buyer can fix - fall back to a normal purchase\n  params.delete(:gift) if e.message == 'The creator has disabled gifting for their products.'\nend","preventionTips":["Check seller.gifting_disabled? before rendering the gift option.","Remember the flag is seller-wide: it disables gifting for every product the seller owns, not just one."],"tags":["gifting","seller-settings","checkout","gumroad"],"backgroundTag":"gifting-not-allowed","analyzedSha":"afeacbd394069a1cbf0c6c50ee8e900925050370","analyzedAt":"2026-08-21T17:58:52.159Z","schemaVersion":2},"datasetVersion":"2026-08-21T18:17:14.833Z"}