Asynchronously obtains an access token from the PayPal API.
Source
Future<PayPalAccessCredentials> obtainAccessCredentials() async { var authString = BASE64.encode("$clientId:$clientSecret".codeUnits); var response = await post("$paypalEndpoint/oauth2/token", body: "grant_type=client_credentials", headers: { "Accept": "application/json", "Accept-Language": "en_US", "Authorization": "Basic $authString", "Content-Type": "application/x-www-form-urlencoded" }); return new PayPalAccessCredentials.fromJson(response.body); }