def check_paypal_id(name):
 d = dict(version=settings.PAYPAL_API_VERSION, buttoncode='cleartext', buttontype='donate', method='BMCreateButton', l_buttonvar0=('business=%s' % name))
 d['user'] = settings.PAYPAL_EMBEDDED_AUTH['USER']
 d['pwd'] = settings.PAYPAL_EMBEDDED_AUTH['PASSWORD']
 d['signature'] = settings.PAYPAL_EMBEDDED_AUTH['SIGNATURE']
 r = requests.get(settings.PAYPAL_API_URL, params=d, timeout=10)
 response = dict(urlparse.parse_qsl(r.text))
 valid = (response['ACK'] == 'Success')
 msg = (None if valid else response['L_LONGMESSAGE0'])
 return (valid, msg)

def check_paypal_id ( name ) : d = dict ( version = settings . PAYPAL_API_VERSION , buttoncode = 'cleartext' , buttontype = 'donate' , method = 'BMCreateButton' , l_buttonvar0 = ( 'business=%s' % name ) ) d [ 'user' ] = settings . PAYPAL_EMBEDDED_AUTH [ 'USER' ] d [ 'pwd' ] = settings . PAYPAL_EMBEDDED_AUTH [ 'PASSWORD' ] d [ 'signature' ] = settings . PAYPAL_EMBEDDED_AUTH [ 'SIGNATURE' ] r = requests . get ( settings . PAYPAL_API_URL , params = d , timeout = 10 ) response = dict ( urlparse . parse_qsl ( r . text ) ) valid = ( response [ 'ACK' ] == 'Success' ) msg = ( None if valid else response [ 'L_LONGMESSAGE0' ] ) return ( valid , msg )
use the button api to check if name is a valid paypal id .