Exemple #1
0
        public PayPalHttpClient(PayPalEnvironment environment, string refreshToken) : base(environment)
        {
            this.refreshToken     = refreshToken;
            gzipInjector          = new GzipInjector();
            authorizationInjector = new AuthorizationInjector(this, environment, refreshToken);

            AddInjector(this.gzipInjector);
            AddInjector(this.authorizationInjector);
        }
Exemple #2
0
        public AccessTokenRequest(PayPalEnvironment environment, string refreshToken = null) : base("/v1/oauth2/token", HttpMethod.Post, typeof(AccessToken))
        {
            this.Headers.Authorization = new AuthenticationHeaderValue("Basic", environment.AuthorizationString());
            var body = new Dictionary <string, string>()
            {
                { "grant_type", "client_credentials" }
            };

            if (refreshToken != null)
            {
                body["grant_type"] = "refresh_token";
                body.Add("refresh_token", refreshToken);
            }

            this.Body = body;

            this.ContentType = "application/x-www-form-urlencoded";
        }
Exemple #3
0
 public PayPalHttpClient(PayPalEnvironment environment) : this(environment, null)
 {
 }