-
Notifications
You must be signed in to change notification settings - Fork 7
/
OneStepCreditCard.cs
executable file
·62 lines (62 loc) · 1.98 KB
/
OneStepCreditCard.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
using System;
namespace Gerencianet.SDK.Examples
{
class OneStepCreditCard
{
public static void Execute()
{
dynamic endpoints = new Endpoints(Credentials.Default.ClientId, Credentials.Default.ClientSecret, Credentials.Default.Sandbox);
var body = new
{
items = new[] {
new {
name = "Product 1",
value = 590,
amount = 2
}
},
shippings = new[] {
new {
name = "Default Shipping Cost",
value = 10
}
},
payment = new
{
credit_card = new
{
installments = 1,
payment_token = "7d0a3fe0f0c9caab4f3b6578317a9d7e8ed6303f",
billing_address = new
{
street = "Av. JK",
number = 909,
neighborhood = "Bauxita",
zipcode = "35400000",
city = "Ouro Preto",
state = "MG"
},
customer = new
{
name = "Gorbadoc Oldbuck",
email = "oldbuck@gerencianet.com.br",
cpf = "04267484171",
birth = "1977-01-15",
phone_number = "5144916523"
}
}
}
};
try
{
var response = endpoints.OneStep(null, body);
Console.WriteLine(response);
}
catch (GnException e)
{
Console.WriteLine(e.ErrorType);
Console.WriteLine(e.Message);
}
}
}
}