cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

List of 4 recent credit cards in payment page

I can't get the list of 4 recent creditcards used for payment.

The code for generating token is:

 

        public ActionResult GetAnAcceptPaymentPage(decimal amount)
        {
            
            string customerprofileid = "1927502125";
            AddAgentLog(3, "");
            ApiOperationBase<ANetApiRequest, ANetApiResponse>.RunEnvironment = AuthorizeNet.Environment.SANDBOX;
            ApiOperationBase<ANetApiRequest, ANetApiResponse>.MerchantAuthentication = new merchantAuthenticationType()
            {
                name = ApiLoginID,
                ItemElementName = ItemChoiceType.transactionKey,
                Item = ApiTransactionKey,
            };

            settingType[] settings = new settingType[10];

            settings[0] = new settingType();
            settings[0].settingName = settingNameEnum.hostedPaymentButtonOptions.ToString();
            settings[0].settingValue = "{\"text\": \"Pay\"}";

            settings[1] = new settingType();
            settings[1].settingName = settingNameEnum.hostedPaymentOrderOptions.ToString();
            settings[1].settingValue = "{\"show\": true}";

            settings[2] = new settingType();
            settings[2].settingName = settingNameEnum.hostedPaymentReturnOptions.ToString();
            settings[2].settingValue = "{\"showReceipt\": false, \"url\": \"" + url1 + "\", \"urlText\": \"Continue\", \"cancelUrl\": \"" + url1 + "\", \"cancelUrlText\": \"Cancel\"}";


            settings[3] = new settingType();
            settings[3].settingName = settingNameEnum.hostedPaymentStyleOptions.ToString();
            settings[3].settingValue = "{\"bgColor\": \"blue\"}";

            settings[4] = new settingType();
            settings[4].settingName = settingNameEnum.hostedPaymentPaymentOptions.ToString();
            settings[4].settingValue = "{\"cardCodeRequired\": true, \"showCreditCard\": true, \"showBankAccount\": false}";

            settings[5] = new settingType();
            settings[5].settingName = settingNameEnum.hostedPaymentSecurityOptions.ToString();
            settings[5].settingValue = "{\"captcha\": false}";

            settings[6] = new settingType();
            settings[6].settingName = settingNameEnum.hostedPaymentShippingAddressOptions.ToString();
            settings[6].settingValue = "{\"show\": false, \"required\": false}";

            settings[7] = new settingType();
            settings[7].settingName = settingNameEnum.hostedPaymentBillingAddressOptions.ToString();
            settings[7].settingValue = "{\"show\": false, \"required\": false}";

            settings[8] = new settingType();
            settings[8].settingName = settingNameEnum.hostedPaymentCustomerOptions.ToString();
            settings[8].settingValue = "{\"showEmail\": false, \"requiredEmail\": false, \"addPaymentProfile\": true}";

            settings[9] = new settingType();
            settings[9].settingName = settingNameEnum.hostedPaymentIFrameCommunicatorUrl.ToString();
            settings[9].settingValue = "{\"url\": \"" + url2 + "\"}";

            var transactionRequest = new transactionRequestType
            {
                transactionType = transactionTypeEnum.authCaptureTransaction.ToString(),    // authorize capture only
                amount = amount
            };

            var request = new getHostedPaymentPageRequest();
            request.clientId = customerprofileid;
            request.transactionRequest = transactionRequest;


            request.hostedPaymentSettings = settings;

            var controller = new getHostedPaymentPageController(request);
            controller.Execute();

            var response = controller.GetApiResponse();

            if (response != null && response.messages.resultCode == messageTypeEnum.Ok)
            {
                var response1 = Json(response, "application/json", Encoding.UTF8, JsonRequestBehavior.AllowGet);
                
                AddAgentLog(4, response.token);
            }
            else if (response != null)
            {
                
            }

            return Json(response, "application/json", Encoding.UTF8, JsonRequestBehavior.AllowGet);
        }

I am passing in the customerprofileid in 

var request = new getHostedPaymentPageRequest();
            request.clientId = customerprofileid;

But I can't get the credit card list. 

M3QDev2020
Contributor
1 REPLY 1
M3QDev2020
Contributor