Daraja.C2B.SimulateRequest (daraja v0.1.0)

Copy Markdown View Source

Input struct for a C2B Simulate transaction request (sandbox only).

Required fields: short_code, command_id, amount, msisdn. Optional fields: bill_ref_number.

command_id must be either:

  • "CustomerPayBillOnline" — payment to a Paybill number.
  • "CustomerBuyGoodsOnline" — payment to a Till number.

bill_ref_number is the account reference for Paybill payments. It should be nil for Till number payments (CustomerBuyGoodsOnline).

Summary

Types

t()

@type t() :: %Daraja.C2B.SimulateRequest{
  amount: pos_integer(),
  bill_ref_number: String.t() | nil,
  command_id: String.t(),
  msisdn: String.t(),
  short_code: String.t()
}

Functions

new(params)

@spec new(map()) ::
  {:ok, t()} | {:error, :invalid_request, [atom() | {:command_id, String.t()}]}