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
+53-52Lines changed: 53 additions & 52 deletions
Original file line number
Diff line number
Diff line change
@@ -14,21 +14,36 @@ An environment which supports TLS 1.2 (see the TLS-update site for more informat
14
14
15
15
## Usage
16
16
17
+
### Binaries
18
+
19
+
It is not mandatory to fork this repository for using the PayPal SDK. You can refer [PayPal Checkout Server SDK](https://developer.paypal.com/docs/checkout/reference/server-integration) for configuring and working with SDK without forking this code.
20
+
21
+
For contirbuting or referrring the samples, You can fork/refer this repository.
17
22
### Setting up credentials
18
23
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
24
20
25
```dotnet
26
+
using System;
21
27
using PayPalCheckoutSdk.Core;
28
+
using PayPalCheckoutSdk.Orders;
29
+
using BraintreeHttp;
30
+
using System.Collections.Generic;
31
+
using System.Threading.Tasks;
22
32
23
-
public class Credentials {
24
-
static String clientId = "CLIENT-ID";
25
-
static String secret = "CLIENT-SECRET";
26
-
33
+
public class CaptureOrderSample
34
+
{
35
+
static String clientId = "PAYPAL-CLIENT-ID";
36
+
static String secret = "PAYPAL-CLIENT-SECRET";
37
+
38
+
public static HttpClient client()
39
+
{
27
40
// Creating a sandbox environment
28
-
var environment = new SandboxEnvironment(clientId, secret);
29
-
41
+
PayPalEnvironment environment = new SandboxEnvironment(clientId, secret);
42
+
30
43
// Creating a client for the environment
31
-
var client = new PayPalHttpClient(environment);
44
+
PayPalHttpClient client = new PayPalHttpClient(environment);
45
+
return client;
46
+
}
32
47
}
33
48
```
34
49
@@ -37,11 +52,9 @@ public class Credentials {
37
52
This will create an order and print order id for the created order
38
53
39
54
```dotnet
40
-
using PayPalCheckoutSdk.Orders;
41
-
42
-
public class CreateOrderExample {
43
-
static void main(String[] args){
44
-
55
+
public async static Task<HttpResponse> createOrder()
56
+
{
57
+
HttpResponse response;
45
58
// Construct a request object and set desired parameters
46
59
// Here, OrdersCreateRequest() creates a POST request to /v2/checkout/orders
47
60
var order = new OrderRequest() {
@@ -50,83 +63,71 @@ public class CreateOrderExample {
50
63
{
51
64
new PurchaseUnitRequest()
52
65
{
53
-
ReferenceId = "test_ref_id1",
54
66
Amount = new AmountWithBreakdown()
55
67
{
56
68
CurrencyCode = "USD",
57
69
Value = "100.00"
58
70
}
59
71
}
60
-
},
72
+
},
61
73
ApplicationContext = new ApplicationContext()
62
74
{
63
75
ReturnUrl = "https://www.example.com",
64
76
CancelUrl = "https://www.example.com"
65
77
}
66
78
};
67
-
68
-
79
+
80
+
69
81
// Call API with your client and get a response for your call
To run integration tests using your client id and secret, run the `test` gradle command with the `-Pintegration` flag
119
120
```sh
120
-
$ dotnet test -v normal
121
+
$ PAYPAL_CLIENT_ID=YOUR_SANDBOX_CLIENT_ID PAYPAL_CLIENT_SECRET=YOUR_SANDBOX_CLIENT_SECRET dotnet test -v normal
121
122
```
122
123
123
124
You may use the client id and secret above for demonstration purposes.
124
125
125
126
126
-
*NOTE*: This SDK is still in beta, is subject to change, and should not be used in production.
127
-
128
127
## Samples
129
128
130
129
You can start off by trying out [creating and capturing an order](/Samples/CaptureIntentExamples/RunAll.java).
131
130
132
131
To try out different samples for both create and authorize intent head to [this link](/Samples).
132
+
133
+
Note: Update the `PayPalClient.cs` with your sandbox client credentials or pass your client credentials as environment variable whie executing the samples.
0 commit comments