@@ -34,7 +34,7 @@ Table of Contents
3434 * [ Server Notification Handler] ( #server-notification-handler )
3535 * [ Sage Pay Form Methods] ( #sage-pay-form-methods )
3636 * [ Form Authorize] ( #form-authorize )
37- * [ Form completeAuthorise ] ( #form-completeauthorise )
37+ * [ Form completeAuthorize ] ( #form-completeauthorize )
3838 * [ Form Purchase] ( #form-purchase )
3939 * [ Sage Pay Shared Methods (Direct and Server)] ( #sage-pay-shared-methods-direct-and-server )
4040 * [ Repeat Authorize/Purchase] ( #repeat-authorizepurchase )
@@ -682,26 +682,38 @@ $response = $gateway->authorize([
682682```
683683
684684The ` $response ` will be a ` POST ` redirect, which will take the user to the gateway.
685- At the gateway, the user will authenticate or authorise their credit card,
685+ At the gateway, the user will authenticate or authorize their credit card,
686686perform any 3D Secure actions that may be requested, then will return to the
687687merchant site.
688688
689- ### Form completeAuthorise
689+ Like ` Server ` and ` Direct ` , you can use either the ` DEFERRED ` or the ` AUTHENTICATE `
690+ method to reserve the amount.
691+
692+ ### Form completeAuthorize
690693
691694To get the result details, the transaction is "completed" on the
692695user's return. This will be at your ` returnUrl ` endpoint:
693696
694697``` php
695698// The result will be read and decrypted from the return URL (or failure URL)
696- // query parameters:
699+ // query parameters.
700+ // You MUST provide the original expected transactionId, which is validated
701+ // against the transactionId provided in the server request.
702+ // This prevents different payments getting mixed up.
697703
698- $result = $gateway->completeAuthorize()->send();
704+ $completeRequest = $gateway->completeAuthorize(['transactionId' => $originalTransactionId]);
705+ $result = $completeRequest->send();
699706
700707$result->isSuccessful();
701708$result->getTransactionReference();
702709// etc.
703710```
704711
712+ Note that if ` send() ` throws an exception here due to a ` transactionId ` mismatch,
713+ you can still access the decryoted data that was brought back with the user as
714+ ` $completeRequest->getData() ` .
715+ You will need to log this for later analysis.
716+
705717If you already have the encrypted response string, then it can be passed in.
706718However, you would normally leave it for the driver to read it for you from
707719the current server request, so the following would not normally be necessary:
@@ -728,9 +740,6 @@ In a future release, the `completeAuthorize()` method will expect the
728740` transactionId ` to be supplied and it must match before it will
729741return a success status.
730742
731- Like ` Server ` and ` Direct ` , you can use either the ` DEFERRED ` or the ` AUTHENTICATE `
732- method to reserve the amount.
733-
734743### Form Purchase
735744
736745This is the same as ` authorize() ` , but the ` purchase() ` request is used instead,
0 commit comments