On this page
No Headings
Updates or cancels the tracking information for a PayPal order, by ID. Updatable attributes or objects:AttributeOpNotesitemsreplaceUsing replace op for items will replace the entire items object with the value sent in request.notify_payerreplace, addstatusreplaceOnly patching status to CANCELLED is currently supported.
Oauth2 https://uri.paypal.com/services/payments/paymentOauth 2.0 authentication
In: header
Scope: https://uri.paypal.com/services/payments/payment
The ID of the order that the tracking information is associated with.
^[A-Z0-9]+$1 <= length <= 36The order tracking ID.
^[A-Z0-9]+$1 <= length <= 36Holds authorization information for external API calls.
^.*$1 <= length <= 16000Header for an API client-provided JWT assertion that identifies the merchant. Establishing the consent to act-on-behalf of a merchant is a prerequisite for using this header.
^.*$1 <= length <= 10000application/json
TypeScript Definitions
Use the request body type in TypeScript.
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
{
"name": "INVALID_REQUEST",
"message": "Request is not well-formed, syntactically incorrect, or violates schema.",
"debug_id": "2f541ace12987",
"details": [
{
"field": "/notify_payer",
"issue": "INVALID_PARAMETER_VALUE",
"description": "The value of a field is invalid.",
"location": "body"
}
],
"links": [
{
"href": "https://developer.paypal.com/docs/api/orders/v2/#error-INVALID_PARAMETER_VALUE",
"rel": "information_link",
"method": "GET"
}
]
}{
"name": "RESOURCE_NOT_FOUND",
"message": "The specified resource does not exist.",
"debug_id": "ccb6f410b107f",
"details": [
{
"issue": "INVALID_RESOURCE_ID",
"description": "Specified resource ID does not exist. Please check the resource ID and try again."
}
],
"links": [
{
"href": "https://developer.paypal.com/docs/api/payments/v2/#error-INVALID_RESOURCE_ID",
"rel": "information_link"
}
]
}{
"name": "UNPROCESSABLE_ENTITY",
"message": "The requested action could not be performed, semantically incorrect, or failed business validation.",
"debug_id": "3178dbf457625",
"details": [
{
"field": "path",
"value": "/status",
"location": "body",
"issue": "CANNOT_PATCH_CANCELLED_TRACKER",
"description": "Cancelled trackers cannot be modified."
}
],
"links": [
{
"href": "https://developer.paypal.com/docs/api/orders/v2/#error-NOT_PATCHABLE",
"rel": "information_link",
"method": "GET"
}
]
}