5. Response

For processing response from GPWebPay your are need ResponseFactory and ResponseProvider

Create response

$params = $_GET; // or $_POST depends on how you send request
$response = $responseFactory->create($params);

Now you are have two options.

Processing by your code.

// verify response signatures
if (!$provider->verifyPaymentResponse($response)) {
        // invalid verification
}
// success verification
if ($response->hasError()) {
        // here is you code for processing response error
}
// here is you code for processing response

Or use ResponseProvider and callbacks

// success callbacks
$provider
        ->addOnSuccess(
                static function (ResponseInterface $response) {
                        // here is your code for processing response
                }
        )
        ->addOnSuccess(
                static function (ResponseInterface $response) {
                        // here is your another code for processing response
                }
        );

// error callback
$provider->addOnError(
        static function (GPWebPayException $exception, ResponseInterface $response) {
                // here is you code for processing error
        }
);

// and next step is call
$provider->provide($response);

Parameters

ResultText

A text description of the error identified by a combination of PRCODE and SRCODE. The contents are coded using the Windows Central European (Code Page 1250).

return:string
$response->getResultText();

PrCode

Primary code. For details, see “List of return codes in GPWebPay doc”.

return:int
$response->getPrcode();

SrCode

Secondary code. For details, see “List of return codes in GPWebPay doc”.

return:int
$response->getSrcode();

OrderNumber

Contents of the field from the request.

return:string
$response->getOrderNumber();

MerOrderNumber

Contents of the field from the request, if included.

return:string | null
$response->getMerOrderNumber();

UserParam1

Hash numbers of the payment card. Hash is a unique value for each and every card and merchant – that is if the payment is made by the same card at the same merchant, the resulting hash is identical, if the same card is used at another merchant, there is another hash.

return:string | null

Note

Only if the merchant has this functionality enabled

$response->getUserParam1();

Md

Any merchant’s data returned to the merchant in the response in the unchanged form – only “whitespace” characters are removed from both sides. The field is used to satisfy various demands of the e-shops. The field may only contain ASCII characters ranging from 0x20 to 0x7E.

Note

GPWebPay core use this field to store information about used gateway.

So method $response->getParam(string $paramName) return value contain gateway info.

return:string | null
$response->getMd();

Digest and Digest1

Digest is a check signature of the string generated as a concatenation of all the fields sent in the given order

Digest1 is same as Digest but (without the DIGEST field) and on the top of that also the MERCHANTNUMBER field (the field is not sent, the merchant has to know it, the field is added to the end of the string).

return:string
$response->getDigest();
$response->getDigest1();