Currencylayer · Capability

Ecommerce Multi Currency Pricing

Run with Naftiko

Capability Spec

ecommerce-multi-currency-pricing.yaml Raw ↑
apiVersion: capability.naftiko.dev/v1alpha1
kind: Capability
metadata:
  name: ecommerce-multi-currency-pricing
  provider: currencylayer
  description: |
    Localize storefront prices in the shopper's currency at page-render or
    checkout time. Caches /live quotes per source currency and falls back to
    /convert for one-off pair lookups.
spec:
  uses:
    - sharedCapability: currencylayer-shared
      operations: [getLive, convertCurrency, listCurrencies]
  preconditions:
    - description: Storefront base currency configured (typically USD or EUR).
    - description: Caller subscription on Basic or above for HTTPS, source-switching, and /convert.
  workflow:
    - step: warmSymbolCache
      operation: listCurrencies
      purpose: Cache the full currency catalog (24h+ TTL).
    - step: refreshLiveQuotes
      operation: getLive
      parameters:
        source: "{{ input.storeCurrency | default: 'USD' }}"
        currencies: "{{ input.targetCurrencies }}"
      cache:
        ttl: "{{ plan.refreshCadence }}"
    - step: convertCartItem
      when: input.mode == 'on-demand'
      operation: convertCurrency
      parameters:
        from: "{{ input.from }}"
        to: "{{ input.to }}"
        amount: "{{ input.amount }}"
  outputs:
    quotes: "{{ refreshLiveQuotes.quotes }}"
    convertedAmount: "{{ convertCartItem.result }}"
  governance:
    minPlan: Basic
    httpsRequired: true
    cachingRequired: true
    notes: |
      Currencylayer charges per request, so storefronts should cache /live
      results for at least the plan's refresh cadence (60 min on Basic, 10 min
      on Professional, 60 sec on Enterprise+) to avoid quota burn.