0

I am using sandbox.authorize.net for my payment in my project. I created customer profile id and payment id using createCustomerProfileRequest sdk method in asp.et core and all working fine, but now I want to add billTo information while calling API, so that mail goes to merchant account can contain those billing information. I am not getting where i have to add billTo information in code. my code for creating customer profile is


public static CreateCustomerPaymentProfileDto CreateCustomerPaymentProfile( string emailId, CreditCardDetailsDto _creditCardDetails, UserPersonalBillingInfo _userPersonalBillingInfo) { CreateCustomerPaymentProfileDto _createCustomerPaymentProfileDto = new CreateCustomerPaymentProfileDto(); // set whether to use the sandbox environment, or production enviornment ApiOperationBase.RunEnvironment = AuthorizeNet.Environment.SANDBOX;

        // define the merchant information (authentication / transaction id)
        ApiOperationBase<ANetApiRequest, ANetApiResponse>.MerchantAuthentication = new merchantAuthenticationType()
        {
            name = _authorizeNetConfiguration.ApiLoginID,
            ItemElementName = ItemChoiceType.transactionKey,
            Item = _authorizeNetConfiguration.ApiTransactionKey,
        };

        var creditCard = new creditCardType
        {
            cardNumber = _creditCardDetails.CardNumber,
            expirationDate = _creditCardDetails.ExpirationDate
        };



        // standard api call to retrieve response
        paymentType cc = new paymentType { Item = creditCard };
       // paymentType echeck = new paymentType { Item = bankAccount };

        List<customerPaymentProfileType> paymentProfileList = new List<customerPaymentProfileType>();
        customerPaymentProfileType ccPaymentProfile = new customerPaymentProfileType();
        ccPaymentProfile.payment = cc;

        paymentProfileList.Add(ccPaymentProfile);


        customerProfileType customerProfile = new customerProfileType();
       // customerProfile.merchantCustomerId = "Test CustomerID";
        customerProfile.email = emailId;
        customerProfile.paymentProfiles = paymentProfileList.ToArray();




        var request = new createCustomerProfileRequest {  profile = customerProfile, validationMode = validationModeEnum.none, };

        // instantiate the controller that will call the service
        var controller = new createCustomerProfileController(request);
        controller.Execute();

        // get the response from the service (errors contained if any)
        createCustomerProfileResponse response = controller.GetApiResponse();

        // validate response 
        if (response != null)
        {
            if (response.messages.resultCode == messageTypeEnum.Ok)
            {
                if (response.messages.message != null)
                {
                    //Console.WriteLine("Success!");
                    //Console.WriteLine("Customer Profile ID: " + response.customerProfileId);
                    //Console.WriteLine("Payment Profile ID: " + response.customerPaymentProfileIdList[0]);
                    //Console.WriteLine("Shipping Profile ID: " + response.customerShippingAddressIdList[0]);
                    _createCustomerPaymentProfileDto.CustomerProfileId = response.customerProfileId;
                    _createCustomerPaymentProfileDto.CustomerPaymentProfileId = response.customerPaymentProfileIdList[0];
                    _createCustomerPaymentProfileDto.DisplayErrorMessage = "Create Customer Profile Successful.";
                    _createCustomerPaymentProfileDto.IsSuccess = true;
                }
            }
            else
            {
                //Console.WriteLine("Customer Profile Creation Failed.");
                //Console.WriteLine("Error Code: " + response.messages.message[0].code);
                //Console.WriteLine("Error message: " + response.messages.message[0].text);
                _createCustomerPaymentProfileDto.MessageCode = response.messages.message[0].code;
                _createCustomerPaymentProfileDto.MessageText = response.messages.message[0].text;
                _createCustomerPaymentProfileDto.DisplayErrorMessage = "Customer Profile Creation Failed.";
                _createCustomerPaymentProfileDto.IsSuccess = false;
            }
        }
        else
        {
            if (controller.GetErrorResponse().messages.message.Length > 0)
            {
                //Console.WriteLine("Customer Profile Creation Failed.");
                //Console.WriteLine("Error Code: " + response.messages.message[0].code);
                //Console.WriteLine("Error message: " + response.messages.message[0].text);
                _createCustomerPaymentProfileDto.MessageCode = response.messages.message[0].code;
                _createCustomerPaymentProfileDto.MessageText = response.messages.message[0].text;
                _createCustomerPaymentProfileDto.DisplayErrorMessage = "Customer Profile Creation Failed.";
                _createCustomerPaymentProfileDto.IsSuccess = false;
            }
            else
            {
                Console.WriteLine("Null Response.");
                _createCustomerPaymentProfileDto.MessageText = "Null Response.";
                _createCustomerPaymentProfileDto.DisplayErrorMessage = "Customer Profile Creation Failed.";
                _createCustomerPaymentProfileDto.IsSuccess = false;
            }
        }

        return _createCustomerPaymentProfileDto;
    }

I want billing information in mail like below enter image description here

4

1 回答 1

0

对于给定的 customerProfileId 和 customerPaymentProfileId,您可以调用 updateCustomerPaymentProfileRequest 来更新 billTo 详细信息,如果不更新付款信息,您可以以掩码格式发送 cardNumber 和 expirationDate(例如“cardNumber”:“XXXX1111”和“expirationDate”:“XXXX”) . 更多详细信息,请访问https://developer.authorize.net/api/reference/index.html#customer-profiles-update-customer-payment-profile

单击此处获取示例:updateCustomerPaymentProfileRequest with masked payment

于 2020-06-11T09:07:32.647 回答