Sending Payments

Learn how to build scalable Payments applications using the Elarian customer engagement framework.

Sending payments from your business to a customer

Elarian wallets allow you to model various payment interactions, here are some supported variations while sending payments to customers on amobile platforms.

  1. From wallet on Elarian to mobile money platform
  2. From purse on Elarian to mobile money platform
  3. From purse on Elarian to wallet on Elarian

From wallet on Elarian to mobile money platform

const customer = new client.Customer({
    number: 'YOUR-CUSTOMERS-PHONE-NUMBER',
    provider: 'cellular'
});

const { customerId } = await customer.getState();

const resp = await client.initiatePayment(
  {
    customerId,
    walletId: 'CUSTOMER-WALLET-ID'
  },
  {
    customerNumber: customer.customerNumber,
    channelNumber: {
      number: 'YOUR-MOBILE-MONEY-PLATFORM-BUSINESS-NUMBER',
      channel: 'cellular'
    }
  },
  {
    amount: 1000,
    currencyCode: 'KES'
  }
);

console.log(resp);

From purse on Elarian to mobile money platform

...

const resp = await client.initiatePayment(
  {
    purseId: 'BUSINESS-PURSE-ID'
  },
  {
    customerNumber: customer.customerNumber,
    channelNumber: {
      number: 'YOUR-MOBILE-MONEY-PLATFORM-BUSINESS-NUMBER',
      channel: 'cellular'
    }
  },
  {
    amount: 1000,
    currencyCode: 'KES'
  }
);

console.log(resp);

From purse on Elarian to wallet on Elarian

...

const resp = await client.initiatePayment(
  {
    purseId: 'BUSINESS-PURSE-ID'
  },
  {
    customerId,
    walletId: 'CUSTOMER-WALLET-ID'
  },
  {
    amount: 1000,
    currencyCode: 'KES'
  }
);

console.log(resp);

Sending payments from your business to another business

  1. From wallet on Elarian to another wallet on Elarian
  2. From purse on Elarian to another purse on Elarian

From wallet on Elarian to another wallet on Elarian

const resp = await client.initiatePayment(
  {
    customerId,
    walletId: 'SRC-CUSTOMER-WALLET-ID'
  },
  {
    customerId,
    walletId: 'DEST-CUSTOMER-WALLET-ID'
  },
  {
    amount: 1000,
    currencyCode: 'KES'
  }
);

console.log(resp);

From purse on Elarian to another purse on Elarian

const resp = await client.initiatePayment(
  {
    purseId: 'SRC-BUSINESS-PURSE-ID'
  },
  {
    customerId,
    walletId: 'DEST-BUSINESS-PURSE-ID'
  },
  {
    amount: 1000,
    currencyCode: 'KES'
  }
);

console.log(resp);