AtEx v0.20.21 AtEx.Gateway.Payments.Mobile.B2b View Source

This module holds the implementation for the HTTP Gateway that runs calls against the Africas Talking Mobile B2B API

Link to this section Summary

Functions

Mobile Business To Business (B2B) APIs allow you to send payments to businesses e.g banks from your Payment Wallet.

Process results from calling the gateway

Link to this section Types

Link to this type

option()

View Source
option() ::
  {:method, Tesla.Env.method()}
  | {:url, Tesla.Env.url()}
  | {:query, Tesla.Env.query()}
  | {:headers, Tesla.Env.headers()}
  | {:body, Tesla.Env.body()}
  | {:opts, Tesla.Env.opts()}

Link to this section Functions

Link to this function

b2b_checkout(attrs)

View Source
b2b_checkout(map()) :: {:ok, term()} | {:error, term()}

Mobile Business To Business (B2B) APIs allow you to send payments to businesses e.g banks from your Payment Wallet.

Config

Add b2b_product_name key to the AtEx config values

Parameters

attrs: - a map containing a provider(Mpesa,TigoTanzania,Athena), transferType(BusinessBuyGoods,BusinessPayBill, DisburseFundsToBusiness, BusinessToBusinessTransfer), currencyCode amount, destinationChannel, destinationAccount and a map of metadata see the docs at https://build.at-labs.io/docs/payments%2Fmobile%2Fb2b for how to use these keys

Example

  iex>AtEx.Gateway.Payments.Mobile.B2b.b2b_checkout(%{provider: "Athena", transferType: "DisburseFundsToBusiness", amount: 10, currencyCode: "KES", destinationChannel: "Mine", destinationAccount: "Mine", metadata: %{ message: "I am here"}})
  {:ok,
  %{
  "providerChannel" => "525900",
  "status" => "Queued",
  "transactionFee" => "KES 0.1000",
  "transactionId" => "ATPid_2504d5f5d28256fa264e815518e3ab0d"
  }}

Process results from calling the gateway