Skip to content

PaymentCallback & Status ​

PaymentCallback ​

Returned by every gateway's handleCallback() (and AYA's verifyRedirect()) once the signature is verified. A final class with read-only properties.

Property / MethodTypeDescription
orderIdstringYour order ID
statusPaymentStatusThe status mapped onto this package's statuses
gatewayStatusstringThe gateway's own status value, unmapped
gatewayReference?stringThe gateway's ID for the payment
amount?stringThe amount the gateway reports, exactly as it sent it
rawarrayThe verified payload, with JSON numbers kept as strings, never float
acknowledgementAcknowledgementThe response the gateway expects
isSuccessful()boolstatus === PaymentStatus::Successful

Build one yourself to test your own fulfillment code, with named arguments: new PaymentCallback(orderId: ..., status: ..., gatewayStatus: ..., gatewayReference: null, amount: null, raw: [], acknowledgement: Acknowledgement::default()).

Acknowledgement ​

A final class in Laranex\PhpMyanmarPayments\Http with read-only properties; new Acknowledgement(status: ..., body: ..., headers: ...) builds one, each argument optional.

Property / MethodTypeDescription
statusintHTTP status, 200 by default
bodystringResponse body, e.g. KBZ Pay's success; empty by default
headersarray<string, string>Response headers, ['Content-Type' => 'text/plain'] by default
send()voidWrites the status, headers and body with http_response_code(), header() and echo

Acknowledgement::default() is an empty 200 with Content-Type: text/plain. Write it with your framework's response class, see Acknowledging.

PaymentStatusResult ​

Returned by $kbz->status(), $aya->status() and $yoma->status(). A final class with read-only properties.

Property / MethodTypeDescription
orderId?stringYour order ID; null for Yoma, which returns only the reference
statusPaymentStatusThe mapped status
gatewayStatusstringThe gateway's own status value
gatewayReference?stringThe gateway's ID for the payment
amount?stringThe amount the gateway reports
rawarrayThe gateway's response
isSuccessful()boolstatus === PaymentStatus::Successful

CallbackRequest ​

MemberTypeDescription
new CallbackRequest(body: '', headers: [], query: [])CallbackRequestFrom the raw parts: the body as a string, the headers as name => value, the query parameters as an array
CallbackRequest::fromGlobals()CallbackRequestFrom php://input, the request headers in $_SERVER and the raw QUERY_STRING, decoded like a form body (see parsedBody())
CallbackRequest::fromPsr7($request)CallbackRequestFrom a PSR-7 ServerRequestInterface: the URI's query string decoded like a form body; repeated headers joined with ,
CallbackRequest::fromArray($payload, $headers = [])CallbackRequestFrom a decoded payload, encoded as a JSON body with Content-Type: application/json
bodystringThe raw body, exactly as received
headers()array<string, string>Headers as given
queryarrayQuery string parameters
header($name)?stringOne header, case-insensitively
parsedBody()arrayThe body decoded as JSON (when it is a JSON object) or a urlencoded form; JSON numbers keep their exact text as strings. Only ASCII whitespace around the body is trimmed. A form splits on & and the first =, + is a space, an invalid % escape is kept as is, ; is no separator, names stay as sent and the first value of a repeated name wins
input()arrayThe body merged over the query string
queryInput()arrayThe query string merged over the body

PaymentStatus ​

enum PaymentStatus: string in Laranex\PhpMyanmarPayments\Enums: $status->value is the value and PaymentStatus::from($value) reads it back.

CaseValueMeaning
PaymentStatus::SuccessfulsuccessfulThe customer paid. The only status that means money was collected
PaymentStatus::PendingpendingStill in progress or waiting on the customer
PaymentStatus::FailedfailedAttempted and failed or rejected
PaymentStatus::CanceledcanceledCanceled or closed before completing
PaymentStatus::ExpiredexpiredThe payment window ran out
PaymentStatus::UnknownunknownA status this package does not recognize yet. Inspect gatewayStatus

PaymentStatus::cases() lists every status. $status->isFinal() is false for Pending and Unknown. PaymentStatus::resolve($statuses, $gatewayStatus) maps a trimmed gateway value through an array and returns PaymentStatus::Unknown when it is not listed.