You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.MD
+45-49Lines changed: 45 additions & 49 deletions
Original file line number
Diff line number
Diff line change
@@ -18,17 +18,27 @@ An environment which supports TLS 1.2 (see the TLS-update site for more informat
18
18
Get client ID and client secret by going to https://developer.paypal.com/developer/applications and generating a REST API app. Get <b>Client ID</b> and <b>Secret</b> from there.
19
19
20
20
```dotnet
21
+
using System;
21
22
using PayPalCheckoutSdk.Core;
23
+
using PayPalCheckoutSdk.Orders;
24
+
using BraintreeHttp;
25
+
using System.Collections.Generic;
26
+
using System.Threading.Tasks;
27
+
28
+
public class CaptureOrderSample
29
+
{
30
+
static String clientId = "PAYPAL-CLIENT-ID";
31
+
static String secret = "PAYPAL-CLIENT-SECRET";
22
32
23
-
public class Credentials {
24
-
static String clientId = "CLIENT-ID";
25
-
static String secret = "CLIENT-SECRET";
26
-
33
+
public static HttpClient client()
34
+
{
27
35
// Creating a sandbox environment
28
-
var environment = new SandboxEnvironment(clientId, secret);
29
-
36
+
PayPalEnvironment environment = new SandboxEnvironment(clientId, secret);
37
+
30
38
// Creating a client for the environment
31
-
var client = new PayPalHttpClient(environment);
39
+
PayPalHttpClient client = new PayPalHttpClient(environment);
40
+
return client;
41
+
}
32
42
}
33
43
```
34
44
@@ -37,11 +47,9 @@ public class Credentials {
37
47
This will create an order and print order id for the created order
38
48
39
49
```dotnet
40
-
using PayPalCheckoutSdk.Orders;
41
-
42
-
public class CreateOrderExample {
43
-
static void main(String[] args){
44
-
50
+
public async static Task<HttpResponse> createOrder()
51
+
{
52
+
HttpResponse response;
45
53
// Construct a request object and set desired parameters
46
54
// Here, OrdersCreateRequest() creates a POST request to /v2/checkout/orders
47
55
var order = new OrderRequest() {
@@ -50,68 +58,56 @@ public class CreateOrderExample {
50
58
{
51
59
new PurchaseUnitRequest()
52
60
{
53
-
ReferenceId = "test_ref_id1",
54
61
Amount = new AmountWithBreakdown()
55
62
{
56
63
CurrencyCode = "USD",
57
64
Value = "100.00"
58
65
}
59
66
}
60
-
},
67
+
},
61
68
ApplicationContext = new ApplicationContext()
62
69
{
63
70
ReturnUrl = "https://www.example.com",
64
71
CancelUrl = "https://www.example.com"
65
72
}
66
73
};
67
-
68
-
74
+
75
+
69
76
// Call API with your client and get a response for your call
0 commit comments