@@ -647,6 +647,79 @@ A transaction of this type can be performed with the following code (JSP) :
647647 %>
648648````
649649
650+ Test Code - Apple Pay
651+ ==============================================
652+ ** Enables you to pass Apple Pay payment data to Authorize.Net.**
653+
654+ Apple Pay support is available through the SDK using our new model
655+ and code samples.
656+
657+ ###Create a Apple Pay Transaction
658+ Use this function to create an Authorize.Net payment transaction request
659+ using Apple Pay Opaque data in place of card data.
660+
661+ ** _ DataDescriptor (Apple Pay Blob) is one-time use value._ **
662+
663+ A transaction of this type can be performed with the following code (JSP) :
664+
665+ ```` jsp
666+ <%@ page import = "java.math.BigDecimal" %>
667+ <%@ page import = "java.util.Map" %>
668+ <%@ page import = "net.authorize.Environment" %>
669+ <%@ page import = "net.authorize.api.contract.v1.*" %>
670+ <%@ page import = "net.authorize.api.controller.base.ApiOperationBase" %>
671+ <%@ page import = "net.authorize.api.controller.CreateTransactionController" %>
672+
673+ <%
674+ MerchantAuthenticationType appleMerchAuthenticationType = new MerchantAuthenticationType();
675+ appleMerchAuthenticationType.setName("YOUR_API_LOGIN_ID");
676+ appleMerchAuthenticationType.setTransactionKey("YOUR_TRANSACTION_KEY");
677+
678+ ApiOperationBase.setEnvironment(Environment.SANDBOX);
679+ ApiOperationBase.setMerchantAuthentication(appleMerchAuthenticationType);
680+
681+ PaymentType paymentType = new PaymentType();
682+ OpaqueDataType op = new OpaqueDataType();
683+ op.setDataDescriptor("COMMON.APPLE.INAPP.PAYMENT");
684+ op.setDataValue("YOUR_APPLE_PAY_BLOB_HERE");
685+ paymentType.setOpaqueData(op);
686+
687+
688+ TransactionRequestType txnRequest = new TransactionRequestType();
689+ txnRequest.setTransactionType(TransactionTypeEnum.AUTH_ONLY_TRANSACTION.value());
690+ txnRequest.setPayment(paymentType);
691+ txnRequest.setAmount(new BigDecimal(System.currentTimeMillis() % 100));
692+
693+ CreateTransactionRequest apiRequest = new CreateTransactionRequest();
694+ apiRequest.setTransactionRequest(txnRequest);
695+
696+ CreateTransactionController controller = new CreateTransactionController(apiRequest);
697+ controller.execute();
698+ CreateTransactionResponse apiResponse = controller.getApiResponse();
699+
700+ if (apiResponse!=null) {
701+
702+ TransactionResponse result = apiResponse.getTransactionResponse();
703+
704+ if (result.getResponseCode().equals("1")) {
705+ out.println(result.getResponseCode());
706+ out.println("Successful ApplePay Transaction ");
707+ out.println("Auht Code : "+result.getAuthCode());
708+ out.println("Transaction ID: "+result.getTransId());
709+ }
710+ else
711+ {
712+ out.println("Failed Transaction. <br/> Result Code : " + apiResponse.getTransactionResponse().getErrors().getError().get(0).getErrorCode() + " <br/> "+ apiResponse.getTransactionResponse().getErrors().getError().get(0).getErrorText());
713+ }
714+ }
715+ else{
716+ out.println("Error processing the Transaction ..");
717+ }
718+
719+ %>
720+ ````
721+
722+
650723Test Code - Visa Checkout
651724==============================================
652725** Enables you to pass Visa Checkout payment data to Authorize.Net.**
@@ -737,74 +810,3 @@ A transaction of this type can be performed with the following code (JSP) :
737810 }
738811 %>
739812````
740-
741- Test Code - Apple Pay
742- ==============================================
743- ** Enables you to pass Apple Pay payment data to Authorize.Net.**
744-
745- Apple Pay support is available through the SDK using our new model
746- and code samples.
747-
748- ###Create a Apple Pay Transaction
749- Use this function to create an Authorize.Net payment transaction request
750- using Apple Pay Opaque data in place of card data.
751-
752- ** _ DataDescriptor (Apple Pay Blob) is one-time use value._ **
753-
754- A transaction of this type can be performed with the following code (JSP) :
755-
756- ```` jsp
757- <%@ page import = "java.math.BigDecimal" %>
758- <%@ page import = "java.util.Map" %>
759- <%@ page import = "net.authorize.Environment" %>
760- <%@ page import = "net.authorize.api.contract.v1.*" %>
761- <%@ page import = "net.authorize.api.controller.base.ApiOperationBase" %>
762- <%@ page import = "net.authorize.api.controller.CreateTransactionController" %>
763-
764- <%
765- MerchantAuthenticationType appleMerchAuthenticationType = new MerchantAuthenticationType();
766- appleMerchAuthenticationType.setName("YOUR_API_LOGIN_ID");
767- appleMerchAuthenticationType.setTransactionKey("YOUR_TRANSACTION_KEY");
768-
769- ApiOperationBase.setEnvironment(Environment.SANDBOX);
770- ApiOperationBase.setMerchantAuthentication(appleMerchAuthenticationType);
771-
772- PaymentType paymentType = new PaymentType();
773- OpaqueDataType op = new OpaqueDataType();
774- op.setDataDescriptor("YOUR_APPLE_PAY_BLOB_HERE");
775- paymentType.setOpaqueData(op);
776-
777-
778- TransactionRequestType txnRequest = new TransactionRequestType();
779- txnRequest.setTransactionType(TransactionTypeEnum.AUTH_ONLY_TRANSACTION.value());
780- txnRequest.setPayment(paymentType);
781- txnRequest.setAmount(new BigDecimal(System.currentTimeMillis() % 100));
782-
783- CreateTransactionRequest apiRequest = new CreateTransactionRequest();
784- apiRequest.setTransactionRequest(txnRequest);
785-
786- CreateTransactionController controller = new CreateTransactionController(apiRequest);
787- controller.execute();
788- CreateTransactionResponse apiResponse = controller.getApiResponse();
789-
790- if (apiResponse!=null) {
791-
792- TransactionResponse result = apiResponse.getTransactionResponse();
793-
794- if (result.getResponseCode().equals("1")) {
795- out.println(result.getResponseCode());
796- out.println("Successful ApplePay Transaction ");
797- out.println("Auht Code : "+result.getAuthCode());
798- out.println("Transaction ID: "+result.getTransId());
799- }
800- else
801- {
802- out.println("Failed Transaction. <br/> Result Code : " + apiResponse.getTransactionResponse().getErrors().getError().get(0).getErrorCode() + " <br/> "+ apiResponse.getTransactionResponse().getErrors().getError().get(0).getErrorText());
803- }
804- }
805- else{
806- out.println("Error processing the Transaction ..");
807- }
808-
809- %>
810- ````
0 commit comments