View as Markdown
API Spec (JSON)
API Spec (YAML)
Compact modeHides field descriptions and other prose for a more compact, scannable view of the API reference.| Attribute | Op | Notes |
|---|---|---|
items | replace | Using replace op for items will replace the entire items object with the value sent in request. |
notify_payer | replace, add | |
status | replace | Only patching status to CANCELLED is currently supported. |
Client CredentialsToken URLhttps://api-m.sandbox.paypal.com/v1/oauth2/tokenInheaderScopes
https://uri.paypal.com/services/payments/paymentAuthorizationstring<standard_header_schema>Optionalapplication/json
TypeScript Definitions
Use the request body type in TypeScript.
An array of patch objects.
pathstring<currency_code>OptionalvaluePatch ValueOptionalremove, copy, and move operations do not require a value. Since JSON Patch allows any type for value, the type property is not specified.fromstring<currency_code>Optionalmove operation.application/json
application/json
application/json
Request samples
using Microsoft.Extensions.Logging;
using PaypalServerSdk.Standard;
using PaypalServerSdk.Standard.Authentication;
using PaypalServerSdk.Standard.Controllers;
using PaypalServerSdk.Standard.Exceptions;
using PaypalServerSdk.Standard.Http.Response;
using PaypalServerSdk.Standard.Models;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace TestConsoleProject
{
public class Program
{
public static async Task Main()
{
PaypalServerSdkClient client = new PaypalServerSdkClient.Builder()
.ClientCredentialsAuth(
new ClientCredentialsAuthModel.Builder(
"OAuthClientId",
"OAuthClientSecret"
)
.Build())
.Environment(PaypalServerSdk.Standard.Environment.Sandbox)
.LoggingConfig(config => config
.LogLevel(LogLevel.Information)
.RequestConfig(reqConfig => reqConfig.Body(true))
.ResponseConfig(respConfig => respConfig.Headers(true))
)
.Build();
OrdersController ordersController = client.OrdersController;
// Request body for this sample:
// [
// {
// "op": "replace",
// "path": "/status",
// "value": "CANCELLED"
// }
// ]
UpdateOrderTrackingInput updateOrderTrackingInput = new UpdateOrderTrackingInput
{
Id = "5O190127TN364715T",
TrackerId = "1YU08902781691411",
Body = new List<Patch>
{
new Patch
{
Op = PatchOp.Add,
},
},
};
try
{
await ordersController.UpdateOrderTrackingAsync(updateOrderTrackingInput);
}
catch (ApiException e)
{
Console.WriteLine(e.Message);
}
}
}
}import com.paypal.sdk.Environment;
import com.paypal.sdk.PaypalServerSdkClient;
import com.paypal.sdk.authentication.ClientCredentialsAuthModel;
import com.paypal.sdk.controllers.OrdersController;
import com.paypal.sdk.exceptions.ApiException;
import com.paypal.sdk.http.response.ApiResponse;
import com.paypal.sdk.models.*;
import java.util.Arrays;
import org.slf4j.event.Level;
public class Program {
public static void main(String[] args) {
PaypalServerSdkClient client = new PaypalServerSdkClient.Builder()
.loggingConfig(builder -> builder
.level(Level.DEBUG)
.requestConfig(logConfigBuilder -> logConfigBuilder.body(true))
.responseConfig(logConfigBuilder -> logConfigBuilder.headers(true)))
.clientCredentialsAuth(new ClientCredentialsAuthModel.Builder(
"OAuthClientId",
"OAuthClientSecret"
)
.build())
.environment(Environment.SANDBOX)
.build();
OrdersController ordersController = client.getOrdersController();
// Request body for this sample:
// [
// {
// "op": "replace",
// "path": "/status",
// "value": "CANCELLED"
// }
// ]
UpdateOrderTrackingInput updateOrderTrackingInput = new UpdateOrderTrackingInput.Builder(
"5O190127TN364715T",
"1YU08902781691411",
null
)
.body(Arrays.asList(
new Patch.Builder(
PatchOp.ADD
)
.build()
))
.build();
ordersController.updateOrderTrackingAsync(updateOrderTrackingInput).thenAccept(result -> {
System.out.println(result);
}).exceptionally(exception -> {
exception.printStackTrace();
return null;
});
}
}import { Client, Environment, LogLevel, ApiError } from '@paypal/paypal-server-sdk';
const client = new Client({
clientCredentialsAuthCredentials: {
oAuthClientId: 'OAuthClientId',
oAuthClientSecret: 'OAuthClientSecret'
},
environment: Environment.Sandbox,
logging: {
logLevel: LogLevel.Info,
logRequest: { logBody: true },
logResponse: { logHeaders: true },
},
});
const ordersController = client.ordersController;
// Request body for this sample:
// [
// {
// "op": "replace",
// "path": "/status",
// "value": "CANCELLED"
// }
// ]
const collect = {
id: '5O190127TN364715T',
trackerId: '1YU08902781691411',
body: [
{
op: PatchOp.Add,
}
]
}
try {
const response = await ordersController.updateOrderTracking(collect);
console.log(response.result);
} catch (error) {
if (error instanceof ApiError) {
console.log(error.statusCode);
console.log(error.body);
}
}import logging
from paypalserversdk.configuration import Environment
from paypalserversdk.http.auth.o_auth_2 import ClientCredentialsAuthCredentials
from paypalserversdk.logging.configuration.api_logging_configuration import (
LoggingConfiguration, RequestLoggingConfiguration, ResponseLoggingConfiguration
)
from paypalserversdk.paypal_serversdk_client import PaypalServersdkClient
from paypalserversdk.models.patch_op import PatchOp
client = PaypalServersdkClient(
client_credentials_auth_credentials=ClientCredentialsAuthCredentials(
o_auth_client_id='OAuthClientId',
o_auth_client_secret='OAuthClientSecret'
),
environment=Environment.SANDBOX,
logging_configuration=LoggingConfiguration(
log_level=logging.INFO,
request_logging_config=RequestLoggingConfiguration(log_body=True),
response_logging_config=ResponseLoggingConfiguration(log_headers=True)
)
)
orders_controller = client.orders_controller
# Request body for this sample:
# [
# {
# "op": "replace",
# "path": "/status",
# "value": "CANCELLED"
# }
# ]
collect = {
'id': '5O190127TN364715T',
'tracker_id': '1YU08902781691411',
'body': [
Patch(
op=PatchOp.ADD
)
]
}
result = orders_controller.update_order_tracking(collect)
if result.is_success():
print(result.body)
elif result.is_error():
print(result.errors)<?php
use PaypalServerSdkLib\PaypalServerSdkClientBuilder;
use PaypalServerSdkLib\Environment;
use PaypalServerSdkLib\Authentication\ClientCredentialsAuthCredentialsBuilder;
use PaypalServerSdkLib\Logging\LoggingConfigurationBuilder;
use PaypalServerSdkLib\Logging\RequestLoggingConfigurationBuilder;
use PaypalServerSdkLib\Logging\ResponseLoggingConfigurationBuilder;
use Psr\Log\LogLevel;
$client = PaypalServerSdkClientBuilder::init()
->clientCredentialsAuthCredentials(
ClientCredentialsAuthCredentialsBuilder::init(
'OAuthClientId',
'OAuthClientSecret'
)
)
->environment(Environment::SANDBOX)
->loggingConfiguration(
LoggingConfigurationBuilder::init()
->level(LogLevel::INFO)
->requestConfiguration(RequestLoggingConfigurationBuilder::init()->body(true))
->responseConfiguration(ResponseLoggingConfigurationBuilder::init()->headers(true))
)
->build();
$OrdersController = $client->getOrdersController();
// Request body for this sample:
// [
// {
// "op": "replace",
// "path": "/status",
// "value": "CANCELLED"
// }
// ]
$collect = [
'id' => '5O190127TN364715T',
'trackerId' => '1YU08902781691411',
'body' => [
PatchBuilder::init(
PatchOp::ADD
)->build()
]
];
$apiResponse = $ordersController->updateOrderTracking($collect);require 'paypal_server_sdk'
include PaypalServerSdk
client = Client.new(
client_credentials_auth_credentials: ClientCredentialsAuthCredentials.new(
o_auth_client_id: 'OAuthClientId',
o_auth_client_secret: 'OAuthClientSecret'
),
environment: Environment::SANDBOX,
logging_configuration: LoggingConfiguration.new(
log_level: Logger::INFO,
request_logging_config: RequestLoggingConfiguration.new(log_body: true),
response_logging_config: ResponseLoggingConfiguration.new(log_headers: true)
)
)
orders_controller = client.orders_controller
# Request body for this sample:
# [
# {
# "op": "replace",
# "path": "/status",
# "value": "CANCELLED"
# }
# ]
collect = {
'id' => '5O190127TN364715T',
'tracker_id' => '1YU08902781691411',
'body' => [
Patch.new(
op: PatchOp::ADD
)
]
}
result = orders_controller.update_order_tracking(collect)
if result.success?
puts result.data
elsif result.error?
warn result.errors
endRequest Body
[
{
"op": "replace",
"path": "/status",
"value": "CANCELLED"
}
]using Microsoft.Extensions.Logging;
using PaypalServerSdk.Standard;
using PaypalServerSdk.Standard.Authentication;
using PaypalServerSdk.Standard.Controllers;
using PaypalServerSdk.Standard.Exceptions;
using PaypalServerSdk.Standard.Http.Response;
using PaypalServerSdk.Standard.Models;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace TestConsoleProject
{
public class Program
{
public static async Task Main()
{
PaypalServerSdkClient client = new PaypalServerSdkClient.Builder()
.ClientCredentialsAuth(
new ClientCredentialsAuthModel.Builder(
"OAuthClientId",
"OAuthClientSecret"
)
.Build())
.Environment(PaypalServerSdk.Standard.Environment.Sandbox)
.LoggingConfig(config => config
.LogLevel(LogLevel.Information)
.RequestConfig(reqConfig => reqConfig.Body(true))
.ResponseConfig(respConfig => respConfig.Headers(true))
)
.Build();
OrdersController ordersController = client.OrdersController;
// Request body for this sample:
// [
// {
// "op": "add",
// "path": "/notify_payer",
// "value": true
// }
// ]
UpdateOrderTrackingInput updateOrderTrackingInput = new UpdateOrderTrackingInput
{
Id = "5O190127TN364715T",
TrackerId = "1YU08902781691411",
Body = new List<Patch>
{
new Patch
{
Op = PatchOp.Add,
},
},
};
try
{
await ordersController.UpdateOrderTrackingAsync(updateOrderTrackingInput);
}
catch (ApiException e)
{
Console.WriteLine(e.Message);
}
}
}
}import com.paypal.sdk.Environment;
import com.paypal.sdk.PaypalServerSdkClient;
import com.paypal.sdk.authentication.ClientCredentialsAuthModel;
import com.paypal.sdk.controllers.OrdersController;
import com.paypal.sdk.exceptions.ApiException;
import com.paypal.sdk.http.response.ApiResponse;
import com.paypal.sdk.models.*;
import java.util.Arrays;
import org.slf4j.event.Level;
public class Program {
public static void main(String[] args) {
PaypalServerSdkClient client = new PaypalServerSdkClient.Builder()
.loggingConfig(builder -> builder
.level(Level.DEBUG)
.requestConfig(logConfigBuilder -> logConfigBuilder.body(true))
.responseConfig(logConfigBuilder -> logConfigBuilder.headers(true)))
.clientCredentialsAuth(new ClientCredentialsAuthModel.Builder(
"OAuthClientId",
"OAuthClientSecret"
)
.build())
.environment(Environment.SANDBOX)
.build();
OrdersController ordersController = client.getOrdersController();
// Request body for this sample:
// [
// {
// "op": "add",
// "path": "/notify_payer",
// "value": true
// }
// ]
UpdateOrderTrackingInput updateOrderTrackingInput = new UpdateOrderTrackingInput.Builder(
"5O190127TN364715T",
"1YU08902781691411",
null
)
.body(Arrays.asList(
new Patch.Builder(
PatchOp.ADD
)
.build()
))
.build();
ordersController.updateOrderTrackingAsync(updateOrderTrackingInput).thenAccept(result -> {
System.out.println(result);
}).exceptionally(exception -> {
exception.printStackTrace();
return null;
});
}
}import { Client, Environment, LogLevel, ApiError } from '@paypal/paypal-server-sdk';
const client = new Client({
clientCredentialsAuthCredentials: {
oAuthClientId: 'OAuthClientId',
oAuthClientSecret: 'OAuthClientSecret'
},
environment: Environment.Sandbox,
logging: {
logLevel: LogLevel.Info,
logRequest: { logBody: true },
logResponse: { logHeaders: true },
},
});
const ordersController = client.ordersController;
// Request body for this sample:
// [
// {
// "op": "add",
// "path": "/notify_payer",
// "value": true
// }
// ]
const collect = {
id: '5O190127TN364715T',
trackerId: '1YU08902781691411',
body: [
{
op: PatchOp.Add,
}
]
}
try {
const response = await ordersController.updateOrderTracking(collect);
console.log(response.result);
} catch (error) {
if (error instanceof ApiError) {
console.log(error.statusCode);
console.log(error.body);
}
}import logging
from paypalserversdk.configuration import Environment
from paypalserversdk.http.auth.o_auth_2 import ClientCredentialsAuthCredentials
from paypalserversdk.logging.configuration.api_logging_configuration import (
LoggingConfiguration, RequestLoggingConfiguration, ResponseLoggingConfiguration
)
from paypalserversdk.paypal_serversdk_client import PaypalServersdkClient
from paypalserversdk.models.patch_op import PatchOp
client = PaypalServersdkClient(
client_credentials_auth_credentials=ClientCredentialsAuthCredentials(
o_auth_client_id='OAuthClientId',
o_auth_client_secret='OAuthClientSecret'
),
environment=Environment.SANDBOX,
logging_configuration=LoggingConfiguration(
log_level=logging.INFO,
request_logging_config=RequestLoggingConfiguration(log_body=True),
response_logging_config=ResponseLoggingConfiguration(log_headers=True)
)
)
orders_controller = client.orders_controller
# Request body for this sample:
# [
# {
# "op": "add",
# "path": "/notify_payer",
# "value": true
# }
# ]
collect = {
'id': '5O190127TN364715T',
'tracker_id': '1YU08902781691411',
'body': [
Patch(
op=PatchOp.ADD
)
]
}
result = orders_controller.update_order_tracking(collect)
if result.is_success():
print(result.body)
elif result.is_error():
print(result.errors)<?php
use PaypalServerSdkLib\PaypalServerSdkClientBuilder;
use PaypalServerSdkLib\Environment;
use PaypalServerSdkLib\Authentication\ClientCredentialsAuthCredentialsBuilder;
use PaypalServerSdkLib\Logging\LoggingConfigurationBuilder;
use PaypalServerSdkLib\Logging\RequestLoggingConfigurationBuilder;
use PaypalServerSdkLib\Logging\ResponseLoggingConfigurationBuilder;
use Psr\Log\LogLevel;
$client = PaypalServerSdkClientBuilder::init()
->clientCredentialsAuthCredentials(
ClientCredentialsAuthCredentialsBuilder::init(
'OAuthClientId',
'OAuthClientSecret'
)
)
->environment(Environment::SANDBOX)
->loggingConfiguration(
LoggingConfigurationBuilder::init()
->level(LogLevel::INFO)
->requestConfiguration(RequestLoggingConfigurationBuilder::init()->body(true))
->responseConfiguration(ResponseLoggingConfigurationBuilder::init()->headers(true))
)
->build();
$OrdersController = $client->getOrdersController();
// Request body for this sample:
// [
// {
// "op": "add",
// "path": "/notify_payer",
// "value": true
// }
// ]
$collect = [
'id' => '5O190127TN364715T',
'trackerId' => '1YU08902781691411',
'body' => [
PatchBuilder::init(
PatchOp::ADD
)->build()
]
];
$apiResponse = $ordersController->updateOrderTracking($collect);require 'paypal_server_sdk'
include PaypalServerSdk
client = Client.new(
client_credentials_auth_credentials: ClientCredentialsAuthCredentials.new(
o_auth_client_id: 'OAuthClientId',
o_auth_client_secret: 'OAuthClientSecret'
),
environment: Environment::SANDBOX,
logging_configuration: LoggingConfiguration.new(
log_level: Logger::INFO,
request_logging_config: RequestLoggingConfiguration.new(log_body: true),
response_logging_config: ResponseLoggingConfiguration.new(log_headers: true)
)
)
orders_controller = client.orders_controller
# Request body for this sample:
# [
# {
# "op": "add",
# "path": "/notify_payer",
# "value": true
# }
# ]
collect = {
'id' => '5O190127TN364715T',
'tracker_id' => '1YU08902781691411',
'body' => [
Patch.new(
op: PatchOp::ADD
)
]
}
result = orders_controller.update_order_tracking(collect)
if result.success?
puts result.data
elsif result.error?
warn result.errors
endRequest Body
[
{
"op": "add",
"path": "/notify_payer",
"value": true
}
]using Microsoft.Extensions.Logging;
using PaypalServerSdk.Standard;
using PaypalServerSdk.Standard.Authentication;
using PaypalServerSdk.Standard.Controllers;
using PaypalServerSdk.Standard.Exceptions;
using PaypalServerSdk.Standard.Http.Response;
using PaypalServerSdk.Standard.Models;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace TestConsoleProject
{
public class Program
{
public static async Task Main()
{
// Scenario: 400 - Patch Tracking Information - 400 Bad Request Error - Invalid Request.
PaypalServerSdkClient client = new PaypalServerSdkClient.Builder()
.ClientCredentialsAuth(
new ClientCredentialsAuthModel.Builder(
"OAuthClientId",
"OAuthClientSecret"
)
.Build())
.Environment(PaypalServerSdk.Standard.Environment.Sandbox)
.LoggingConfig(config => config
.LogLevel(LogLevel.Information)
.RequestConfig(reqConfig => reqConfig.Body(true))
.ResponseConfig(respConfig => respConfig.Headers(true))
)
.Build();
OrdersController ordersController = client.OrdersController;
UpdateOrderTrackingInput updateOrderTrackingInput = new UpdateOrderTrackingInput
{
Id = "5O190127TN364715T",
TrackerId = "1YU08902781691411",
Body = new List<Patch>
{
new Patch
{
Op = PatchOp.Add,
},
},
};
try
{
await ordersController.UpdateOrderTrackingAsync(updateOrderTrackingInput);
}
catch (ApiException e)
{
Console.WriteLine(e.Message);
}
}
}
}import com.paypal.sdk.Environment;
import com.paypal.sdk.PaypalServerSdkClient;
import com.paypal.sdk.authentication.ClientCredentialsAuthModel;
import com.paypal.sdk.controllers.OrdersController;
import com.paypal.sdk.exceptions.ApiException;
import com.paypal.sdk.http.response.ApiResponse;
import com.paypal.sdk.models.*;
import java.util.Arrays;
import org.slf4j.event.Level;
public class Program {
public static void main(String[] args) {
// Scenario: 400 - Patch Tracking Information - 400 Bad Request Error - Invalid Request.
PaypalServerSdkClient client = new PaypalServerSdkClient.Builder()
.loggingConfig(builder -> builder
.level(Level.DEBUG)
.requestConfig(logConfigBuilder -> logConfigBuilder.body(true))
.responseConfig(logConfigBuilder -> logConfigBuilder.headers(true)))
.clientCredentialsAuth(new ClientCredentialsAuthModel.Builder(
"OAuthClientId",
"OAuthClientSecret"
)
.build())
.environment(Environment.SANDBOX)
.build();
OrdersController ordersController = client.getOrdersController();
UpdateOrderTrackingInput updateOrderTrackingInput = new UpdateOrderTrackingInput.Builder(
"5O190127TN364715T",
"1YU08902781691411",
null
)
.body(Arrays.asList(
new Patch.Builder(
PatchOp.ADD
)
.build()
))
.build();
ordersController.updateOrderTrackingAsync(updateOrderTrackingInput).thenAccept(result -> {
System.out.println(result);
}).exceptionally(exception -> {
exception.printStackTrace();
return null;
});
}
}import { Client, Environment, LogLevel, ApiError } from '@paypal/paypal-server-sdk';
// Scenario: 400 - Patch Tracking Information - 400 Bad Request Error - Invalid Request.
const client = new Client({
clientCredentialsAuthCredentials: {
oAuthClientId: 'OAuthClientId',
oAuthClientSecret: 'OAuthClientSecret'
},
environment: Environment.Sandbox,
logging: {
logLevel: LogLevel.Info,
logRequest: { logBody: true },
logResponse: { logHeaders: true },
},
});
const ordersController = client.ordersController;
const collect = {
id: '5O190127TN364715T',
trackerId: '1YU08902781691411',
body: [
{
op: PatchOp.Add,
}
]
}
try {
const response = await ordersController.updateOrderTracking(collect);
console.log(response.result);
} catch (error) {
if (error instanceof ApiError) {
console.log(error.statusCode);
console.log(error.body);
}
}import logging
from paypalserversdk.configuration import Environment
from paypalserversdk.http.auth.o_auth_2 import ClientCredentialsAuthCredentials
from paypalserversdk.logging.configuration.api_logging_configuration import (
LoggingConfiguration, RequestLoggingConfiguration, ResponseLoggingConfiguration
)
from paypalserversdk.paypal_serversdk_client import PaypalServersdkClient
from paypalserversdk.models.patch_op import PatchOp
client = PaypalServersdkClient(
client_credentials_auth_credentials=ClientCredentialsAuthCredentials(
o_auth_client_id='OAuthClientId',
o_auth_client_secret='OAuthClientSecret'
),
environment=Environment.SANDBOX,
logging_configuration=LoggingConfiguration(
log_level=logging.INFO,
request_logging_config=RequestLoggingConfiguration(log_body=True),
response_logging_config=ResponseLoggingConfiguration(log_headers=True)
)
)
orders_controller = client.orders_controller
# Scenario: 400 - Patch Tracking Information - 400 Bad Request Error - Invalid Request.
collect = {
'id': '5O190127TN364715T',
'tracker_id': '1YU08902781691411',
'body': [
Patch(
op=PatchOp.ADD
)
]
}
result = orders_controller.update_order_tracking(collect)
if result.is_success():
print(result.body)
elif result.is_error():
print(result.errors)<?php
use PaypalServerSdkLib\PaypalServerSdkClientBuilder;
use PaypalServerSdkLib\Environment;
use PaypalServerSdkLib\Authentication\ClientCredentialsAuthCredentialsBuilder;
use PaypalServerSdkLib\Logging\LoggingConfigurationBuilder;
use PaypalServerSdkLib\Logging\RequestLoggingConfigurationBuilder;
use PaypalServerSdkLib\Logging\ResponseLoggingConfigurationBuilder;
use Psr\Log\LogLevel;
$client = PaypalServerSdkClientBuilder::init()
->clientCredentialsAuthCredentials(
ClientCredentialsAuthCredentialsBuilder::init(
'OAuthClientId',
'OAuthClientSecret'
)
)
->environment(Environment::SANDBOX)
->loggingConfiguration(
LoggingConfigurationBuilder::init()
->level(LogLevel::INFO)
->requestConfiguration(RequestLoggingConfigurationBuilder::init()->body(true))
->responseConfiguration(ResponseLoggingConfigurationBuilder::init()->headers(true))
)
->build();
$OrdersController = $client->getOrdersController();
// Scenario: 400 - Patch Tracking Information - 400 Bad Request Error - Invalid Request.
$collect = [
'id' => '5O190127TN364715T',
'trackerId' => '1YU08902781691411',
'body' => [
PatchBuilder::init(
PatchOp::ADD
)->build()
]
];
$apiResponse = $ordersController->updateOrderTracking($collect);require 'paypal_server_sdk'
include PaypalServerSdk
client = Client.new(
client_credentials_auth_credentials: ClientCredentialsAuthCredentials.new(
o_auth_client_id: 'OAuthClientId',
o_auth_client_secret: 'OAuthClientSecret'
),
environment: Environment::SANDBOX,
logging_configuration: LoggingConfiguration.new(
log_level: Logger::INFO,
request_logging_config: RequestLoggingConfiguration.new(log_body: true),
response_logging_config: ResponseLoggingConfiguration.new(log_headers: true)
)
)
orders_controller = client.orders_controller
# Scenario: 400 - Patch Tracking Information - 400 Bad Request Error - Invalid Request.
collect = {
'id' => '5O190127TN364715T',
'tracker_id' => '1YU08902781691411',
'body' => [
Patch.new(
op: PatchOp::ADD
)
]
}
result = orders_controller.update_order_tracking(collect)
if result.success?
puts result.data
elsif result.error?
warn result.errors
endusing Microsoft.Extensions.Logging;
using PaypalServerSdk.Standard;
using PaypalServerSdk.Standard.Authentication;
using PaypalServerSdk.Standard.Controllers;
using PaypalServerSdk.Standard.Exceptions;
using PaypalServerSdk.Standard.Http.Response;
using PaypalServerSdk.Standard.Models;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace TestConsoleProject
{
public class Program
{
public static async Task Main()
{
PaypalServerSdkClient client = new PaypalServerSdkClient.Builder()
.ClientCredentialsAuth(
new ClientCredentialsAuthModel.Builder(
"OAuthClientId",
"OAuthClientSecret"
)
.Build())
.Environment(PaypalServerSdk.Standard.Environment.Sandbox)
.LoggingConfig(config => config
.LogLevel(LogLevel.Information)
.RequestConfig(reqConfig => reqConfig.Body(true))
.ResponseConfig(respConfig => respConfig.Headers(true))
)
.Build();
OrdersController ordersController = client.OrdersController;
// Request body for this sample:
// [
// {
// "op": "replace",
// "path": "items",
// "value": [
// {
// "name": "T-Shirt",
// "sku": "sku01",
// "quantity": "1",
// "upc": {
// "type": "UPC-A",
// "code": "upc001"
// },
// "image_url": "https://www.example.com/example1.jpg",
// "url": "https://www.example.com/example"
// },
// {
// "name": "NeoPhone",
// "sku": "sku02",
// "quantity": "2",
// "upc": {
// "type": "UPC-A",
// "code": "upc002"
// },
// "image_url": "https://www.example.com/example2.jpg",
// "url": "https://www.example.com/example"
// }
// ]
// }
// ]
UpdateOrderTrackingInput updateOrderTrackingInput = new UpdateOrderTrackingInput
{
Id = "5O190127TN364715T",
TrackerId = "1YU08902781691411",
Body = new List<Patch>
{
new Patch
{
Op = PatchOp.Add,
},
},
};
try
{
await ordersController.UpdateOrderTrackingAsync(updateOrderTrackingInput);
}
catch (ApiException e)
{
Console.WriteLine(e.Message);
}
}
}
}import com.paypal.sdk.Environment;
import com.paypal.sdk.PaypalServerSdkClient;
import com.paypal.sdk.authentication.ClientCredentialsAuthModel;
import com.paypal.sdk.controllers.OrdersController;
import com.paypal.sdk.exceptions.ApiException;
import com.paypal.sdk.http.response.ApiResponse;
import com.paypal.sdk.models.*;
import java.util.Arrays;
import org.slf4j.event.Level;
public class Program {
public static void main(String[] args) {
PaypalServerSdkClient client = new PaypalServerSdkClient.Builder()
.loggingConfig(builder -> builder
.level(Level.DEBUG)
.requestConfig(logConfigBuilder -> logConfigBuilder.body(true))
.responseConfig(logConfigBuilder -> logConfigBuilder.headers(true)))
.clientCredentialsAuth(new ClientCredentialsAuthModel.Builder(
"OAuthClientId",
"OAuthClientSecret"
)
.build())
.environment(Environment.SANDBOX)
.build();
OrdersController ordersController = client.getOrdersController();
// Request body for this sample:
// [
// {
// "op": "replace",
// "path": "items",
// "value": [
// {
// "name": "T-Shirt",
// "sku": "sku01",
// "quantity": "1",
// "upc": {
// "type": "UPC-A",
// "code": "upc001"
// },
// "image_url": "https://www.example.com/example1.jpg",
// "url": "https://www.example.com/example"
// },
// {
// "name": "NeoPhone",
// "sku": "sku02",
// "quantity": "2",
// "upc": {
// "type": "UPC-A",
// "code": "upc002"
// },
// "image_url": "https://www.example.com/example2.jpg",
// "url": "https://www.example.com/example"
// }
// ]
// }
// ]
UpdateOrderTrackingInput updateOrderTrackingInput = new UpdateOrderTrackingInput.Builder(
"5O190127TN364715T",
"1YU08902781691411",
null
)
.body(Arrays.asList(
new Patch.Builder(
PatchOp.ADD
)
.build()
))
.build();
ordersController.updateOrderTrackingAsync(updateOrderTrackingInput).thenAccept(result -> {
System.out.println(result);
}).exceptionally(exception -> {
exception.printStackTrace();
return null;
});
}
}import { Client, Environment, LogLevel, ApiError } from '@paypal/paypal-server-sdk';
const client = new Client({
clientCredentialsAuthCredentials: {
oAuthClientId: 'OAuthClientId',
oAuthClientSecret: 'OAuthClientSecret'
},
environment: Environment.Sandbox,
logging: {
logLevel: LogLevel.Info,
logRequest: { logBody: true },
logResponse: { logHeaders: true },
},
});
const ordersController = client.ordersController;
// Request body for this sample:
// [
// {
// "op": "replace",
// "path": "items",
// "value": [
// {
// "name": "T-Shirt",
// "sku": "sku01",
// "quantity": "1",
// "upc": {
// "type": "UPC-A",
// "code": "upc001"
// },
// "image_url": "https://www.example.com/example1.jpg",
// "url": "https://www.example.com/example"
// },
// {
// "name": "NeoPhone",
// "sku": "sku02",
// "quantity": "2",
// "upc": {
// "type": "UPC-A",
// "code": "upc002"
// },
// "image_url": "https://www.example.com/example2.jpg",
// "url": "https://www.example.com/example"
// }
// ]
// }
// ]
const collect = {
id: '5O190127TN364715T',
trackerId: '1YU08902781691411',
body: [
{
op: PatchOp.Add,
}
]
}
try {
const response = await ordersController.updateOrderTracking(collect);
console.log(response.result);
} catch (error) {
if (error instanceof ApiError) {
console.log(error.statusCode);
console.log(error.body);
}
}import logging
from paypalserversdk.configuration import Environment
from paypalserversdk.http.auth.o_auth_2 import ClientCredentialsAuthCredentials
from paypalserversdk.logging.configuration.api_logging_configuration import (
LoggingConfiguration, RequestLoggingConfiguration, ResponseLoggingConfiguration
)
from paypalserversdk.paypal_serversdk_client import PaypalServersdkClient
from paypalserversdk.models.patch_op import PatchOp
client = PaypalServersdkClient(
client_credentials_auth_credentials=ClientCredentialsAuthCredentials(
o_auth_client_id='OAuthClientId',
o_auth_client_secret='OAuthClientSecret'
),
environment=Environment.SANDBOX,
logging_configuration=LoggingConfiguration(
log_level=logging.INFO,
request_logging_config=RequestLoggingConfiguration(log_body=True),
response_logging_config=ResponseLoggingConfiguration(log_headers=True)
)
)
orders_controller = client.orders_controller
# Request body for this sample:
# [
# {
# "op": "replace",
# "path": "items",
# "value": [
# {
# "name": "T-Shirt",
# "sku": "sku01",
# "quantity": "1",
# "upc": {
# "type": "UPC-A",
# "code": "upc001"
# },
# "image_url": "https://www.example.com/example1.jpg",
# "url": "https://www.example.com/example"
# },
# {
# "name": "NeoPhone",
# "sku": "sku02",
# "quantity": "2",
# "upc": {
# "type": "UPC-A",
# "code": "upc002"
# },
# "image_url": "https://www.example.com/example2.jpg",
# "url": "https://www.example.com/example"
# }
# ]
# }
# ]
collect = {
'id': '5O190127TN364715T',
'tracker_id': '1YU08902781691411',
'body': [
Patch(
op=PatchOp.ADD
)
]
}
result = orders_controller.update_order_tracking(collect)
if result.is_success():
print(result.body)
elif result.is_error():
print(result.errors)<?php
use PaypalServerSdkLib\PaypalServerSdkClientBuilder;
use PaypalServerSdkLib\Environment;
use PaypalServerSdkLib\Authentication\ClientCredentialsAuthCredentialsBuilder;
use PaypalServerSdkLib\Logging\LoggingConfigurationBuilder;
use PaypalServerSdkLib\Logging\RequestLoggingConfigurationBuilder;
use PaypalServerSdkLib\Logging\ResponseLoggingConfigurationBuilder;
use Psr\Log\LogLevel;
$client = PaypalServerSdkClientBuilder::init()
->clientCredentialsAuthCredentials(
ClientCredentialsAuthCredentialsBuilder::init(
'OAuthClientId',
'OAuthClientSecret'
)
)
->environment(Environment::SANDBOX)
->loggingConfiguration(
LoggingConfigurationBuilder::init()
->level(LogLevel::INFO)
->requestConfiguration(RequestLoggingConfigurationBuilder::init()->body(true))
->responseConfiguration(ResponseLoggingConfigurationBuilder::init()->headers(true))
)
->build();
$OrdersController = $client->getOrdersController();
// Request body for this sample:
// [
// {
// "op": "replace",
// "path": "items",
// "value": [
// {
// "name": "T-Shirt",
// "sku": "sku01",
// "quantity": "1",
// "upc": {
// "type": "UPC-A",
// "code": "upc001"
// },
// "image_url": "https://www.example.com/example1.jpg",
// "url": "https://www.example.com/example"
// },
// {
// "name": "NeoPhone",
// "sku": "sku02",
// "quantity": "2",
// "upc": {
// "type": "UPC-A",
// "code": "upc002"
// },
// "image_url": "https://www.example.com/example2.jpg",
// "url": "https://www.example.com/example"
// }
// ]
// }
// ]
$collect = [
'id' => '5O190127TN364715T',
'trackerId' => '1YU08902781691411',
'body' => [
PatchBuilder::init(
PatchOp::ADD
)->build()
]
];
$apiResponse = $ordersController->updateOrderTracking($collect);require 'paypal_server_sdk'
include PaypalServerSdk
client = Client.new(
client_credentials_auth_credentials: ClientCredentialsAuthCredentials.new(
o_auth_client_id: 'OAuthClientId',
o_auth_client_secret: 'OAuthClientSecret'
),
environment: Environment::SANDBOX,
logging_configuration: LoggingConfiguration.new(
log_level: Logger::INFO,
request_logging_config: RequestLoggingConfiguration.new(log_body: true),
response_logging_config: ResponseLoggingConfiguration.new(log_headers: true)
)
)
orders_controller = client.orders_controller
# Request body for this sample:
# [
# {
# "op": "replace",
# "path": "items",
# "value": [
# {
# "name": "T-Shirt",
# "sku": "sku01",
# "quantity": "1",
# "upc": {
# "type": "UPC-A",
# "code": "upc001"
# },
# "image_url": "https://www.example.com/example1.jpg",
# "url": "https://www.example.com/example"
# },
# {
# "name": "NeoPhone",
# "sku": "sku02",
# "quantity": "2",
# "upc": {
# "type": "UPC-A",
# "code": "upc002"
# },
# "image_url": "https://www.example.com/example2.jpg",
# "url": "https://www.example.com/example"
# }
# ]
# }
# ]
collect = {
'id' => '5O190127TN364715T',
'tracker_id' => '1YU08902781691411',
'body' => [
Patch.new(
op: PatchOp::ADD
)
]
}
result = orders_controller.update_order_tracking(collect)
if result.success?
puts result.data
elsif result.error?
warn result.errors
endRequest Body
[
{
"op": "replace",
"path": "items",
"value": [
{
"name": "T-Shirt",
"sku": "sku01",
"quantity": "1",
"upc": {
"type": "UPC-A",
"code": "upc001"
},
"image_url": "https://www.example.com/example1.jpg",
"url": "https://www.example.com/example"
},
{
"name": "NeoPhone",
"sku": "sku02",
"quantity": "2",
"upc": {
"type": "UPC-A",
"code": "upc002"
},
"image_url": "https://www.example.com/example2.jpg",
"url": "https://www.example.com/example"
}
]
}
]Response samples