On this page
No Headings
Delete the payment token associated with the payment token id.
Oauth2 https://uri.paypal.com/services/vault/payment-tokens/readwriteOauth 2.0 authentication
In: header
Scope: https://uri.paypal.com/services/vault/payment-tokens/readwrite
ID of the setup token.
^[0-9a-zA-Z_-]+$7 <= length <= 36Specifies the request format.
^[A-Za-z0-9/+-]+$1 <= length <= 255application/json
TypeScript Definitions
Use the request body type in TypeScript.
application/json
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()
{
// Scenario: 204 - Delete Payment Token
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();
VaultController vaultController = client.VaultController;
string id = "5O190127TN364715T";
try
{
await vaultController.DeletePaymentTokenAsync(id);
}
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.VaultController;
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: 204 - Delete Payment Token
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();
VaultController vaultController = client.getVaultController();
String id = "5O190127TN364715T";
vaultController.deletePaymentTokenAsync(id).thenAccept(result -> {
System.out.println(result);
}).exceptionally(exception -> {
exception.printStackTrace();
return null;
});
}
}import { Client, Environment, LogLevel, ApiError } from '@paypal/paypal-server-sdk';
// Scenario: 204 - Delete Payment Token
const client = new Client({
clientCredentialsAuthCredentials: {
oAuthClientId: 'OAuthClientId',
oAuthClientSecret: 'OAuthClientSecret'
},
environment: Environment.Sandbox,
logging: {
logLevel: LogLevel.Info,
logRequest: { logBody: true },
logResponse: { logHeaders: true },
},
});
const vaultController = client.vaultController;
const id = '5O190127TN364715T';
try {
const response = await vaultController.deletePaymentToken(id);
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
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)
)
)
vault_controller = client.vault_controller
id = '5O190127TN364715T'
# Scenario: 204 - Delete Payment Token
result = vault_controller.delete_payment_token(id)
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();
$VaultController = $client->getVaultController();
$id = '5O190127TN364715T';
// Scenario: 204 - Delete Payment Token
$apiResponse = $vaultController->deletePaymentToken($id);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)
)
)
vault_controller = client.vault_controller
id = '5O190127TN364715T'
# Scenario: 204 - Delete Payment Token
result = vault_controller.delete_payment_token(id)
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()
{
// Scenario: 400 - Delete Payment Token - 400 Bad Request Error - Invalid Parameter Syntax
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();
VaultController vaultController = client.VaultController;
string id = "5O190127TN364715T";
try
{
await vaultController.DeletePaymentTokenAsync(id);
}
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.VaultController;
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 - Delete Payment Token - 400 Bad Request Error - Invalid Parameter Syntax
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();
VaultController vaultController = client.getVaultController();
String id = "5O190127TN364715T";
vaultController.deletePaymentTokenAsync(id).thenAccept(result -> {
System.out.println(result);
}).exceptionally(exception -> {
exception.printStackTrace();
return null;
});
}
}import { Client, Environment, LogLevel, ApiError } from '@paypal/paypal-server-sdk';
// Scenario: 400 - Delete Payment Token - 400 Bad Request Error - Invalid Parameter Syntax
const client = new Client({
clientCredentialsAuthCredentials: {
oAuthClientId: 'OAuthClientId',
oAuthClientSecret: 'OAuthClientSecret'
},
environment: Environment.Sandbox,
logging: {
logLevel: LogLevel.Info,
logRequest: { logBody: true },
logResponse: { logHeaders: true },
},
});
const vaultController = client.vaultController;
const id = '5O190127TN364715T';
try {
const response = await vaultController.deletePaymentToken(id);
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
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)
)
)
vault_controller = client.vault_controller
id = '5O190127TN364715T'
# Scenario: 400 - Delete Payment Token - 400 Bad Request Error - Invalid Parameter Syntax
result = vault_controller.delete_payment_token(id)
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();
$VaultController = $client->getVaultController();
$id = '5O190127TN364715T';
// Scenario: 400 - Delete Payment Token - 400 Bad Request Error - Invalid Parameter Syntax
$apiResponse = $vaultController->deletePaymentToken($id);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)
)
)
vault_controller = client.vault_controller
id = '5O190127TN364715T'
# Scenario: 400 - Delete Payment Token - 400 Bad Request Error - Invalid Parameter Syntax
result = vault_controller.delete_payment_token(id)
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()
{
// Scenario: 403 - Delete Payment Token - 403 Forbidden Error - No Permission for the Payment Token
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();
VaultController vaultController = client.VaultController;
string id = "5O190127TN364715T";
try
{
await vaultController.DeletePaymentTokenAsync(id);
}
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.VaultController;
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: 403 - Delete Payment Token - 403 Forbidden Error - No Permission for the Payment Token
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();
VaultController vaultController = client.getVaultController();
String id = "5O190127TN364715T";
vaultController.deletePaymentTokenAsync(id).thenAccept(result -> {
System.out.println(result);
}).exceptionally(exception -> {
exception.printStackTrace();
return null;
});
}
}import { Client, Environment, LogLevel, ApiError } from '@paypal/paypal-server-sdk';
// Scenario: 403 - Delete Payment Token - 403 Forbidden Error - No Permission for the Payment Token
const client = new Client({
clientCredentialsAuthCredentials: {
oAuthClientId: 'OAuthClientId',
oAuthClientSecret: 'OAuthClientSecret'
},
environment: Environment.Sandbox,
logging: {
logLevel: LogLevel.Info,
logRequest: { logBody: true },
logResponse: { logHeaders: true },
},
});
const vaultController = client.vaultController;
const id = '5O190127TN364715T';
try {
const response = await vaultController.deletePaymentToken(id);
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
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)
)
)
vault_controller = client.vault_controller
id = '5O190127TN364715T'
# Scenario: 403 - Delete Payment Token - 403 Forbidden Error - No Permission for the Payment Token
result = vault_controller.delete_payment_token(id)
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();
$VaultController = $client->getVaultController();
$id = '5O190127TN364715T';
// Scenario: 403 - Delete Payment Token - 403 Forbidden Error - No Permission for the Payment Token
$apiResponse = $vaultController->deletePaymentToken($id);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)
)
)
vault_controller = client.vault_controller
id = '5O190127TN364715T'
# Scenario: 403 - Delete Payment Token - 403 Forbidden Error - No Permission for the Payment Token
result = vault_controller.delete_payment_token(id)
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()
{
// Scenario: 500 - Delete Payment Token - 500 Internal Server Error
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();
VaultController vaultController = client.VaultController;
string id = "5O190127TN364715T";
try
{
await vaultController.DeletePaymentTokenAsync(id);
}
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.VaultController;
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: 500 - Delete Payment Token - 500 Internal Server Error
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();
VaultController vaultController = client.getVaultController();
String id = "5O190127TN364715T";
vaultController.deletePaymentTokenAsync(id).thenAccept(result -> {
System.out.println(result);
}).exceptionally(exception -> {
exception.printStackTrace();
return null;
});
}
}import { Client, Environment, LogLevel, ApiError } from '@paypal/paypal-server-sdk';
// Scenario: 500 - Delete Payment Token - 500 Internal Server Error
const client = new Client({
clientCredentialsAuthCredentials: {
oAuthClientId: 'OAuthClientId',
oAuthClientSecret: 'OAuthClientSecret'
},
environment: Environment.Sandbox,
logging: {
logLevel: LogLevel.Info,
logRequest: { logBody: true },
logResponse: { logHeaders: true },
},
});
const vaultController = client.vaultController;
const id = '5O190127TN364715T';
try {
const response = await vaultController.deletePaymentToken(id);
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
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)
)
)
vault_controller = client.vault_controller
id = '5O190127TN364715T'
# Scenario: 500 - Delete Payment Token - 500 Internal Server Error
result = vault_controller.delete_payment_token(id)
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();
$VaultController = $client->getVaultController();
$id = '5O190127TN364715T';
// Scenario: 500 - Delete Payment Token - 500 Internal Server Error
$apiResponse = $vaultController->deletePaymentToken($id);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)
)
)
vault_controller = client.vault_controller
id = '5O190127TN364715T'
# Scenario: 500 - Delete Payment Token - 500 Internal Server Error
result = vault_controller.delete_payment_token(id)
if result.success?
puts result.data
elsif result.error?
warn result.errors
endResponse samples
{}{
"name": "INVALID_REQUEST",
"message": "Request is not well-formed, syntactically incorrect, or violates schema.",
"debug_id": "b6e45c51e8e16",
"details": [
{
"issue": "INVALID_PARAMETER_SYNTAX",
"description": "The value of a field does not conform to the expected format."
}
],
"links": [
{
"href": "https://developer.paypal.com/docs/api/overview/#error",
"rel": "information_link"
}
]
}{
"name": "NOT_AUTHORIZED",
"message": "Authorization failed due to insufficient permissions.",
"debug_id": "9ecb6d8e2e112",
"details": [
{
"issue": "PERMISSION_DENIED",
"description": "You do not have permission to access or perform operations on this resource."
}
],
"links": [
{
"href": "https://developer.paypal.com/docs/api/overview/#error",
"rel": "information_link"
}
]
}{
"name": "INTERNAL_SERVER_ERROR",
"message": "An internal server error has occurred.",
"debug_id": "z9x8y7w6v5u43"
}