View Source AtEx.Gateway.Payments.Mobile.B2c (AtEx v0.20.23)

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

Summary

Functions

This function initiates a mobile B2C request by making a HTTP POST request to the Africa's talking Mobile B2C endpoint.

Process results from calling the gateway

Functions

@spec b2c_checkout(list()) :: {:ok, term()} | {:error, term()}

This function initiates a mobile B2C request by making a HTTP POST request to the Africa's talking Mobile B2C endpoint.

Config

Add b2c_product_name key to your AtEx configs

Parameters

attrs: - a list of Recipient each a map containing a phoneNumber, currencyCode, amount and a map of metadata key optionally it may also contain name, reason and providerChannel see the docs at https://build.at-labs.io/docs/payments%2Fmobile%2Fb2c%2Foverview for how to use these keys

Example

  iex>AtEx.Gateway.Payments.Mobile.B2c.b2c_checkout([%{phoneNumber: "254724540000", amount: 10, currencyCode: "KES", metadata: %{ message: "I am here"}}])
  {:ok,
  %{
  "entries" => [
      %{
      "phoneNumber" => "+254724540000",
      "provider" => "Athena",
      "providerChannel" => "525900",
      "status" => "Queued",
      "transactionFee" => "KES 0.1000",
      "transactionId" => "ATPid_beeb0be6b1bff57ec8f32675fe3f6e72",
      "value" => "KES 10.0000"
      }
  ],
  "numQueued" => 1,
  "totalTransactionFee" => "KES 0.1000",
  "totalValue" => "KES 10.0000"
  }}

Process results from calling the gateway