diff --git a/packages/donate-button-v4/src/components/widget/context/NonprofitContext.tsx b/packages/donate-button-v4/src/components/widget/context/NonprofitContext.tsx index c07d92c4..fd59c510 100644 --- a/packages/donate-button-v4/src/components/widget/context/NonprofitContext.tsx +++ b/packages/donate-button-v4/src/components/widget/context/NonprofitContext.tsx @@ -62,11 +62,18 @@ export const NonprofitContextProvider: FunctionalComponent<{ } } - try { - const customizationResponse = await getCustomization(response.id, code); - setCustomization(customizationResponse); - } catch { - setCustomization(DonateFlowCustomizationFetchError); + if (code) { + try { + const customizationResponse = await getCustomization( + response.id, + code + ); + setCustomization(customizationResponse); + } catch { + setCustomization(DonateFlowCustomizationFetchError); + } + } else { + setCustomization(undefined); } } catch { setNonprofit(NonprofitFetchError);