@@ -32,7 +32,10 @@ Table of Contents
3232 * [ Server Authorize/Purchase] ( #server-authorizepurchase )
3333 * [ Server Create Card] ( #server-create-card )
3434 * [ Server Notification Handler] ( #server-notification-handler )
35- * [ Sage Pay Shared Methods (for both Direct and Server):] ( #sage-pay-shared-methods-for-both-direct-and-server )
35+ * [ Sage Pay Form Methods] ( #sage-pay-form-methods )
36+ * [ Form Authorize] ( #form-authorize )
37+ * [ Form Purchase] ( #form-purchase )
38+ * [ Sage Pay Shared Methods (Direct and Server)] ( #sage-pay-shared-methods-for-both-direct-and-server )
3639 * [ Repeat Authorize/Purchase] ( #repeat-authorizepurchase )
3740 * [ Capture] ( #capture )
3841 * [ Delete Card] ( #delete-card )
@@ -69,6 +72,7 @@ The following gateways are provided by this package:
6972
7073* SagePay_Direct
7174* SagePay_Server
75+ * SagePay_Form
7276
7377For general Omnipay usage instructions, please see the main
7478[ Omnipay] ( https://github.com/thephpleague/omnipay ) repository.
@@ -586,7 +590,95 @@ The `$nextUrl` is where you want Sage Pay to send the user to next.
586590It will often be the same URL whether the transaction was approved or not,
587591since the result will be safely saved in the database.
588592
589- ## Sage Pay Shared Methods (for both Direct and Server):
593+ ## Sage Pay Form Methods
594+
595+ Sage Pay Form requires neither a server-to-server back-channel nor
596+ IP-based security.
597+ The payment details are encrypted on the server before being sent to
598+ the gateway from the user's browser.
599+ The result is returned to the merchant site also through a client-side
600+ encrypted message.
601+
602+ Capturing and voiding ` Form ` transactions is a manual process performed
603+ in the "My Sage Pay" administration panel.
604+
605+ Supported functions are:
606+
607+ * authorize()
608+ * purchase()
609+
610+ ### Form Authorize
611+
612+ The authorization is intialized in a similar way to a ` Server ` payment,
613+ but with an ` encryptionKey ` :
614+
615+ ``` php
616+ $gateway = OmniPay::create('SagePay\Form')->initialize([
617+ 'vendor' => 'vendorname',
618+ 'testMode' => true,
619+ 'encryptionKey' => 'abcdef1212345678',
620+ ]);
621+ ```
622+
623+ The ` encryptionKey ` is generated in "My Sage Pay" when logged in as the administrator.
624+
625+ Note that this gateway will assume all inout data (names, addresses etc.)
626+ are UTF-8 encoded.
627+ It will then recode the data to ISO8859-1 before encrypting it for the gateway,
628+ as the gateway strictly accepts ISO8859-1 only, regardless of what encoding is
629+ used to submit the form from the merchant site.
630+ If you do not want this conversion to happen, it can be disabled with this parameter:
631+
632+ 'disableUtf8Decode' => true,
633+
634+ The authorize must be given a ` returnUrl ` (the return URL on success, or on failure
635+ if no separate ` failureUrl ` is provided).
636+
637+ ``` php
638+ $response = $gateway->authorize([
639+ ...all the normal details...
640+ //
641+ 'returnUrl' => 'https://example.com/success',
642+ 'failureUrl' => 'https://example.com/failure',
643+ ]);
644+ ```
645+
646+ The ` $response ` will be a ` POST ` redirect, which will take use to the gateway.
647+ At the gateway, the user will authenticate or authorise their credit card,
648+ perform any 3D Secure actions that may be requested, then will return to the
649+ merchant site.
650+
651+ To get the result details, the transaction is "completed":
652+
653+ ``` php
654+ // The result will be read and decrypted from the return URL (or failure URL)
655+ // query parameters:
656+
657+ $result = $gateway->completeAuthorize()->send();
658+
659+ $result->isSuccessful();
660+ $result->getTransactionReference();
661+ // etc.
662+ ```
663+
664+ If you already have the encrypted response string, then it can be optionally
665+ passed in:
666+
667+ $result = $gateway->completeAuthorize(['crypt' => $crypt])->send();
668+
669+ This should normally not be necessary, but is handy for testing or if the
670+ current page query parameters are not available in a particular architecture.
671+
672+ ### Form Purchase
673+
674+ This is the same as ` authorize() ` , but the ` purchase() ` request is used instead,
675+ and the ` completePurchase() ` request is used to complete the transaction on return.
676+
677+ ## Sage Pay Shared Methods (Direct and Server)
678+
679+ Note: these functions do not work for the ` Form ` API.
680+ These actions for ` Sage Pay Form ` must be performed manually through the "My Sage Pay"
681+ admin panel.
590682
591683* capture()
592684* refund()
0 commit comments