diff --git a/.env.local.default b/.env.local.default index 7f58be0..0142792 100644 --- a/.env.local.default +++ b/.env.local.default @@ -1,8 +1,8 @@ -# ~~~ +NEXT_PUBLIC_COINBASE_COMMERCE_API_KEY="COMMERCE_API_KEY_1234567890" + NEXT_PUBLIC_GOOGLE_ANALYTICS_ID=GA_TEST_1234567890 # See https://www.coinbase.com/developer-platform/products/base-node NEXT_PUBLIC_CDP_API_KEY="CDP_API_KEY_1234567890" -# ~~~ NEXT_PUBLIC_ENVIRONMENT=localhost diff --git a/.env.test b/.env.test index 7f58be0..0142792 100644 --- a/.env.test +++ b/.env.test @@ -1,8 +1,8 @@ -# ~~~ +NEXT_PUBLIC_COINBASE_COMMERCE_API_KEY="COMMERCE_API_KEY_1234567890" + NEXT_PUBLIC_GOOGLE_ANALYTICS_ID=GA_TEST_1234567890 # See https://www.coinbase.com/developer-platform/products/base-node NEXT_PUBLIC_CDP_API_KEY="CDP_API_KEY_1234567890" -# ~~~ NEXT_PUBLIC_ENVIRONMENT=localhost diff --git a/src/components/OnchainStoreCart.tsx b/src/components/OnchainStoreCart.tsx index 2a1a920..1bee1a5 100644 --- a/src/components/OnchainStoreCart.tsx +++ b/src/components/OnchainStoreCart.tsx @@ -33,12 +33,14 @@ export default function OnchainStoreCart() { description, pricing_type: 'fixed_price', local_price: { - amount: totalSum.toString(), + // NOTE: set to 0 for simulation purposes, + // replace with totalSum.toString() in real app + amount: '0', currency: 'USD', }, }; return createCharge(chargeDetails); - }, [createCharge, quantities, totalSum]); + }, [createCharge, quantities]); return (
@@ -56,7 +58,8 @@ export default function OnchainStoreCart() {
diff --git a/src/hooks/useCreateCharge.ts b/src/hooks/useCreateCharge.ts index bac10ef..c421cd6 100644 --- a/src/hooks/useCreateCharge.ts +++ b/src/hooks/useCreateCharge.ts @@ -1,7 +1,6 @@ import { useCallback } from 'react'; import { COINBASE_COMMERCE_API_KEY } from 'src/config'; - -const COMMERCE_API_URL = 'https://api.commerce.coinbase.com'; +import { COMMERCE_API_URL } from 'src/links'; type Price = { amount: string; @@ -16,7 +15,6 @@ export type ChargeDetails = { const useCreateCharge = () => { const createCharge = useCallback(async (chargeDetails: ChargeDetails) => { - console.log({ chargeDetails }); try { const res = await fetch(`${COMMERCE_API_URL}/charges`, { method: 'POST', diff --git a/src/links.ts b/src/links.ts index 821bfde..2221c28 100644 --- a/src/links.ts +++ b/src/links.ts @@ -1,3 +1,4 @@ +export const COMMERCE_API_URL = 'https://api.commerce.coinbase.com'; export const DISCORD_LINK = 'https://discord.gg/wTJ7besU'; export const FIGMA_LINK = 'https://www.figma.com/community/file/1370194397345450683/onchainkit';