Skip to content

Errors ​

Every exception extends Laranex\PhpMyanmarPayments\Exceptions\PaymentException, so one catch covers the package.

ExceptionThrown when
InvalidPaymentDataExceptionA request object is built with values the gateway would reject
ApiExceptionA gateway rejects a request, answers with an error (including errors sent with HTTP 200), or cannot be reached
SignatureVerificationExceptionA callback, return redirect or gateway response fails signature verification
ConfigurationExceptionA gateway is used without a setting it needs, or a time setting is not a whole number greater than 0

InvalidPaymentDataException ​

php
try {
    $data = new KbzPayPaymentData(
        orderId: 'ORDER-1',
        amount: 0,
        callbackUrl: 'https://shop.test/cb',
    );
} catch (InvalidPaymentDataException $e) {
    $e->errors();
    // ['orderId' => 'The orderId field may only contain ...',
    //  'amount' => 'The amount field must be greater than 0.']
}

ApiException ​

PropertyTypeDescription
gatewayCode?stringThe gateway's error code, e.g. ORDER_ID_USED, 09, PAYMENT ALREADY EXISTS
gatewayMessage?stringThe gateway's error message
httpStatusintHTTP status of the response, 0 when no response was received
rawarrayThe decoded response body

SignatureVerificationException ​

raw holds the unverified payload. Log it, never act on it.

ConfigurationException ​

The message names the gateway and the key, e.g. The wave_money configuration is missing [merchant_id]., or The kbz_pay configuration [timeout_in_seconds] must be a whole number greater than 0. for a time setting. gateway and key hold both. A form payment without a form link lifetime throws it with form_route and ttl_minutes.

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