PayPal API DoDirectPayment required IP field does not support IPv6
DoDirectPayment API call requires an IP address field (this is a buyer's IP) so I am using ServletRequest.getRemoteAddr to get the request IP. However this IP is assumed to be IPv4 and does not seem to support IPv6. Have anyone found a workaround for this?
IP Address is not required by PayPal, so I do not send IP address in local debug mode. I only send in production mode in which we use IPv4.
DoDirectPaymentRequestDetailsType details = new DoDirectPaymentRequestDetailsType(); #if (!DEBUG) details.IPAddress = HttpContext.Current.Request.UserHostAddress; #endif
IPADDRESS is an optional (but recommended) field at the moment. Support for IPv6 is being added, but is not yet available. As the API document indicates, the IPADDRESS field is recorded as a means to detect possible fraud.