{"record":{"id":"dbdeff88f1b7c762","repo":"nopSolutions/nopCommerce","slug":"merchant-paypal-id-not-set","errorCode":null,"errorMessage":"Merchant PayPal ID not set","messagePattern":"Merchant PayPal ID not set","errorType":"exception","errorClass":"NopException","httpStatus":null,"severity":"critical","filePath":"src/Plugins/Nop.Plugin.Payments.PayPalCommerce/Services/PayPalCommerceServiceManager.cs","lineNumber":1635,"sourceCode":"    /// <param name=\"settings\">Plugin settings</param>\n    /// <param name=\"placement\">Button placement</param>\n    /// <param name=\"paymentSource\">Payment source</param>\n    /// <param name=\"cardId\">Saved card id</param>\n    /// <param name=\"saveCard\">Whether to save card payment token</param>\n    /// <returns>\n    /// A task that represents the asynchronous operation\n    /// The task result contains the created order; error message if exists\n    /// </returns>\n    public async Task<(Order Order, string Error)> CreateOrderAsync(PayPalCommerceSettings settings,\n        ButtonPlacement placement, string paymentSource, int? cardId, bool saveCard)\n    {\n        return await HandleFunctionAsync(async () =>\n        {\n            if (!IsConfigured(settings))\n                throw new NopException(\"Plugin not configured\");\n\n            if (string.IsNullOrEmpty(settings.MerchantId))\n                throw new NopException(\"Merchant PayPal ID not set\");\n\n            var details = await PrepareCartDetailsAsync(placement);\n\n            var savedPaymentToken = await _tokenService.GetByIdAsync(cardId ?? 0);\n            if (savedPaymentToken is not null && savedPaymentToken.CustomerId != details.Customer.Id)\n                throw new NopException(\"Card details not found\");\n\n            var isGuest = await _customerService.IsGuestAsync(details.Customer);\n            var isRecurring = await _shoppingCartService.ShoppingCartIsRecurringAsync(details.Cart);\n            if (isRecurring)\n            {\n                if (!settings.UseVault)\n                    throw new NopException(\"Vault disabled\");\n\n                if (isGuest)\n                    throw new NopException(\"Anonymous checkout disabled for recurring items\");\n\n                var (error, cycleLength, cyclePeriod, totalCycles) = await _shoppingCartService.GetRecurringCycleInfoAsync(details.Cart);","sourceCodeStart":1617,"sourceCodeEnd":1653,"githubUrl":"https://github.com/nopSolutions/nopCommerce/blob/64bdf2ff08c8b39e65717bcf974fb43dc2ef68f2/src/Plugins/Nop.Plugin.Payments.PayPalCommerce/Services/PayPalCommerceServiceManager.cs#L1617-L1653","documentation":"Thrown in CreateOrderAsync when settings.MerchantId is null or empty. The MerchantId is PayPal's identifier for the merchant account obtained during onboarding; without it, the order cannot be associated with the correct merchant for payment processing.","triggerScenarios":"CreateOrderAsync is called after IsConfigured passes (ClientId and SecretKey are set), but settings.MerchantId is null or empty — onboarding was partially completed.","commonSituations":"PayPal onboarding completed the credentials step but the merchant ID was not captured; the merchant's PayPal account was not fully set up for PayPal Commerce; onboarding was interrupted; the MerchantId setting was cleared or not persisted correctly.","solutions":["Re-run the PayPal onboarding flow to capture the MerchantId","Verify the PayPal account is fully approved for PayPal Commerce (not just sandbox)","Check that the onboarding callback successfully persists the MerchantId to plugin settings","Confirm the PayPal account is a business account with PayPal Commerce enabled"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Verify merchant ID is set before order creation\nif (PayPalCommerceServiceManager.IsConfigured(settings)\n    && string.IsNullOrEmpty(settings.MerchantId))\n{\n    _logger.Warning(\"PayPal Commerce MerchantId not set — onboarding incomplete\");\n    return Error(\"Merchant account not fully configured\");\n}","typeGuard":"static bool IsMerchantReady(PayPalCommerceSettings settings)\n    => PayPalCommerceServiceManager.IsConfigured(settings)\n       && !string.IsNullOrEmpty(settings.MerchantId);","tryCatchPattern":"var (order, error) = await manager.CreateOrderAsync(settings, placement, paymentSource, cardId, saveCard);\nif (!string.IsNullOrEmpty(error) && error == \"Merchant PayPal ID not set\")\n    return View(\"OnboardingRequired\");","preventionTips":["Complete the full PayPal onboarding flow including merchant ID capture","Verify MerchantId is persisted after onboarding by checking plugin settings","Do not deploy to production until IsConfigured AND MerchantId are both set"],"tags":["configuration","merchant-id","onboarding","paypal-commerce","nopcommerce"],"backgroundTag":null,"analyzedSha":"64bdf2ff08c8b39e65717bcf974fb43dc2ef68f2","analyzedAt":"2026-08-13T21:19:38.062Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}