|
5 | 5 |
|
6 | 6 | ### Important Notes |
7 | 7 |
|
8 | | -- **Available Features:** This SDK currently contains only 3 of PayPal's API endpoints. Additional endpoints and functionality will be added in the future. |
| 8 | +- **Available Features:** This SDK currently contains only 5 of PayPal's API endpoints. Additional endpoints and functionality will be added in the future. |
9 | 9 |
|
10 | 10 | ### Information |
11 | 11 |
|
12 | 12 | The PayPal Server SDK provides integration access to the PayPal REST APIs. The API endpoints are divided into distinct controllers: |
13 | 13 |
|
14 | 14 | - Orders Controller: [Orders API v2](https://developer.paypal.com/docs/api/orders/v2/) |
15 | | -- Payments Controller: [Payments API v2](https://developer.paypal.com/docs/api/payments/v2 |
| 15 | +- Payments Controller: [Payments API v2](https://developer.paypal.com/docs/api/payments/v2) |
16 | 16 | - Vault Controller: [Payment Method Tokens API v3](https://developer.paypal.com/docs/api/payment-tokens/v3/) *Available in the US only.* |
| 17 | +- Transaction Search Controller: [Transaction Search API v1](https://developer.paypal.com/docs/api/transaction-search/v1/) |
| 18 | +- Subscriptions Controller: [Subscriptions API v1](https://developer.paypal.com/docs/api/subscriptions/v1/) |
17 | 19 |
|
18 | 20 | ## Install the Package |
19 | 21 |
|
20 | 22 | The package is compatible with Python versions `3.7+`. |
21 | 23 | Install the package from PyPi using the following pip command: |
22 | 24 |
|
23 | 25 | ```bash |
24 | | -pip install paypal-server-sdk==1.1.0 |
| 26 | +pip install paypal-server-sdk==2.0.0 |
25 | 27 | ``` |
26 | 28 |
|
27 | 29 | You can also view the package at: |
28 | | -https://pypi.python.org/pypi/paypal-server-sdk/1.1.0 |
| 30 | +https://pypi.python.org/pypi/paypal-server-sdk/2.0.0 |
29 | 31 |
|
30 | 32 | ## Initialize the API Client |
31 | 33 |
|
32 | | -**_Note:_** Documentation for the client can be found [here.](https://www.github.com/paypal/PayPal-Python-Server-SDK/tree/1.1.0/doc/client.md) |
| 34 | +**_Note:_** Documentation for the client can be found [here.](https://www.github.com/paypal/PayPal-Python-Server-SDK/tree/2.0.0/doc/client.md) |
33 | 35 |
|
34 | 36 | The following parameters are configurable for the API Client: |
35 | 37 |
|
36 | 38 | | Parameter | Type | Description | |
37 | 39 | | --- | --- | --- | |
38 | 40 | | environment | `Environment` | The API environment. <br> **Default: `Environment.SANDBOX`** | |
39 | | -| http_client_instance | `HttpClient` | The Http Client passed from the sdk user for making requests | |
| 41 | +| http_client_instance | `Union[Session, HttpClientProvider]` | The Http Client passed from the sdk user for making requests | |
40 | 42 | | override_http_client_configuration | `bool` | The value which determines to override properties of the passed Http Client from the sdk user | |
41 | 43 | | http_call_back | `HttpCallBack` | The callback value that is invoked before and after an HTTP call is made to an endpoint | |
42 | 44 | | timeout | `float` | The value to use for connection timeout. <br> **Default: 60** | |
43 | 45 | | max_retries | `int` | The number of times to retry an endpoint call if it fails. <br> **Default: 0** | |
44 | 46 | | backoff_factor | `float` | A backoff factor to apply between attempts after the second try. <br> **Default: 2** | |
45 | 47 | | retry_statuses | `Array of int` | The http statuses on which retry is to be done. <br> **Default: [408, 413, 429, 500, 502, 503, 504, 521, 522, 524]** | |
46 | 48 | | retry_methods | `Array of string` | The http methods on which retry is to be done. <br> **Default: ['GET', 'PUT']** | |
47 | | -| logging_configuration | [`LoggingConfiguration`](https://www.github.com/paypal/PayPal-Python-Server-SDK/tree/1.1.0/doc/logging-configuration.md) | The SDK logging configuration for API calls | |
48 | | -| client_credentials_auth_credentials | [`ClientCredentialsAuthCredentials`](https://www.github.com/paypal/PayPal-Python-Server-SDK/tree/1.1.0/doc/auth/oauth-2-client-credentials-grant.md) | The credential object for OAuth 2 Client Credentials Grant | |
| 49 | +| proxy_settings | [`ProxySettings`](https://www.github.com/paypal/PayPal-Python-Server-SDK/tree/2.0.0/doc/proxy-settings.md) | Optional proxy configuration to route HTTP requests through a proxy server. | |
| 50 | +| logging_configuration | [`LoggingConfiguration`](https://www.github.com/paypal/PayPal-Python-Server-SDK/tree/2.0.0/doc/logging-configuration.md) | The SDK logging configuration for API calls | |
| 51 | +| client_credentials_auth_credentials | [`ClientCredentialsAuthCredentials`](https://www.github.com/paypal/PayPal-Python-Server-SDK/tree/2.0.0/doc/auth/oauth-2-client-credentials-grant.md) | The credential object for OAuth 2 Client Credentials Grant | |
49 | 52 |
|
50 | 53 | The API client can be initialized as follows: |
51 | 54 |
|
52 | 55 | ```python |
| 56 | +import logging |
| 57 | + |
| 58 | +from paypalserversdk.configuration import Environment |
| 59 | +from paypalserversdk.http.auth.o_auth_2 import ClientCredentialsAuthCredentials |
| 60 | +from paypalserversdk.logging.configuration.api_logging_configuration import LoggingConfiguration |
| 61 | +from paypalserversdk.logging.configuration.api_logging_configuration import RequestLoggingConfiguration |
| 62 | +from paypalserversdk.logging.configuration.api_logging_configuration import ResponseLoggingConfiguration |
| 63 | +from paypalserversdk.paypal_serversdk_client import PaypalServersdkClient |
| 64 | + |
53 | 65 | client = PaypalServersdkClient( |
54 | 66 | client_credentials_auth_credentials=ClientCredentialsAuthCredentials( |
55 | 67 | o_auth_client_id='OAuthClientId', |
@@ -83,33 +95,36 @@ The SDK can be configured to use a different environment for making API calls. A |
83 | 95 |
|
84 | 96 | This API uses the following authentication schemes. |
85 | 97 |
|
86 | | -* [`Oauth2 (OAuth 2 Client Credentials Grant)`](https://www.github.com/paypal/PayPal-Python-Server-SDK/tree/1.1.0/doc/auth/oauth-2-client-credentials-grant.md) |
| 98 | +* [`Oauth2 (OAuth 2 Client Credentials Grant)`](https://www.github.com/paypal/PayPal-Python-Server-SDK/tree/2.0.0/doc/auth/oauth-2-client-credentials-grant.md) |
87 | 99 |
|
88 | 100 | ## List of APIs |
89 | 101 |
|
90 | | -* [Orders](https://www.github.com/paypal/PayPal-Python-Server-SDK/tree/1.1.0/doc/controllers/orders.md) |
91 | | -* [Payments](https://www.github.com/paypal/PayPal-Python-Server-SDK/tree/1.1.0/doc/controllers/payments.md) |
92 | | -* [Vault](https://www.github.com/paypal/PayPal-Python-Server-SDK/tree/1.1.0/doc/controllers/vault.md) |
| 102 | +* [Transactionsearch](https://www.github.com/paypal/PayPal-Python-Server-SDK/tree/2.0.0/doc/controllers/transactionsearch.md) |
| 103 | +* [Orders](https://www.github.com/paypal/PayPal-Python-Server-SDK/tree/2.0.0/doc/controllers/orders.md) |
| 104 | +* [Payments](https://www.github.com/paypal/PayPal-Python-Server-SDK/tree/2.0.0/doc/controllers/payments.md) |
| 105 | +* [Vault](https://www.github.com/paypal/PayPal-Python-Server-SDK/tree/2.0.0/doc/controllers/vault.md) |
| 106 | +* [Subscriptions](https://www.github.com/paypal/PayPal-Python-Server-SDK/tree/2.0.0/doc/controllers/subscriptions.md) |
93 | 107 |
|
94 | 108 | ## SDK Infrastructure |
95 | 109 |
|
96 | 110 | ### Configuration |
97 | 111 |
|
98 | | -* [AbstractLogger](https://www.github.com/paypal/PayPal-Python-Server-SDK/tree/1.1.0/doc/abstract-logger.md) |
99 | | -* [LoggingConfiguration](https://www.github.com/paypal/PayPal-Python-Server-SDK/tree/1.1.0/doc/logging-configuration.md) |
100 | | -* [RequestLoggingConfiguration](https://www.github.com/paypal/PayPal-Python-Server-SDK/tree/1.1.0/doc/request-logging-configuration.md) |
101 | | -* [ResponseLoggingConfiguration](https://www.github.com/paypal/PayPal-Python-Server-SDK/tree/1.1.0/doc/response-logging-configuration.md) |
| 112 | +* [ProxySettings](https://www.github.com/paypal/PayPal-Python-Server-SDK/tree/2.0.0/doc/proxy-settings.md) |
| 113 | +* [AbstractLogger](https://www.github.com/paypal/PayPal-Python-Server-SDK/tree/2.0.0/doc/abstract-logger.md) |
| 114 | +* [LoggingConfiguration](https://www.github.com/paypal/PayPal-Python-Server-SDK/tree/2.0.0/doc/logging-configuration.md) |
| 115 | +* [RequestLoggingConfiguration](https://www.github.com/paypal/PayPal-Python-Server-SDK/tree/2.0.0/doc/request-logging-configuration.md) |
| 116 | +* [ResponseLoggingConfiguration](https://www.github.com/paypal/PayPal-Python-Server-SDK/tree/2.0.0/doc/response-logging-configuration.md) |
102 | 117 |
|
103 | 118 | ### HTTP |
104 | 119 |
|
105 | | -* [HttpResponse](https://www.github.com/paypal/PayPal-Python-Server-SDK/tree/1.1.0/doc/http-response.md) |
106 | | -* [HttpRequest](https://www.github.com/paypal/PayPal-Python-Server-SDK/tree/1.1.0/doc/http-request.md) |
| 120 | +* [HttpResponse](https://www.github.com/paypal/PayPal-Python-Server-SDK/tree/2.0.0/doc/http-response.md) |
| 121 | +* [HttpRequest](https://www.github.com/paypal/PayPal-Python-Server-SDK/tree/2.0.0/doc/http-request.md) |
107 | 122 |
|
108 | 123 | ### Utilities |
109 | 124 |
|
110 | | -* [ApiResponse](https://www.github.com/paypal/PayPal-Python-Server-SDK/tree/1.1.0/doc/api-response.md) |
111 | | -* [ApiHelper](https://www.github.com/paypal/PayPal-Python-Server-SDK/tree/1.1.0/doc/api-helper.md) |
112 | | -* [HttpDateTime](https://www.github.com/paypal/PayPal-Python-Server-SDK/tree/1.1.0/doc/http-date-time.md) |
113 | | -* [RFC3339DateTime](https://www.github.com/paypal/PayPal-Python-Server-SDK/tree/1.1.0/doc/rfc3339-date-time.md) |
114 | | -* [UnixDateTime](https://www.github.com/paypal/PayPal-Python-Server-SDK/tree/1.1.0/doc/unix-date-time.md) |
| 125 | +* [ApiResponse](https://www.github.com/paypal/PayPal-Python-Server-SDK/tree/2.0.0/doc/api-response.md) |
| 126 | +* [ApiHelper](https://www.github.com/paypal/PayPal-Python-Server-SDK/tree/2.0.0/doc/api-helper.md) |
| 127 | +* [HttpDateTime](https://www.github.com/paypal/PayPal-Python-Server-SDK/tree/2.0.0/doc/http-date-time.md) |
| 128 | +* [RFC3339DateTime](https://www.github.com/paypal/PayPal-Python-Server-SDK/tree/2.0.0/doc/rfc3339-date-time.md) |
| 129 | +* [UnixDateTime](https://www.github.com/paypal/PayPal-Python-Server-SDK/tree/2.0.0/doc/unix-date-time.md) |
115 | 130 |
|
0 commit comments