The Paypal Rest API uses OAuth2 a little like a Service Account, which means there's typically no user dialog. It uses a grant type called client_credentials. Goa now supports this kind of OAuth2 flow. You'll need the latest Goa library.
Goa library is available with this key.
Like other APIS, there's a dashboard at which you need to create an application and get credentials - it looks like this
You can create both Sandbox and live applications. These examples will mainly be using the Sandbox versions.
If you're familiar with Goa, you'll know that there is a one off function you create to store your credentials, which can be deleted after running. For Paypal it looks like this.
The main points are
Once you've run this, you're good to go.
Since there is no user interaction required for this, it's very simple to initialize. Goa automatically takes care of refreshing tokens when required.
and the token can be used as in this example of creating a payment request.
For more like this, see Google Apps Scripts snippets. Why not join our forum, follow the blog or follow me on twitter to ensure you get updates when they are available.
Services > Desktop Liberation - the definitive resource for Google Apps Script and Microsoft Office automation > OAuth2 for Apps Script in a few lines of code >