Daraja.C2B.RegisterUrlRequest (daraja v0.1.0)

Copy Markdown View Source

Input struct for a C2B Register URL request.

Required fields: short_code, response_type, confirmation_url, validation_url.

response_type must be either "Completed" or "Cancelled" (sentence case). This determines what M-PESA does when the validation URL is unreachable:

  • "Completed" — M-PESA automatically completes the transaction.
  • "Cancelled" — M-PESA automatically cancels the transaction.

Summary

Types

t()

@type t() :: %Daraja.C2B.RegisterUrlRequest{
  confirmation_url: String.t(),
  response_type: String.t(),
  short_code: String.t(),
  validation_url: String.t()
}

Functions

new(params)

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