Translated from sample code of the book - O'reilly Paypal APIs, 2nd Edition