On this page
No Headings
Returns all payment tokens for a customer.
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
A unique identifier representing a specific customer in merchant's/partner's system or records.
^[0-9a-zA-Z_-]+$7 <= length <= 36A non-negative, non-zero integer indicating the maximum number of results to return at one time.
51 <= value <= 5A non-negative, non-zero integer representing the page of the results.
11 <= value <= 10A boolean indicating total number of items (total_items) and pages (total_pages) are expected to be returned in the response.
falseSpecifies the request format.
^[A-Za-z0-9/+-]+$1 <= length <= 255TypeScript 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: 200 - List Payment Tokens - Retrieve All Tokens for Customer Id
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;
ListCustomerPaymentTokensInput listCustomerPaymentTokensInput = new ListCustomerPaymentTokensInput
{
CustomerId = "customer_1",
PageSize = 5,
Page = 1,
TotalRequired = false,
};
try
{
ApiResponse<CustomerVaultPaymentTokensResponse> result = await vaultController.ListCustomerPaymentTokensAsync(listCustomerPaymentTokensInput);
}
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: 200 - List Payment Tokens - Retrieve All Tokens for Customer Id
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();
ListCustomerPaymentTokensInput listCustomerPaymentTokensInput = new ListCustomerPaymentTokensInput.Builder(
"customer_1"
)
.pageSize(5)
.page(1)
.totalRequired(false)
.build();
vaultController.listCustomerPaymentTokensAsync(listCustomerPaymentTokensInput).thenAccept(result -> {
System.out.println(result);
}).exceptionally(exception -> {
exception.printStackTrace();
return null;
});
}
}import { Client, Environment, LogLevel, ApiError } from '@paypal/paypal-server-sdk';
// Scenario: 200 - List Payment Tokens - Retrieve All Tokens for Customer Id
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 collect = {
customerId: 'customer_1',
pageSize: 5,
page: 1,
totalRequired: false
}
try {
const response = await vaultController.listCustomerPaymentTokens(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
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
# Scenario: 200 - List Payment Tokens - Retrieve All Tokens for Customer Id
collect = {
'customer_id': 'customer_1',
'page_size': 5,
'page': 1,
'total_required': False
}
result = vault_controller.list_customer_payment_tokens(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();
$VaultController = $client->getVaultController();
// Scenario: 200 - List Payment Tokens - Retrieve All Tokens for Customer Id
$collect = [
'customerId' => 'customer_1',
'pageSize' => 5,
'page' => 1,
'totalRequired' => false
];
$apiResponse = $vaultController->listCustomerPaymentTokens($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)
)
)
vault_controller = client.vault_controller
# Scenario: 200 - List Payment Tokens - Retrieve All Tokens for Customer Id
collect = {
'customer_id' => 'customer_1',
'page_size' => 5,
'page' => 1,
'total_required' => false
}
result = vault_controller.list_customer_payment_tokens(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()
{
// Scenario: 200 - List Payment Tokens - Retrieve All Tokens for Customer Id - No Tokens Found
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;
ListCustomerPaymentTokensInput listCustomerPaymentTokensInput = new ListCustomerPaymentTokensInput
{
CustomerId = "customer_1",
PageSize = 5,
Page = 1,
TotalRequired = false,
};
try
{
ApiResponse<CustomerVaultPaymentTokensResponse> result = await vaultController.ListCustomerPaymentTokensAsync(listCustomerPaymentTokensInput);
}
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: 200 - List Payment Tokens - Retrieve All Tokens for Customer Id - No Tokens Found
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();
ListCustomerPaymentTokensInput listCustomerPaymentTokensInput = new ListCustomerPaymentTokensInput.Builder(
"customer_1"
)
.pageSize(5)
.page(1)
.totalRequired(false)
.build();
vaultController.listCustomerPaymentTokensAsync(listCustomerPaymentTokensInput).thenAccept(result -> {
System.out.println(result);
}).exceptionally(exception -> {
exception.printStackTrace();
return null;
});
}
}import { Client, Environment, LogLevel, ApiError } from '@paypal/paypal-server-sdk';
// Scenario: 200 - List Payment Tokens - Retrieve All Tokens for Customer Id - No Tokens Found
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 collect = {
customerId: 'customer_1',
pageSize: 5,
page: 1,
totalRequired: false
}
try {
const response = await vaultController.listCustomerPaymentTokens(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
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
# Scenario: 200 - List Payment Tokens - Retrieve All Tokens for Customer Id - No Tokens Found
collect = {
'customer_id': 'customer_1',
'page_size': 5,
'page': 1,
'total_required': False
}
result = vault_controller.list_customer_payment_tokens(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();
$VaultController = $client->getVaultController();
// Scenario: 200 - List Payment Tokens - Retrieve All Tokens for Customer Id - No Tokens Found
$collect = [
'customerId' => 'customer_1',
'pageSize' => 5,
'page' => 1,
'totalRequired' => false
];
$apiResponse = $vaultController->listCustomerPaymentTokens($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)
)
)
vault_controller = client.vault_controller
# Scenario: 200 - List Payment Tokens - Retrieve All Tokens for Customer Id - No Tokens Found
collect = {
'customer_id' => 'customer_1',
'page_size' => 5,
'page' => 1,
'total_required' => false
}
result = vault_controller.list_customer_payment_tokens(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()
{
// Scenario: 400 - List Payment Tokens - 400 Bad 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();
VaultController vaultController = client.VaultController;
ListCustomerPaymentTokensInput listCustomerPaymentTokensInput = new ListCustomerPaymentTokensInput
{
CustomerId = "customer_1",
PageSize = 5,
Page = 1,
TotalRequired = false,
};
try
{
ApiResponse<CustomerVaultPaymentTokensResponse> result = await vaultController.ListCustomerPaymentTokensAsync(listCustomerPaymentTokensInput);
}
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 - List Payment Tokens - 400 Bad 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();
VaultController vaultController = client.getVaultController();
ListCustomerPaymentTokensInput listCustomerPaymentTokensInput = new ListCustomerPaymentTokensInput.Builder(
"customer_1"
)
.pageSize(5)
.page(1)
.totalRequired(false)
.build();
vaultController.listCustomerPaymentTokensAsync(listCustomerPaymentTokensInput).thenAccept(result -> {
System.out.println(result);
}).exceptionally(exception -> {
exception.printStackTrace();
return null;
});
}
}import { Client, Environment, LogLevel, ApiError } from '@paypal/paypal-server-sdk';
// Scenario: 400 - List Payment Tokens - 400 Bad Request
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 collect = {
customerId: 'customer_1',
pageSize: 5,
page: 1,
totalRequired: false
}
try {
const response = await vaultController.listCustomerPaymentTokens(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
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
# Scenario: 400 - List Payment Tokens - 400 Bad Request
collect = {
'customer_id': 'customer_1',
'page_size': 5,
'page': 1,
'total_required': False
}
result = vault_controller.list_customer_payment_tokens(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();
$VaultController = $client->getVaultController();
// Scenario: 400 - List Payment Tokens - 400 Bad Request
$collect = [
'customerId' => 'customer_1',
'pageSize' => 5,
'page' => 1,
'totalRequired' => false
];
$apiResponse = $vaultController->listCustomerPaymentTokens($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)
)
)
vault_controller = client.vault_controller
# Scenario: 400 - List Payment Tokens - 400 Bad Request
collect = {
'customer_id' => 'customer_1',
'page_size' => 5,
'page' => 1,
'total_required' => false
}
result = vault_controller.list_customer_payment_tokens(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()
{
// Scenario: 403 - List Payment Tokens - 403 Forbidden 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;
ListCustomerPaymentTokensInput listCustomerPaymentTokensInput = new ListCustomerPaymentTokensInput
{
CustomerId = "customer_1",
PageSize = 5,
Page = 1,
TotalRequired = false,
};
try
{
ApiResponse<CustomerVaultPaymentTokensResponse> result = await vaultController.ListCustomerPaymentTokensAsync(listCustomerPaymentTokensInput);
}
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 - List Payment Tokens - 403 Forbidden 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();
ListCustomerPaymentTokensInput listCustomerPaymentTokensInput = new ListCustomerPaymentTokensInput.Builder(
"customer_1"
)
.pageSize(5)
.page(1)
.totalRequired(false)
.build();
vaultController.listCustomerPaymentTokensAsync(listCustomerPaymentTokensInput).thenAccept(result -> {
System.out.println(result);
}).exceptionally(exception -> {
exception.printStackTrace();
return null;
});
}
}import { Client, Environment, LogLevel, ApiError } from '@paypal/paypal-server-sdk';
// Scenario: 403 - List Payment Tokens - 403 Forbidden 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 collect = {
customerId: 'customer_1',
pageSize: 5,
page: 1,
totalRequired: false
}
try {
const response = await vaultController.listCustomerPaymentTokens(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
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
# Scenario: 403 - List Payment Tokens - 403 Forbidden Error
collect = {
'customer_id': 'customer_1',
'page_size': 5,
'page': 1,
'total_required': False
}
result = vault_controller.list_customer_payment_tokens(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();
$VaultController = $client->getVaultController();
// Scenario: 403 - List Payment Tokens - 403 Forbidden Error
$collect = [
'customerId' => 'customer_1',
'pageSize' => 5,
'page' => 1,
'totalRequired' => false
];
$apiResponse = $vaultController->listCustomerPaymentTokens($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)
)
)
vault_controller = client.vault_controller
# Scenario: 403 - List Payment Tokens - 403 Forbidden Error
collect = {
'customer_id' => 'customer_1',
'page_size' => 5,
'page' => 1,
'total_required' => false
}
result = vault_controller.list_customer_payment_tokens(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()
{
// Scenario: 500 - List Payment Tokens - 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;
ListCustomerPaymentTokensInput listCustomerPaymentTokensInput = new ListCustomerPaymentTokensInput
{
CustomerId = "customer_1",
PageSize = 5,
Page = 1,
TotalRequired = false,
};
try
{
ApiResponse<CustomerVaultPaymentTokensResponse> result = await vaultController.ListCustomerPaymentTokensAsync(listCustomerPaymentTokensInput);
}
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 - List Payment Tokens - 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();
ListCustomerPaymentTokensInput listCustomerPaymentTokensInput = new ListCustomerPaymentTokensInput.Builder(
"customer_1"
)
.pageSize(5)
.page(1)
.totalRequired(false)
.build();
vaultController.listCustomerPaymentTokensAsync(listCustomerPaymentTokensInput).thenAccept(result -> {
System.out.println(result);
}).exceptionally(exception -> {
exception.printStackTrace();
return null;
});
}
}import { Client, Environment, LogLevel, ApiError } from '@paypal/paypal-server-sdk';
// Scenario: 500 - List Payment Tokens - 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 collect = {
customerId: 'customer_1',
pageSize: 5,
page: 1,
totalRequired: false
}
try {
const response = await vaultController.listCustomerPaymentTokens(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
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
# Scenario: 500 - List Payment Tokens - 500 Internal Server Error
collect = {
'customer_id': 'customer_1',
'page_size': 5,
'page': 1,
'total_required': False
}
result = vault_controller.list_customer_payment_tokens(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();
$VaultController = $client->getVaultController();
// Scenario: 500 - List Payment Tokens - 500 Internal Server Error
$collect = [
'customerId' => 'customer_1',
'pageSize' => 5,
'page' => 1,
'totalRequired' => false
];
$apiResponse = $vaultController->listCustomerPaymentTokens($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)
)
)
vault_controller = client.vault_controller
# Scenario: 500 - List Payment Tokens - 500 Internal Server Error
collect = {
'customer_id' => 'customer_1',
'page_size' => 5,
'page' => 1,
'total_required' => false
}
result = vault_controller.list_customer_payment_tokens(collect)
if result.success?
puts result.data
elsif result.error?
warn result.errors
endResponse samples
{
"customer": {
"id": "BygeLlrpZF",
"merchant_customer_id": "customer@example.com"
},
"payment_tokens": [
{
"id": "8kk8451t",
"payment_source": {
"card": {
"last_digits": "1111",
"expiry": "2027-02",
"brand": "VISA",
"name": "John Doe"
}
},
"links": [
{
"rel": "self",
"href": "https://api-m.paypal.com/v3/vault/payment-tokens/8kk8451t",
"method": "GET"
},
{
"rel": "delete",
"href": "https://api-m.paypal.com/v3/vault/payment-tokens/8kk8451t",
"method": "DELETE"
}
]
}
],
"links": [
{
"rel": "self",
"href": "https://api-m.paypal.com/v3/vault/payment-tokens?customer_id=BygeLlrpZF",
"method": "GET"
}
]
}{
"customer": {
"id": "BygeLlrpZF"
},
"payment_tokens": [],
"links": [
{
"rel": "self",
"href": "https://api-m.paypal.com/v3/vault/payment-tokens?customer_id=BygeLlrpZF",
"method": "GET"
}
]
}{
"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"
}