1. Docs
  2. Api
  3. Authentication

Authentication

Learn how to authenticate your requests to the ACOD Cash on Delivery API. We use API keys to authenticate requests for custom Shopify integrations.

Getting Your API Key

You can get your API key from your ACOD Cash on Delivery dashboard. Go to Settings > API Integration to generate a new key for your Shopify store.

Important

Keep your API key secure and never share it publicly. If your key is compromised, you can revoke it and generate a new one at any time from your ACOD dashboard.

Using Your API Key

Include your API key in the Authorization header of your requests:

curl https://api.acod.app/v1/fees \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "X-Shopify-Shop-Domain: your-store.myshopify.com"

API Key Best Practices

  • Never expose your API key in client-side Shopify code
  • Use environment variables or Shopify private app credentials to store your API key
  • Rotate your API keys every few months for security
  • Use different API keys for development and production Shopify stores

Rate Limiting

API requests are rate limited to ensure fair usage. The current limits are:

  • 500 requests per minute for standard plans
  • 2000 requests per minute for premium plans
  • Custom limits for enterprise Shopify merchants

Example Implementation

// Example using fetch to calculate COD fees
async function calculateCodFee(cart, customerInfo) {
  const response = await fetch('https://api.acod.app/v1/calculate-fee', {
    method: 'POST',
    headers: {
      'Authorization': `Bearer ${process.env.ACOD_API_KEY}`,
      'X-Shopify-Shop-Domain': 'your-store.myshopify.com',
      'Content-Type': 'application/json',
    },
    body: JSON.stringify({
      cart_total: cart.total_price,
      currency: cart.currency,
      shipping_address: customerInfo.shipping_address,
      shipping_method: cart.shipping_method,
      items: cart.items
    }),
  });
  
  const data = await response.json();
  return data.cod_fee;
}

Need help?

If you have questions about integrating COD fees with your Shopify checkout, check out our API troubleshooting guide or API endpoints documentation.