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 / Method | Type | Description |
|---|---|---|
orderId | string | Your order ID |
status | PaymentStatus | The status mapped onto this package's statuses |
gatewayStatus | string | The gateway's own status value, unmapped |
gatewayReference | ?string | The gateway's ID for the payment |
amount | ?string | The amount the gateway reports, exactly as it sent it |
raw | array | The verified payload, with JSON numbers kept as strings, never float |
acknowledgement | Acknowledgement | The response the gateway expects |
isSuccessful() | bool | status === 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 / Method | Type | Description |
|---|---|---|
status | int | HTTP status, 200 by default |
body | string | Response body, e.g. KBZ Pay's success; empty by default |
headers | array<string, string> | Response headers, ['Content-Type' => 'text/plain'] by default |
send() | void | Writes 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 / Method | Type | Description |
|---|---|---|
orderId | ?string | Your order ID; null for Yoma, which returns only the reference |
status | PaymentStatus | The mapped status |
gatewayStatus | string | The gateway's own status value |
gatewayReference | ?string | The gateway's ID for the payment |
amount | ?string | The amount the gateway reports |
raw | array | The gateway's response |
isSuccessful() | bool | status === PaymentStatus::Successful |
CallbackRequest
| Member | Type | Description |
|---|---|---|
new CallbackRequest(body: '', headers: [], query: []) | CallbackRequest | From the raw parts: the body as a string, the headers as name => value, the query parameters as an array |
CallbackRequest::fromGlobals() | CallbackRequest | From php://input, the request headers in $_SERVER and the raw QUERY_STRING, decoded like a form body (see parsedBody()) |
CallbackRequest::fromPsr7($request) | CallbackRequest | From a PSR-7 ServerRequestInterface: the URI's query string decoded like a form body; repeated headers joined with , |
CallbackRequest::fromArray($payload, $headers = []) | CallbackRequest | From a decoded payload, encoded as a JSON body with Content-Type: application/json |
body | string | The raw body, exactly as received |
headers() | array<string, string> | Headers as given |
query | array | Query string parameters |
header($name) | ?string | One header, case-insensitively |
parsedBody() | array | The 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() | array | The body merged over the query string |
queryInput() | array | The 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.
| Case | Value | Meaning |
|---|---|---|
PaymentStatus::Successful | successful | The customer paid. The only status that means money was collected |
PaymentStatus::Pending | pending | Still in progress or waiting on the customer |
PaymentStatus::Failed | failed | Attempted and failed or rejected |
PaymentStatus::Canceled | canceled | Canceled or closed before completing |
PaymentStatus::Expired | expired | The payment window ran out |
PaymentStatus::Unknown | unknown | A 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.