Creating bitcoin wallets for users node js is giving issues

Hello

What do i do here

Hi, can you please share the endpoint you are calling where you are getting this error ?

Sure

https://www.blockonomics.co/api/new_address

const blockonomicsCallbackUrl = ‘gifterracallback’;

const response = await axios.post(
  'https://www.blockonomics.co/api/new_address',
  {
    match_callback: blockonomicsCallbackUrl, 
  },
  {
    headers: {
      Authorization: `Bearer ${process.env.BLOCKONOMICS_API_KEY}`,
      'Content-Type': 'application/json',
    },
  }
);

const { address } = response.data;
1 Like

gifterracallback is the store name

Thanks for sharing the code. It looks like you are passing match_callback in request body instead of passing it as a parameter. As detailed in our docs, please try passing it as a parameter instead:

const response = await axios.post(
  `https://www.blockonomics.co/api/new_address?match_callback=${encodeURIComponent(blockonomicsCallbackUrl)}`,
  {}, // empty body since we're not sending data in the body
  {
    headers: {
      Authorization: `Bearer ${process.env.BLOCKONOMICS_API_KEY}`,
      'Content-Type': 'application/json',
    },
  }
);

const { address } = response.data;