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()). status takes a PaymentStatus, and acknowledgement defaults to 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 $_GET
CallbackRequest::fromPsr7($request)CallbackRequestFrom a PSR-7 ServerRequestInterface; 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 form (the first value of a repeated key); JSON numbers keep their exact text as strings
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.

CaseValue
PaymentStatus::Successfulsuccessful
PaymentStatus::Pendingpending
PaymentStatus::Failedfailed
PaymentStatus::Canceledcanceled
PaymentStatus::Expiredexpired
PaymentStatus::Unknownunknown

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.

Released under the MIT License, except where a package says otherwise.