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

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

Link to this section Summary

Functions

This function initiates a mobile checkout request by sending a HTTP POST request to the Africa's talking Mobile Checkout endpoint.

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

mobile_checkout(attrs)

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

This function initiates a mobile checkout request by sending a HTTP POST request to the Africa's talking Mobile Checkout endpoint.

Config

Add stk_product_name key to your AtEx configs

Parameters

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

Example

  iex> AtEx.Gateway.Payments.Mobile.Checkout.mobile_checkout(%{phoneNumber: "254724540000", amount: 10, currencyCode: "KES"})
  {:ok,
  %{
      "description" => "Waiting for user input",
      "providerChannel" => "525900",
      "status" => "PendingConfirmation",
      "transactionId" => "ATPid_ca3ba091736bd8502afd4376a7519cf8"
  }
  }

Process results from calling the gateway