Question:
Shipping in Iceland
Hi every one,
I have issue with how to get my Shipping in Iceland, with api key.
I could do it manual in wix dashboard but Iceland is not in there list of Country
What are you trying to achieve:
I need to have give my costumers 2 chooses and I cant do that manual like I would like my costumers to see
Are you using a 3rd party shipping service and coding a solution in Velo?
No I’m using the Wix dashboard, but I can’t find out how to put my api key into velo code.
You will have to use → Wix-Secrets and you → WILL NOT WANT ← to put your API-Key directly into your code!
Instead you → WILL WANT ← to put your → API-KEY ← into the Wix-Secrets-Area, a special area where you can store all your API and other SECRETS!
I put my api key in the secret vault but I have no idea what code I use in the backend of my cart to let this work
import { Permissions, webMethod } from 'wix-web-module';
import wixSecretsBackend from 'wix-secrets-backend';
import { getJSON } from 'wix-fetch';
export const getSomeJSON = webMethod(Permissions.Anyone, () => {
return wixSecretsBackend.getSecret("myApiKeyName")
.then((secret) => {
return getJSON(`https://someapi.com/api/someendpoint?apiKey=${secret}`);
})
.catch((error) => {
console.error(error);
});
});
export const getFirstSecretValue = webMethod(Permissions.Anyone, () => {
return wixSecretsBackend.listSecretInfo()
.then((secrets) => {
return wixSecretsBackend.getSecret(secrets[0].name);
})
.catch((error) => {
console.error(error);
});
});import { Permissions, webMethod } from 'wix-web-module';
import wixSecretsBackend from 'wix-secrets-backend';
import { getJSON } from 'wix-fetch';
export const getSomeJSON = webMethod(Permissions.Anyone, () => {
return wixSecretsBackend.getSecret("myApiKeyName")
.then((secret) => {
return getJSON(`https://someapi.com/api/someendpoint?apiKey=${secret}`);
})
.catch((error) => {
console.error(error);
});
});
export const getFirstSecretValue = webMethod(Permissions.Anyone, () => {
return wixSecretsBackend.listSecretInfo()
.then((secrets) => {
return wixSecretsBackend.getSecret(secrets[0].name);
})
.catch((error) => {
console.error(error);
});
});
Is this API key from a third party provider? Where did it come from?
Yes it is from postoffice in Iceland that every ones use for shiping in Iceland. I know that shopify and woo have this opinions at least the post office have it as a choose witch one you use