-
Notifications
You must be signed in to change notification settings - Fork 1
Connect
Matheus Miranda edited this page Aug 13, 2023
·
9 revisions
var body = new PagBankBody();
body.Name = "teste";
body.Description = "teste";
body.Site = "https://your-site.com.br";
body.RedirectUri = "https://your-redirect.com.br";
body.Logo = "https://your-image.svg";
var client = new PagBankClient();
client.WithBaseUrl(BaseUrl.Sandbox);
client.WithMethod(PagBankMethod.Post);
client.WithJsonBody(body);
client.WithToken("your-token");
client.WithResource("oauth2/application");
var response = await client.ExecuteAsync();
var client = new PagBankClient();
client.WithBaseUrl(BaseUrl.Sandbox);
client.WithMethod(PagBankMethod.Get);
client.WithToken("your-token");
client.WithResource("oauth2/application/your-client-id");
var response = await client.ExecuteAsync();
var body = new PagBankBody();
body.Email = "[email protected]";
var client = new PagBankClient();
client.WithBaseUrl(BaseUrl.Sandbox);
client.WithMethod(PagBankMethod.Post);
client.WithJsonBody(body);
client.AddOrUpdateHeader("X_CLIENT_ID", "your-client-id");
client.AddOrUpdateHeader("X_CLIENT_SECRET", "your-client-secret");
client.WithToken("your-token");
client.WithResource("oauth2/authorize/sms");
var response = await client.ExecuteAsync();
var body = new PagBankBody();
body.GrantType = "authorization_code";
body.Code = "your-token";
body.Email = "[email protected]";
var client = new PagBankClient();
client.WithBaseUrl(BaseUrl.Sandbox);
client.WithMethod(PagBankMethod.Post);
client.WithJsonBody(body);
client.WithToken("your-token");
client.WithResource("oauth2/token");
var response = await client.ExecuteAsync();
var clientId = "your-client-id";
var clientSecret = "your-client-secret";
var combinedCredentials = $"{clientId}:{clientSecret}";
var base64Credentials = Convert.ToBase64String(Encoding.UTF8.GetBytes(combinedCredentials));
var body = new PagBankBody();
body.GrantType = "client_credentials";
body.Scope = "transfer.create transfer.read";
var client = new PagBankClient();
client.WithBaseUrl(BaseUrl.SandboxSecure);
client.WithMethod(PagBankMethod.Post);
client.WithJsonBody(body);
client.AddOrUpdateHeader("Password", "your-pass");
client.AddOrUpdateHeader("Username", "your-username");
client.AddOrUpdateHeader("cert", "data:text/plain;name=cert.pem.txt;base64Example=");
client.AddOrUpdateHeader("key", "data:text/plain;name=cert.pem.txt;base64Example=");
client.WithToken(base64Credentials);
client.WithResource("oauth2/token");
var response = await client.ExecuteAsync();
var body = new PagBankBody();
body.GrantType = "refresh_token";
body.RefreshToken = "your-refresh-token";
var client = new PagBankClient();
client.WithBaseUrl(BaseUrl.SandboxSecure);
client.WithMethod(PagBankMethod.Post);
client.WithJsonBody(body);
client.AddOrUpdateHeader("X_CLIENT_ID", "your-client-id");
client.AddOrUpdateHeader("X_CLIENT_SECRET", "your-client-secret");
client.WithToken("your-token");
client.WithResource("refresh");
var response = await client.ExecuteAsync();
var body = new PagBankBody();
body.Token = "your-token";
var client = new PagBankClient();
client.WithBaseUrl(BaseUrl.SandboxSecure);
client.WithMethod(PagBankMethod.Post);
client.WithJsonBody(body);
client.AddOrUpdateHeader("X_CLIENT_ID", "your-client-id");
client.AddOrUpdateHeader("X_CLIENT_SECRET", "your-client-secret");
client.WithToken("your-token");
client.WithResource("revoke");
var response = await client.ExecuteAsync();