import { createClient } from '@ledewire/node'
const client = createClient({
apiKey: process.env.LEDEWIRE_API_KEY,
apiSecret: process.env.LEDEWIRE_API_SECRET,
})
import { createClient, ForbiddenError } from '@ledewire/node'
const client = createClient({
storage: {
getTokens: async () => JSON.parse((await redis.get('lw:tokens')) ?? 'null'),
setTokens: async (t) => redis.set('lw:tokens', JSON.stringify(t)),
clearTokens: async () => redis.del('lw:tokens'),
},
onAuthExpired: () => redirect('/login'),
})
const { tokens, stores } = await client.merchant.auth.loginWithEmailAndListStores({
email: 'owner@example.com',
password: process.env.MERCHANT_PASSWORD,
})
const storeId = stores[0].id
Creates a fully configured LedeWire Node.js client.