Ler em outras linguagens de programação: C#, F#.
- Implementações .NET com suporte
- Aviso Importante
- Instalação
- Autenticando e configurando o ambiente (E-Commerce)
- Autenticando e configurando o ambiente (Marketplace)
- Assíncrona x Síncrona
- Conta Clássica
- Verificar se usuário já possui Conta Wirecard (email)
- Verificar se usuário já possui Conta Wirecard (documento)
- Criar Conta Wirecard Clássica (Conta PF)
- Criar Conta Wirecard Clássica (Conta PJ)
- Consultar Conta Wirecard
- Solicitar Permissões de Acesso ao Usuário
- Gerar Access Token
- Atualizar accessToken
- Obter chave pública de uma Conta Wirecard
- Conta Transparente
- Clientes
- Pedidos
- Pagamentos
- Multipedidos
- Multipagamentos
- Notificações
- Criar Preferência de Notificação para Conta Wirecard
- Criar Preferência de Notificação para App
- Criar Preferência de Notificação para App com código identificador
- Consultar Preferência de Notificação
- Listar Todas as Preferências de Notificação
- Remover Preferência de Notificação
- Consultar Webhook Enviado
- Listar Todos os Webhooks Enviados
- Desserializar WebHook
- Contas Bancárias
- Saldo Wirecard
- Lançamentos
- Transferências
- Reembolsos
- Conciliação
- Assinatura
- Criar Plano
- Listar Planos
- Consultar Plano
- Ativar Plano
- Desativar Plano
- Alterar Plano
- Criar Assinante
- Listar Assinantes
- Consultar Assinante
- Alterar Assinante
- Atualizar Cartão do Assinante
- Criar Assinaturas
- Listar Todas Assinaturas
- Consultar Assinatura -Sem Filtro
- Consultar Assinatura - Com Filtro
- Suspender Assinatura
- Reativar Assinatura
- Cancelar Assinatura
- Alterar Assinatura
- Alterar método de pagamento
- Listar Todas as Faturas de Uma Assinatura
- Consultar Fatura
- Listar todos os pagamentos de fatura
- Consultar pagamento de assinatura
- Criar Cupom
- Associar Cupom para Assinatura
- Associar Cupom para Nova Assinatura
- Consultar Cupom
- Listar Todos os Cupons
- Ativar e Inativar Cupons
- Excluir Cupom de uma Assinatura
- Retentativa de pagamento de uma fatura
- Gerar um novo boleto para uma fatura
- Criar Regras de Retentativas Automáticas
- Criar Preferência de Notificação
- Convertendo objeto para json
- Tabela - Filtros de busca
- Exceção
- Licença
Essa biblioteca foi feito em (.NET Standard 1.2 e VS2017) e tem suporte das seguintes implementações do .NET:
- .NET Core 1.0 ou superior
- .NET Framework 4.5.1 ou superior
- Mono 4.6 ou superior
- Xamarin.iOS 10.0 ou superior
- Xamarin.Android 7.0 ou superior
- Universal Windows Platform 10 ou superior
- Windows 8.1 ou superior
- Windows Phone 8.1 ou superior
Para mais informações: .NET Standard.
Pensando em melhorar ainda mais a sua segurança e para atender a padrões internacionais do nosso selo PCI Compliance, o Wirecard desativará protocolos de segurança TLS (Transport Layer Security) inferiores a 1.2 à partir do dia 30/06/2018. Verifique se o seu projeto já possui TLS na versão 1.2, caso não, você receberá uma exceção:
- InnerException = {"A solicitação foi anulada: Não foi possível criar um canal seguro para SSL/TLS."}
Para isso, adicione o seguinte código no seu projeto:
System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
Para mais informações : TLS1.2.
Execute o comando para instalar via NuGet:
PM> Install-Package Wirecard
💥 Obs: Trocamos a biblioteca MoipCSharp por Wirecard.
Escolha o "ambiente" você quer executar suas ações e informe seu (token, chave):
Imports Wirecard
Imports Wirecard.Models
Private Const Token As String = "xxxxxxxxxxxxxxxxxxx"
Private Const Key As String = "xxxxxxxxxxxxxxxxxxxxxxxxxx"
Private WC As New WirecardClient(Environments.SANDBOX, Token, Key)
Para obter um token e a chave, primeiro faça o login aqui.
Você pode acessá-las em Minha conta > Configurações > Chaves de Acesso.
Escolha o "ambiente" você quer executar suas ações e informe seu accesstoken:
Imports Wirecard
Imports Wirecard.Models
Private Const AccessToken As String = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxx_v2"
Private WC As New WirecardClient(Environments.SANDBOX, AccessToken)
Para obter o accesstoken, você precisa criar um App.
Todos os métodos são assíncronos, caso você queira executar de forma síncrona, veja o exemplo:
Dim result As OrdersResponse = Task.Run(Function() WC.Order.List()).Result
🚩 Essa função funciona somente na conta clássica.
Dim result = Await WC.ClassicAccount.AccountExist("[email protected]")
If result = HttpStatusCode.OK Then
' já existe
'HttpStatusCode.OK == 200 (já existe)
'HttpStatusCode.BadRequest == 400 (CPF inválido)
'HttpStatusCode.NotFound == 404 (Para CPF válido, mas não possui Conta Wirecard)
End If
🚩 Essa função funciona somente na conta clássica.
Dim result = Await WC.ClassicAccount.AccountExist("123.456.789-01")
If result = HttpStatusCode.OK Then
' já existe
'HttpStatusCode.OK == 200 (já existe)
'HttpStatusCode.BadRequest == 400 (CPF inválido)
'HttpStatusCode.NotFound == 404 (Para CPF válido, mas não possui Conta Wirecard)
End If
Dim body = New ClassicAccountRequest With {
.Email = New Email With {
.Address = "[email protected]"
},
.Person = New Person With {
.Name = "Fulano",
.LastName = "da Silva",
.TaxDocument = New Taxdocument With {
.Type = "CPF",
.Number = "123.456.789-91"
},
.IdentityDocument = New Identitydocument With {
.Type = "RG",
.Number = "434322344",
.Issuer = "SPP",
.IssueDate = "2000-12-12"
},
.BirthDate = "1990-01-01",
.Phone = New Phone With {
.CountryCode = "55",
.AreaCode = "11",
.Number = "965213244"
},
.Address = New Address With {
.Street = "Av. Brigadeiro Faria Lima",
.StreetNumber = "2927",
.District = "Itaim",
.ZipCode = "01234-000",
.City = "São Paulo",
.State = "SP",
.Country = "BRA"
}
},
.Type = "MERCHANT"
}
Dim result = Await WC.ClassicAccount.Create(body)
Dim body = New ClassicAccountRequest With {
.Email = New Email With {
.Address = "[email protected]"
},
.Person = New Person With {
.Name = "Fulano",
.LastName = "da Silva",
.BirthDate = "1990-01-01",
.TaxDocument = New Taxdocument With {
.Type = "CPF",
.Number = "123.456.789-91"
},
.IdentityDocument = New Identitydocument With {
.Type = "RG",
.Number = "434322344",
.Issuer = "SPP",
.IssueDate = "2000-12-12"
},
.Phone = New Phone With {
.CountryCode = "55",
.AreaCode = "11",
.Number = "965213244"
},
.Address = New Address With {
.Street = "Av. Brigadeiro Faria Lima",
.StreetNumber = "2927",
.District = "Itaim",
.ZipCode = "01234-000",
.City = "São Paulo",
.State = "SP",
.Country = "BR"
}
},
.Company = New Company With {
.Name = "Noma da empresa",
.BusinessName = "Wirecard Pagamentos",
.OpeningDate = "2011-01-01",
.TaxDocument = New Taxdocument With {
.Type = "CNPJ",
.Number = "11.698.147/0001-13"
},
.MainActivity = New Mainactivity With {
.Cnae = "82.91-1/00",
.Description = "Atividades de cobranças e informações cadastrais"
},
.Phone = New Phone With {
.CountryCode = "55",
.AreaCode = "11",
.Number = "32234455"
},
.Address = New Address With {
.Street = "Av. Brigadeiro Faria Lima",
.StreetNumber = "2927",
.District = "Itaim",
.ZipCode = "01234-000",
.City = "São Paulo",
.State = "SP",
.Country = "BRA"
}
},
.BusinessSegment = New Businesssegment With {
.Id = 3
},
.Type = "MERCHANT"
}
Dim result = Await WC.ClassicAccount.Create(body)
Dim result = Await WC.ClassicAccount.Consult("MPA-XXXXXXXXXXXX")
🚩 O código a seguir não consome API, apenas monta o URL. Mais informações clica aqui.
Dim response_type As String = "code"
Dim client_id As String = "APP-FFFGVQMOK123"
Dim redirect_uri As String = "https://example.com/abc?DEF=あいう えお"
Dim scope As String = "RECEIVE_FUNDS,MANAGE_ACCOUNT_INFO,DEFINE_PREFERENCES"
Dim url = Utilities.RequestUserAccessPermissions(response_type, client_id, redirect_uri, scope)
'https://connect-sandbox.moip.com.br/oauth/authorize?response_type=code&client_id=APP-
'FFFGVQMOK123&redirect_uri=https://example.com/abc?DEF=%E3%81%82%E3%81%84%E3%81%86%20%
'E3%81%88%E3%81%8A&scope=RECEIVE_FUNDS,MANAGE_ACCOUNT_INFO,DEFINE_PREFERENCES
Veja aqui como funciona a permissão.
Dim client_id As String = "APP-M11STAPPOAU"
Dim client_secret As String = "SplxlOBeZQQYbYS6WxSbIA"
Dim redirect_uri As String = "http://localhost/moip/callback"
Dim grant_type As String = "authorization_code"
Dim code As String = "4d9e0466bc14aad85b894237145b217219e9a825"
Dim result = Await WC.ClassicAccount.GenerateAccessToken(client_id, client_secret, redirect_uri, grant_type, code)
Dim grant_type As String = "refresh_token"
Dim refresh_token As String = "2381dfbbcbd645268af1dd0e4456bfe1_v2"
Dim result = Await WC.ClassicAccount.UpdateAccessToken(grant_type, refresh_token)
Dim result = Await WC.ClassicAccount.GetPublickey()
Dim body = New TransparentAccountRequest With {
.TransparentAccount = True,
.Type = "MERCHANT",
.Email = New Email With {
.Address = "[email protected]"
},
.Person = New Person With {
.Name = "PrimeiroNome",
.LastName = "SegundoNome",
.TaxDocument = New Taxdocument With {
.Type = "CPF",
.Number = "123.456.798-91"
},
.BirthDate = "2011-01-01",
.Phone = New Phone With {
.CountryCode = "55",
.AreaCode = "11",
.Number = "965213244"
},
.Address = New Address With {
.Street = "Av. Brigadeiro Faria Lima",
.StreetNumber = "2927",
.District = "Itaim",
.ZipCode = "01234000",
.City = "Osasco",
.State = "SP",
.Country = "BRA"
}
}
}
Dim result = Await WC.TransparentAccount.Create(body)
Dim body = New CustomerRequest With {
.OwnId = "meu_id_customer_002",
.FullName = "Maria Oliveira",
.Email = "[email protected]",
.BirthDate = "1980-5-10",
.TaxDocument = New Taxdocument With {
.Type = "CPF",
.Number = "22288866644"
},
.Phone = New Phone With {
.CountryCode = "55",
.AreaCode = "11",
.Number = "55552266"
},
.ShippingAddress = New Shippingaddress With {
.City = "São Paulo",
.Complement = "10",
.District = "Itaim Bibi",
.Street = "Avenida Faria Lima",
.StreetNumber = "500",
.ZipCode = "01234000",
.State = "SP",
.Country = "BRA"
},
.FundingInstrument = New Fundinginstrument With {
.Method = "CREDIT_CARD",
.CreditCard = New Creditcard With {
.ExpirationMonth = "06",
.ExpirationYear = "22",
.Number = "6362970000457013",
.Cvc = "123",
.Holder = New Holder With {
.FullName = "Maria Oliveira",
.BirthDate = "1988-12-30",
.TaxDocument = New Taxdocument With {
.Type = "CPF",
.Number = "33333333333"
},
.BillingAddress = New Billingaddress With {
.City = "Rio de Janeiro",
.District = "Copacabana",
.Street = "Rua Raimundo Corrêa",
.StreetNumber = "1200",
.ZipCode = "05246200",
.State = "SP",
.Country = "BRA"
},
.Phone = New Phone With {
.CountryCode = "55",
.AreaCode = "11",
.Number = "66778899"
}
}
}
}
}
Dim result = Await WC.Customer.Create(body)
Dim body = New CustomerRequest With {
.OwnId = "meu_id_customer",
.FullName = "João Silva",
.Email = "[email protected]",
.BirthDate = "1990-10-22",
.TaxDocument = New Taxdocument With {
.Type = "CPF",
.Number = "22288866644"
},
.Phone = New Phone With {
.CountryCode = "55",
.AreaCode = "11",
.Number = "55552266"
},
.ShippingAddress = New Shippingaddress With {
.City = "São Paulo",
.Complement = "10",
.District = "Itaim Bibi",
.Street = "Avenida Faria Lima",
.StreetNumber = "500",
.ZipCode = "01234000",
.State = "SP",
.Country = "BRA"
}
}
Dim result = Await WC.Customer.Create(body)
Dim body = New CustomerRequest With {
.Method = "CREDIT_CARD",
.CreditCard = New Creditcard With {
.ExpirationMonth = "06",
.ExpirationYear = "2022",
.Number = "4012001037141112",
.Cvc = "123",
.Holder = New Holder With {
.FullName = "João da Silva",
.BirthDate = "1961-03-01",
.TaxDocument = New Taxdocument With {
.Type = "CPF",
.Number = "11111111111"
},
.Phone = New Phone With {
.CountryCode = "55",
.AreaCode = "11",
.Number = "111111111"
}
}
}
}
Dim result = Await WC.Customer.AddCreditCard(body, "CUS-XXXXXXXXXXXX")
Dim result = Await WC.Customer.DeleteCreditCard("CRC-XXXXXXXXXXXX")
Dim result = Await WC.Customer.Consult("CUS-XXXXXXXXXXXX")
Dim result = Await WC.Customer.List()
Dim body = New OrderRequest With {
.OwnId = "id_pedido",
.Amount = New Amount With {
.Currency = "BRL",
.Subtotals = New Subtotals With {
.Shipping = 1000
}
},
.Items = New List(Of Item) From {
New Item With {
.Product = "Descrição do pedido",
.Category = "VIDEO_GAME_SOFTWARE",
.Quantity = 1,
.Detail = "Mais info...",
.Price = 22000
}
},
.Customer = New Customer With {
.Id = "CUS-7AKU0VORZ2D4"
},
.Receivers = New List(Of Receiver) From {
New Receiver With {
.Type = "SECONDARY",
.FeePayor = False,
.MoipAccount = New Moipaccount With {
.Id = "MPA-E3C8493A06AE"
},
.Amount = New Amount With {
.Fixed = 5000
}
}
}
}
Dim result = Await WC.Order.Create(body)
Dim result = Await WC.Order.Consult("ORD-XXXXXXXXXXXX")
Dim result = Await WC.Order.List()
Dim filtros As String = "q=josesilva&filters=status::in(PAID,WAITING)|paymentMethod::in(CREDIT_CARD,BOLETO)|value::bt(5000,10000)&limit=3&offset=0"
Dim result = Await WC.Order.ListFilter(filtros)
Veja a tabela filtros de busca aqui.
Dim body = New PaymentRequest With {
.InstallmentCount = 1,
.FundingInstrument = New Fundinginstrument With {
.Method = "CREDIT_CARD",
.CreditCard = New Creditcard With {
.Id = "CRC-XXXXXXXXXXXX",
.Cvc = "123",
.Holder = New Holder With {
.FullName = "Jose Portador da Silva",
.BirthDate = "1988-12-30",
.TaxDocument = New Taxdocument With {
.Type = "CPF",
.Number = "33333333333"
}
}
}
}
}
Dim result = Await WC.Payment.Create(body, "ORD-XXXXXXXXXXXX")
Dim body = New PaymentRequest With {
.StatementDescriptor = "Minha Loja",
.FundingInstrument = New Fundinginstrument With {
.Method = "BOLETO",
.Boleto = New Boleto With {
.ExpirationDate = "2020-06-20",
.InstructionLines = New Instructionlines With {
.First = "Atenção",
.Second = "fique atento à data de vencimento do boleto.",
.Third = "Pague em qualquer casa lotérica."
}
}
}
}
Dim result = Await WC.Payment.Create(body, "ORD-XXXXXXXXXXXX")
Dim body = New PaymentRequest With {
.FundingInstrument = New Fundinginstrument With {
.Method = "ONLINE_BANK_DEBIT",
.OnlineBankDebit = New Onlinebankdebit With {
.BankNumber = "341",
.ExpirationDate = "2017-10-22"
}
}
}
Dim result = Await WC.Payment.Create(body, "ORD-XXXXXXXXXXXX")
Dim result = Await WC.Payment.ReleaseCustody("ECW-XXXXXXXXXXXX")
Dim result = Await WC.Payment.CaptureAuthorized("PAY-XXXXXXXXXXXX")
Dim result = Await WC.Payment.CancelAuthorized("PAY-XXXXXXXXXXXX")
Dim result = Await WC.Payment.Consult("PAY-XXXXXXXXXXXX")
Dim result = Await WC.Payment.Simulate("PAY-XXXXXXXXXXXX", 26500)
Dim body = New MultiOrderRequest With {
.OwnId = "meu_multiorder_id",
.Orders = New List(Of Order) From {
New Order With {
.OwnId = "pedido_1_id",
.Amount = New Amount With {
.Currency = "BRL",
.Subtotals = New Subtotals With {
.Shipping = 2000
}
},
.Items = New List(Of Item) From {
New Item With {
.Product = "Camisa Verde e Amarelo - Brasil",
.Quantity = 1,
.Detail = "Seleção Brasileira",
.Price = 2000
}
},
.Customer = New Customer With {
.OwnId = "customer[1234]",
.FullName = "Joao Souza",
.Email = "[email protected]",
.BirthDate = "1988-12-30",
.TaxDocument = New Taxdocument With {
.Type = "CPF",
.Number = "22222222222"
},
.Phone = New Phone With {
.CountryCode = "55",
.AreaCode = "11",
.Number = "66778899"
},
.ShippingAddress = New Shippingaddress With {
.City = "São Paulo",
.Complement = "10",
.District = "Itaim Bibi",
.Street = "Avenida Faria Lima",
.StreetNumber = "500",
.ZipCode = "01234000",
.State = "SP",
.Country = "BRA"
}
},
.Receivers = New List(Of Receiver) From {
New Receiver With {
.MoipAccount = New Moipaccount With {
.Id = "MPA-VB5OGTVPCI52"
},
.Type = "PRIMARY"
}
}
},
New Order With {
.OwnId = "pedido_2_id",
.Amount = New Amount With {
.Currency = "BRL",
.Subtotals = New Subtotals With {
.Shipping = 2000
}
},
.Items = New List(Of Item) From {
New Item With {
.Product = "Camisa Preta e Vermelha - Alemanha",
.Quantity = 1,
.Detail = "Camiseta da Copa 2014",
.Price = 2000
}
},
.Customer = New Customer With {
.OwnId = "customer[1234]",
.FullName = "Joao Souza",
.Email = "[email protected]",
.BirthDate = "1988-12-30",
.TaxDocument = New Taxdocument With {
.Type = "CPF",
.Number = "22222222222"
},
.Phone = New Phone With {
.CountryCode = "55",
.AreaCode = "11",
.Number = "66778899"
},
.ShippingAddress = New Shippingaddress With {
.City = "São Paulo",
.Complement = "10",
.District = "Itaim Bibi",
.Street = "Avenida Faria Lima",
.StreetNumber = "500",
.ZipCode = "01234000",
.State = "SP",
.Country = "BRA"
}
},
.Receivers = New List(Of Receiver) From {
New Receiver With {
.MoipAccount = New Moipaccount With {
.Id = "MPA-KQB1QFWS6QNM"
},
.Type = "SECONDARY",
.FeePayor = False,
.Amount = New Amount With {
.Fixed = 55
}
}
}
}
}
}
Dim result = Await WC.MultiOrder.Create(body)
Dim result = Await WC.MultiOrder.Consult("MOR-XXXXXXXXXXXX")
Dim body = New MultiPaymentRequest With {
.InstallmentCount = 1,
.FundingInstrument = New Fundinginstrument With {
.Method = "CREDIT_CARD",
.CreditCard = New Creditcard With {
.Hash = "HhL0...pIkjl2+3Q==",
.Holder = New Holder With {
.FullName = "",
.BirthDate = "1988-12-30",
.TaxDocument = New Taxdocument With {
.Type = "CPF",
.Number = "33333333333"
},
.Phone = New Phone With {
.CountryCode = "55",
.AreaCode = "11",
.Number = "66778899"
}
}
}
}
}
Dim result = Await WC.MultiPayment.Create(body, "MOR-XXXXXXXXXXXX")
Dim result = Await WC.MultiPayment.Consult("MPY-XXXXXXXXXXXX")
Dim result = Await WC.MultiPayment.CaptureAuthorized("MPY-XXXXXXXXXXXX")
Dim result = Await WC.MultiPayment.CancelAuthorized("MPY-XXXXXXXXXXXX")
Dim result = Await WC.MultiPayment.ReleaseCustody("ECW-XXXXXXXXXXXX")
Dim body = New NotificationRequest With {
.Events = New List(Of String) From {
"ORDER.*",
"PAYMENT.AUTHORIZED",
"PAYMENT.CANCELLED"
},
.Target = "https://webhook.site/a54daf-da54-8d5a-8d5d1-kfa4gahf42",
.Media = "WEBHOOK"
}
Dim result = Await WC.Notification.CreatAccountWirecard(body)
Caso não tenha uma URL disponível, você pode usar o Webhook Tester para fazer seus testes e receber os webhooks.
Para isso basta acessar o site e gera uma URL automaticamente.
Dim body = New NotificationRequest With {
.Events = New List(Of String) From {
"ORDER.*"
},
.Target = "https://webhook.site/a54daf-da54-8d5a-8d5d1-kfa4gahf42",
.Media = "WEBHOOK"
}
Dim result = Await WC.Notification.CreateApp(body)
Dim body = New NotificationRequest With {
.Events = New List(Of String) From {
"ORDER.*"
},
.Target = "https://webhook.site/a54daf-da54-8d5a-8d5d1-kfa4gahf42",
.Media = "WEBHOOK"
}
Dim result = Await WC.Notification.CreateApp(body, "APP-3984HG73HE9")
Dim result = Await WC.Notification.Consult("NPR-XXXXXXXXXXXX")
Dim result = Await WC.Notification.List()
Dim result = Await WC.Notification.Remove("NPR-XXXXXXXXXXXX")
If result = HttpStatusCode.NoContent Then
'Caso a Preferência de Notificação tenha sido deletada, você deve receber uma response vazia (NoContent)
End If
Dim result = Await WC.Notification.ConsultWebhook("PAY-XXXXXXXXXXXX")
Dim result = Await WC.Notification.ListWebhooks()
Ao configurar suas Preferências de Notificação você deve receber os webhooks em formato JSON e você pode desserializar.
Dim json = "{ ""date"": """", ""env"": """", ... }"
Dim result = Utilities.DeserializeWebHook(json)
Veja um exemplo do webhook aqui.
Para aumentar a segurança da sua aplicação e garantir que apenas a Wirecard pode enviar notificações para o seu sistema, você pode conferir o token enviado no header dos webhooks. Este token é o mesmo que é gerado no momento do cadastro da sua URL:
Dim token = Request.Headers("Authorization")
Dim body = New BankAccountRequest With {
.BankNumber = "237",
.AgencyNumber = "12345",
.AgencyCheckNumber = "0",
.AccountNumber = "12345678",
.AccountCheckNumber = "7",
.Type = "CHECKING",
.Holder = New Holder With {
.TaxDocument = New Taxdocument With {
.Type = "CPF",
.Number = "622.134.533-22"
},
.FullName = "Demo Wirecard"
}
}
Dim accesstoken As String = "XXXXXXXXXXXXXXXXXXXXXXXXXXX_v2"
Dim result = Await WC.BankAccount.Create(body, accesstoken, "MPA-XXXXXXXXXXXX")
Dim accesstoken As String = "XXXXXXXXXXXXXXXXXXXXXXXXXXX_v2"
Dim result = Await WC.BankAccount.Consult(accesstoken, "BKA-XXXXXXXXXXXX")
Dim accesstoken As String = "XXXXXXXXXXXXXXXXXXXXXXXXXXX_v2"
Dim result = Await WC.BankAccount.List(accesstoken, "MPA-XXXXXXXXXXXX")
Dim accesstoken As String = "XXXXXXXXXXXXXXXXXXXXXXXXXXX_v2"
Dim result = Await WC.BankAccount.Delete(accesstoken, "BKA-XXXXXXXXXXXX")
Dim body = New BankAccountRequest With {
.BankNumber = "237",
.AgencyNumber = "12345",
.AgencyCheckNumber = "8",
.AccountNumber = "12345678",
.AccountCheckNumber = "8",
.Type = "CHECKING",
.Holder = New Holder With {
.TaxDocument = New Taxdocument With {
.Type = "CPF",
.Number = "622.134.533-22"
},
.FullName = "Nome Completo"
}
}
Dim accesstoken As String = "XXXXXXXXXXXXXXXXXXXXXXXXXXX_v2"
Dim result = Await WC.BankAccount.Update(body, accesstoken, "BKA-XXXXXXXXXXXX")
Dim result = Await WC.Balance.Consult()
Dim result = Await WC.Launch.Consult("ENT-XXXXXXXXXXXX")
Dim result = Await WC.Launch.List()
Dim filtros As String = "filters=status::in(SETTLED)"
Dim result = Await WC.Launch.ListFilter(filtros)
Dim body = New TransferRequest With {
.Amount = 500,
.TransferInstrument = New Transferinstrument With {
.Method = "",
.BankAccount = New Bankaccount With {
.Type = "CHECKING",
.BankNumber = "001",
.AgencyNumber = "1111",
.AgencyCheckNumber = "2",
.AccountNumber = "9999",
.AccountCheckNumber = "8",
.Holder = New Holder With {
.FullName = "Nome do Portador",
.TaxDocument = New Taxdocument With {
.Type = "CPF",
.Number = "22222222222"
}
}
}
}
}
Dim accessToken As String = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxx_v2"
Dim result = Await WC.Transfer.Create(body, accessToken)
Dim accessToken As String = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxx_v2"
Dim result = Await WC.Transfer.Revert("TRA-XXXXXXXXXXXX", accessToken)
Dim accessToken As String = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxx_v2"
Dim result = Await WC.Transfer.Consult("TRA-XXXXXXXXXXXX", accessToken)
Dim result = Await WC.Transfer.List()
Dim filtros As String = "filters=transferInstrument.method::in(MOIP_ACCOUNT)&limit=3&offset=0"
Dim result = Await WC.Transfer.ListFilter(filtros)
Dim body = New RefundRequest With {
.Amount = "2000"
}
Dim result = Await WC.Refund.RefundPayment(body, "PAY-XXXXXXXXXXXX")
Dim body = New RefundRequest With {
.Amount = "2000"
}
Dim result = Await WC.Refund.RefundRequestCreditCard(body, "ORD-XXXXXXXXXXXX")
Dim result = Await WC.Refund.Consult("REF-XXXXXXXXXXXX")
Dim result = Await WC.Refund.ListPayments("PAY-XXXXXXXXXXXX")
Dim result = Await WC.Refund.ListOrders("ORD-XXXXXXXXXXXX")
Dim result = Await WC.Conciliation.GetSalesFile("20180829")
'Data no formato YYYYMMDD
Dim result = Await WC.Conciliation.GetFinancialFile("2018-08-29")
'Data no formato YYYY-MM-DD
Dim body = New PlanRequest With {
.Code = "plan103",
.Name = "Plano Especial",
.Description = "Descrição do Plano Especial",
.Amount = 990,
.Setup_Fee = 500,
.Max_Qty = 1,
.Interval = New Interval With {
.Length = 1,
.Unit = "MONTH"
},
.Billing_Cycles = 12,
.Trial = New Trial With {
.Days = 30,
.Enabled = True,
.Hold_Setup_Fee = True
}
}
Dim result = Await WC.Signature.CreatePlan(body)
Dim result = Await WC.Signature.ListPlans()
Dim result = Await WC.Signature.ConsultPlan("plan101")
Dim result = Await WC.Signature.EnablePlan("plan101")
Dim result = Await WC.Signature.DisablePlan("plan101")
Dim body = New PlanRequest With {
.Name = "Plano Especial",
.Description = "",
.Amount = 1290,
.Setup_Fee = 800,
.Max_Qty = 1,
.Payment_Method = "CREDIT_CARD",
.Interval = New Interval With {
.Length = 1,
.Unit = "MONTH"
},
.Billing_Cycles = 12,
.Trial = New Trial With {
.Days = 30,
.Enabled = True,
.Hold_Setup_Fee = True
}
}
Dim result = Await WC.Signature.ChangePlan(body, "plan101")
Dim body = New SubscriberRequest With {
.Code = "cliente03",
.Email = "[email protected]",
.FullName = "Nome Sobrenome",
.Cpf = "22222222222",
.Phone_Area_Code = "11",
.Phone_Number = "934343434",
.BirthDate_Day = "26",
.BirthDate_Month = "04",
.BirthDate_Year = "1980",
.Address = New Address With {
.Street = "Rua Nome da Rua",
.StreetNumber = "100",
.Complement = "casa",
.District = "Nome do Bairro",
.City = "São Paulo",
.State = "SP",
.Country = "BRA",
.ZipCode = "05015010"
},
.Billing_Info = New Billing_Info With {
.Credit_Card = New Credit_Card With {
.Holder_Name = "Nome Completo",
.Number = "4111111111111111",
.Expiration_Month = "06",
.Expiration_Year = "22"
}
}
}
Dim result = Await WC.Signature.CreateSubscriber(body, True)
Dim result = Await WC.Signature.ListSubscribers()
Dim result = Await WC.Signature.ConsultSubscriber("cliente01")
Dim body = New SubscriberRequest With {
.Code = "cliente01",
.Email = "[email protected]",
.FullName = "Nome Sobrenome",
.Cpf = "22222222222",
.Phone_Area_Code = "11",
.Phone_Number = "934343434",
.BirthDate_Day = "26",
.BirthDate_Month = "04",
.BirthDate_Year = "1980",
.Address = New Address With {
.Street = "Rua Nome da Rua1",
.StreetNumber = "100",
.Complement = "casa",
.District = "Nome do Bairro",
.City = "São Paulo",
.State = "SP",
.Country = "BRA",
.ZipCode = "05015010"
}
}
Dim result = Await WC.Signature.ChangeSubscriber(body, "cliente01")
Dim body = New SubscriberRequest With {
.Billing_Info = New Billing_Info With {
.Credit_Card = New Credit_Card With {
.Holder_Name = "Novo nome222",
.Number = "5555666677778884",
.Expiration_Month = "12",
.Expiration_Year = "20"
}
}
}
Dim result = Await WC.Signature.UpdateSubscriberCard(body, "cliente01")
Dim body = New SubscriptionRequest With {
.Code = "assinatura04",
.Amount = "9000",
.Plan = New Plan With {
.Code = "plan101"
},
.Payment_Method = "CREDIT_CARD",
.Customer = New Customer With {
.Code = "cliente01"
}
}
Dim result = Await WC.Signature.CreateSubscriptions(body, False)
Dim result = Await WC.Signature.ListAllSubscriptions()
Dim result = Await WC.Signature.ConsultSubscriptionFilter("assinatura01")
Dim filter = "q=assinatura01&filters=status::eq(ACTIVE)"
Dim result = Await WC.Signature.ConsultSubscription(filter)
Alguns exemplos de como filtrar:
- Pesquisar e Filtrar assinaturas (
q=teste&filters=status::eq(EXPIRED)
) - Filtrar assinaturas por status (
filters=status::eq(EXPIRED)&limit=10&offset=0
) - Filtrar assinaturas por creation_date (
filters=creation_date::bt(2014-11-08,2015-05-07)&limit=100&offset=0
) - Filtrar assinaturas por next_invoice_date (
filters=next_invoice_date::bt(2015-10-12,2015-10-12)&limit=100&offset=0
) - Filtrar assinaturas por plano (
filters=plan.code::eq(TESTE_WIRECARD)&limit=100&offset=0
) - Filtrar assinaturas por customer.code (
filters=customer.code::eq(HHDGOo)&limit=100&offset=0
) - Filtrar assinaturas por customer.email (
filters=customer.email::eq([email protected])&limit=100&offset=0
) - Filtrar assinaturas por customer.cpf (
filters=customer.cpf::eq(22222222222)&limit=100&offset=0
) - Filtrar assinaturas por valor (
filters=amount::bt(100,100000)
) - Pesquisar Assinatura (
q=diego nunes&limit=10&offset=0
)
Dim result = Await WC.Signature.SuspendSubscription("assinatura01")
Dim result = Await WC.Signature.ReactivateSignature("assinatura01")
Dim result = Await WC.Signature.CancelSignature("assinatura01")
Dim body = New SubscriptionRequest With {
.Plan = New Plan With {
.Code = "plan101"
},
.Amount = "9990",
.Next_Invoice_Date = New Next_Invoice_Date With {
.Day = 15,
.Month = 12,
.Year = 2018
}
}
Dim result = Await WC.Signature.ChangeSubscription(body, "assinatura01")
Dim body = New SubscriptionRequest With {
.Payment_Method = "BOLETO"
}
Dim result = Await WC.Signature.ChangePaymentMethod(body, "assinatura01")
Dim result = Await WC.Signature.ListSignatureInvoices("assinatura01")
Dim result = Await WC.Signature.ConsultInvoice("10865746")
Dim result = Await WC.Signature.ListAllInvoicePayments("10865746")
Dim result = Await WC.Signature.ConsultSubscriptionPayment("PAY-123456789012")
Dim body = New CouponRequest With {
.Code = "coupon-0002",
.Name = "Coupon name",
.Description = "My new coupon",
.Discount = New Discount With {
.Value = 1000,
.Type = "percent"
},
.Status = "active",
.Duration = New Duration With {
.Type = "repeating",
.Occurrences = 12
},
.Max_Redemptions = 100,
.Expiration_Date = New Expiration_Date With {
.Year = 2020,
.Month = 08,
.Day = 01
}
}
Dim result = Await WC.Signature.CreateCoupon(body)
Dim body = New CouponRequest With {
.Coupon = New Coupon With {
.Code = "coupon-0001"
}
}
Dim result = Await WC.Signature.AssociateCouponForExistingSignature(body, "assinatura01")
Dim body = New CouponRequest()
Dim result = Await WC.Signature.AssociateCouponForExistingSignature(body, "true")
Dim result = Await WC.Signature.ConsultCoupon("coupon-0001")
Dim result = Await WC.Signature.ListAllCoupons()
Dim result = Await WC.Signature.EnableOrDisableCoupon("coupon-0001", "inactive")
Dim result = Await WC.Signature.DeleteSignatureCoupon("assinatura01")
Dim result = Await WC.Signature.RetentiveInvoicePayment("1548222")
Dim body = New RetentativeRequest With {
.Year = 2020,
.Month = 08,
.Day = 01
}
Dim result = Await WC.Signature.CreateNewInvoiceBoleto(body, "1548222")
Dim body = New RetentativeRequest With {
.First_Try = 1,
.Second_Try = 3,
.Third_Try = 5,
.[Finally] = "cancel"
}
Dim result = Await WC.Signature.CreateAutomaticRetentionRules(body)
Dim body = New NotificationRequest With {
.Notification = New Notification With {
.Webhook = New Webhook With {
.Url = "http://exemploldeurl.com.br/assinaturas"
},
.Email = New Email With {
.Merchant = New Merchant With {
.Enabled = True
},
.Customer = New Customer With {
.Enabled = True
}
}
}
}
Dim result = Await WC.Signature.CreateNotificationPreference(body)
As vezes você enfrenta um problema e o suporte Wirecard pede o código json para verificar se realmente está no json:
Imports Newtonsoft.Json;
Dim body = New PaymentRequest With {
.DelayCapture = True,
.InstallmentCount = 1,
.FundingInstrument = New Fundinginstrument With {
.Method = "CREDIT_CARD",
.CreditCard = New Creditcard With {
.Id = "CRC-XXXXXXXXXXXX",
.Cvc = "123",
.Holder = New Holder With {
.FullName = "Jose Portador da Silva",
.BirthDate = "1988-12-30",
.TaxDocument = New Taxdocument With {
.Type = "CPF",
.Number = "33333333333"
}
}
}
}
}
'Aqui você pode obter json e compratilhar para suporte Wirecard
Dim json As String = JsonConvert.SerializeObject(body, Formatting.Indented)
Veja como ficou na variável json:
{
"installmentCount": 1,
"delayCapture": true,
"fundingInstrument": {
"method": "CREDIT_CARD",
"creditCard": {
"id": "CRC-XXXXXXXXXXXX",
"cvc": "123",
"holder": {
"fullname": "Jose Portador da Silva",
"birthdate": "1988-12-30",
"taxDocument": {
"type": "CPF",
"number": "33333333333"
}
}
}
}
}
Nome | Tipo | Descrição |
---|---|---|
limit | int | Quantidade de registros por busca (página). O valor default é 20 |
offset | int | Registro a partir do qual a busca vai retornar. O valor default é 0 |
gt(x) | number or date | Maior que - “Greater Than” |
ge(x) | number or date | Maior ou igual - “Greater than or Equal” |
lt(x) | number or date | Menor que - “Less Than” |
le(x) | number or date | Menor ou igual - “Less than or Equal” |
bt(x,y) | string | Entre - “Between” |
in(x,y…z) | string | Em - “IN” |
q | Consulta um valor em específico |
✅ Fazendo uma busca com os seguintes requisitos:
+ Transações de valores entre 5000 e 10000 (em centavos);
+ Formas de pagamento: Cartão de Crédito e Boleto;
+ Cliente com o nome jose silva;
+ Retornando 3 resultados.
GET https: //sandbox.moip.com.br/v2/orders?q=jose silva &filters=status::in(PAID,WAITING)|paymentMethod::in(CREDIT_CARD,BOLETO) |value::bt(5000,10000)&limit=3&offset=0
Você pode também fazer uma busca por pedidos dentro de um intervalo de tempo:
GET https: //sandbox.moip.com.br/v2/orders?filters=createdAt::bt(2017-10-10T13:07:00Z,2017-10-25T13:08:00Z)
Você pode recuperar os atributos code
, path
, description
, message
e error
, veja no exemplo abaixo:
Imports Wirecard.Exception
Try
Dim result = Await WC.Customer.Create(New CustomerRequest())
Catch ex As WirecardException
Dim t = ex.wirecardError
Dim t_text = ex.GetExceptionText()
End Try
Nome | Descrição | Detalhe |
---|---|---|
code | Código identificador do erro | string |
path | Parâmetro relacionado ao erro | string |
description | Descrição do erro | string |
message | Mensagem do retorno Wirecard | string |
Tem dúvidas? Fale com a gente no Slack! Algum problema ? Abre issues!