Search code examples
paypalpayment-gatewaywhmcs

PayPal client restriction by country


Currently we use WHMCS PayPal payment gateway module but looking forward to develop our own module if we could solve our case.

The case is that we need to have a possibility to restrict clients to make payment from some specific country or countries. In standard payment way PayPal do not provide any payer details take a decision on our server side and not forward client to PayPal to complete the payment if it necessary.

Have anyone experience on solving this case? While after reviewing PayPal API do not found (or missed) the possible solution.


Solution

  • I'd prefer to comment on this, but the char[] is too long. strcpy is always an interesting problem.

    You could scrape some site like https://ip-lookup.net/ or ARIN itself by execing curl or using a HTTP library like POCO or libcurl.

    There may be some library out there that performs the lookup, you'd find that with Google. It will probably be based on IP in any event.