Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  package com.paypal.api.payments;
  
  import java.util.List;
  import java.util.Map;
 import java.io.File;
 
 public class CreditCard  {

ID of the credit card being saved for later use.
 
 	private String id;

Card number.
 
 	private String number;

Type of the Card (eg. Visa, Mastercard, etc.).
 
 	private String type;

card expiry month with value 1 - 12.
 
 	private int expireMonth;

4 digit card expiry year
 
 	private int expireYear;

Card validation code. Only supported when making a Payment but not when saving a credit card for future use.
 
 	private String cvv2;

Card holder's first name.
 
 	private String firstName;

Card holder's last name.
 
 	private String lastName;

Billing Address associated with this card.
 
 	private Address billingAddress;

A unique identifier of the payer generated and provided by the facilitator. This is required when creating or using a tokenized funding instrument.
 
 	private String payerId;

State of the funding instrument.
 
 	private String state;

Date/Time until this resource can be used fund a payment.
 
 	private String validUntil;

 
 	private List<Linkslinks;

Returns the last request sent to the Service

Returns:
Last request sent to the server
 
 	public static String getLastRequest() {
 		return PayPalResource.getLastRequest();
 	}

Returns the last response returned by the Service

Returns:
Last response got from the Service
	public static String getLastResponse() {
		return PayPalResource.getLastResponse();
	}

Initialize using InputStream(of a Properties file)

Parameters:
is InputStream
Throws:
com.paypal.core.rest.PayPalRESTException
	public static void initConfig(InputStream isthrows PayPalRESTException {
		PayPalResource.initConfig(is);
	}

Initialize using a File(Properties file)

Parameters:
file File object of a properties entity
Throws:
com.paypal.core.rest.PayPalRESTException
	public static void initConfig(File filethrows PayPalRESTException {
		PayPalResource.initConfig(file);
	}

Initialize using Properties

Parameters:
properties Properties object
	public static void initConfig(Properties properties) {
		PayPalResource.initConfig(properties);
	}
Default Constructor
	public CreditCard() {
	}

Parameterized Constructor
	public CreditCard(String numberString typeint expireMonthint expireYear) {
		this. = number;
		this. = type;
		this. = expireMonth;
		this. = expireYear;
	}


Setter for id
	public CreditCard setId(String id) {
		this. = id;
		return this;
	}

Getter for id
	public String getId() {
		return this.;
	}


Setter for number
	public CreditCard setNumber(String number) {
		this. = number;
		return this;
	}

Getter for number
	public String getNumber() {
		return this.;
	}


Setter for type
	public CreditCard setType(String type) {
		this. = type;
		return this;
	}

Getter for type
	public String getType() {
		return this.;
	}


Setter for expireMonth
	public CreditCard setExpireMonth(int expireMonth) {
		this. = expireMonth;
		return this;
	}

Getter for expireMonth
	public int getExpireMonth() {
		return this.;
	}


Setter for expireYear
	public CreditCard setExpireYear(int expireYear) {
		this. = expireYear;
		return this;
	}

Getter for expireYear
	public int getExpireYear() {
		return this.;
	}


Setter for cvv2
	public CreditCard setCvv2(String cvv2) {
		this. = cvv2;
		return this;
	}

Getter for cvv2
	public String getCvv2() {
		return this.;
	}


Setter for firstName
	public CreditCard setFirstName(String firstName) {
		this. = firstName;
		return this;
	}

Getter for firstName
	public String getFirstName() {
		return this.;
	}


Setter for lastName
	public CreditCard setLastName(String lastName) {
		this. = lastName;
		return this;
	}

Getter for lastName
	public String getLastName() {
		return this.;
	}


Setter for billingAddress
	public CreditCard setBillingAddress(Address billingAddress) {
		this. = billingAddress;
		return this;
	}

Getter for billingAddress
		return this.;
	}


Setter for payerId
	public CreditCard setPayerId(String payerId) {
		this. = payerId;
		return this;
	}

Getter for payerId
	public String getPayerId() {
		return this.;
	}


Setter for state
	public CreditCard setState(String state) {
		this. = state;
		return this;
	}

Getter for state
	public String getState() {
		return this.;
	}


Setter for validUntil
	public CreditCard setValidUntil(String validUntil) {
		this. = validUntil;
		return this;
	}

Getter for validUntil
	public String getValidUntil() {
		return this.;
	}


Setter for links
	public CreditCard setLinks(List<Linkslinks) {
		this. = links;
		return this;
	}

Getter for links
	public List<LinksgetLinks() {
		return this.;
	}


Creates a new Credit Card Resource (aka Tokenize).

Parameters:
accessToken Access Token used for the API call.
Returns:
CreditCard
Throws:
com.paypal.core.rest.PayPalRESTException
	public CreditCard create(String accessTokenthrows PayPalRESTException {
		APIContext apiContext = new APIContext(accessToken);
		return create(apiContext);
	}

Creates a new Credit Card Resource (aka Tokenize).

Parameters:
apiContext com.paypal.core.rest.APIContext used for the API call.
Returns:
CreditCard
Throws:
com.paypal.core.rest.PayPalRESTException
	public CreditCard create(APIContext apiContextthrows PayPalRESTException {
		if (apiContext == null) {
			throw new IllegalArgumentException("APIContext cannot be null");
		}
		if (apiContext.getAccessToken() == null || apiContext.getAccessToken().trim().length() <= 0) {
			throw new IllegalArgumentException("AccessToken cannot be null or empty");
		}
		if (apiContext.getHTTPHeaders() == null) {
			apiContext.setHTTPHeaders(new HashMap<StringString>());
		}
		apiContext.setSdkVersion(new SDKVersionImpl());
		String resourcePath = "v1/vault/credit-card";
		String payLoad = this.toJSON();
		return PayPalResource.configureAndExecute(apiContext.resourcePathpayLoadCreditCard.class);
	}


Obtain the Credit Card resource for the given identifier.

Parameters:
accessToken Access Token used for the API call.
creditCardId String
Returns:
CreditCard
Throws:
com.paypal.core.rest.PayPalRESTException
	public static CreditCard get(String accessTokenString creditCardIdthrows PayPalRESTException {
		APIContext apiContext = new APIContext(accessToken);
		return get(apiContextcreditCardId);
	}

Obtain the Credit Card resource for the given identifier.

Parameters:
apiContext com.paypal.core.rest.APIContext used for the API call.
creditCardId String
Returns:
CreditCard
Throws:
com.paypal.core.rest.PayPalRESTException
	public static CreditCard get(APIContext apiContextString creditCardIdthrows PayPalRESTException {
		if (apiContext == null) {
			throw new IllegalArgumentException("APIContext cannot be null");
		}
		if (apiContext.getAccessToken() == null || apiContext.getAccessToken().trim().length() <= 0) {
			throw new IllegalArgumentException("AccessToken cannot be null or empty");
		}
		if (apiContext.getHTTPHeaders() == null) {
			apiContext.setHTTPHeaders(new HashMap<StringString>());
		}
		apiContext.setSdkVersion(new SDKVersionImpl());
		if (creditCardId == null) {
			throw new IllegalArgumentException("creditCardId cannot be null");
		}
		Object[] parameters = new Object[] {creditCardId};
		String pattern = "v1/vault/credit-card/{0}";
		String resourcePath = RESTUtil.formatURIPath(patternparameters);
		String payLoad = "";
		return PayPalResource.configureAndExecute(apiContext.resourcePathpayLoadCreditCard.class);
	}


Delete the Credit Card resource for the given identifier.

Parameters:
accessToken Access Token used for the API call.
Returns:
Throws:
com.paypal.core.rest.PayPalRESTException
	public void delete(String accessTokenthrows PayPalRESTException {
		APIContext apiContext = new APIContext(accessToken);
		delete(apiContext);
		return;
	}

Delete the Credit Card resource for the given identifier.

Parameters:
apiContext com.paypal.core.rest.APIContext used for the API call.
Returns:
Throws:
com.paypal.core.rest.PayPalRESTException
	public void delete(APIContext apiContextthrows PayPalRESTException {
		if (apiContext == null) {
			throw new IllegalArgumentException("APIContext cannot be null");
		}
		if (apiContext.getAccessToken() == null || apiContext.getAccessToken().trim().length() <= 0) {
			throw new IllegalArgumentException("AccessToken cannot be null or empty");
		}
		if (apiContext.getHTTPHeaders() == null) {
			apiContext.setHTTPHeaders(new HashMap<StringString>());
		}
		apiContext.setSdkVersion(new SDKVersionImpl());
		if (this.getId() == null) {
			throw new IllegalArgumentException("Id cannot be null");
		}
			apiContext.setMaskRequestId(true);
		Object[] parameters = new Object[] {this.getId()};
		String pattern = "v1/vault/credit-card/{0}";
		String resourcePath = RESTUtil.formatURIPath(patternparameters);
		String payLoad = "";
		PayPalResource.configureAndExecute(apiContext.resourcePathpayLoadnull);
		return;
	}


Update information in a previously saved card. Only the modified fields need to be passed in the request.

Parameters:
accessToken Access Token used for the API call.
Returns:
CreditCard
Throws:
com.paypal.core.rest.PayPalRESTException
	public CreditCard update(String accessTokenthrows PayPalRESTException {
		APIContext apiContext = new APIContext(accessToken);
		return update(apiContext);
	}

Update information in a previously saved card. Only the modified fields need to be passed in the request.

Parameters:
apiContext com.paypal.core.rest.APIContext used for the API call.
Returns:
CreditCard
Throws:
com.paypal.core.rest.PayPalRESTException
	public CreditCard update(APIContext apiContextthrows PayPalRESTException {
		if (apiContext == null) {
			throw new IllegalArgumentException("APIContext cannot be null");
		}
		if (apiContext.getAccessToken() == null || apiContext.getAccessToken().trim().length() <= 0) {
			throw new IllegalArgumentException("AccessToken cannot be null or empty");
		}
		if (apiContext.getHTTPHeaders() == null) {
			apiContext.setHTTPHeaders(new HashMap<StringString>());
		}
		apiContext.setSdkVersion(new SDKVersionImpl());
		if (this.getId() == null) {
			throw new IllegalArgumentException("Id cannot be null");
		}
		Object[] parameters = new Object[] {this.getId()};
		String pattern = "v1/vault/credit-card/{0}";
		String resourcePath = RESTUtil.formatURIPath(patternparameters);
		String payLoad = this.toJSON();
		return PayPalResource.configureAndExecute(apiContext.resourcePathpayLoadCreditCard.class);
	}


Retrieves a list of Credit Card resources.

Parameters:
accessToken Access Token used for the API call.
containerMap Map<String, String>
Returns:
CreditCardHistory
Throws:
com.paypal.core.rest.PayPalRESTException
	public static CreditCardHistory list(String accessTokenMap<StringStringcontainerMapthrows PayPalRESTException {
		APIContext apiContext = new APIContext(accessToken);
		return list(apiContextcontainerMap);
	}

Retrieves a list of Credit Card resources.

Parameters:
apiContext com.paypal.core.rest.APIContext used for the API call.
containerMap Map<String, String>
Returns:
CreditCardHistory
Throws:
com.paypal.core.rest.PayPalRESTException
	public static CreditCardHistory list(APIContext apiContextMap<StringStringcontainerMapthrows PayPalRESTException {
		if (apiContext == null) {
			throw new IllegalArgumentException("APIContext cannot be null");
		}
		if (apiContext.getAccessToken() == null || apiContext.getAccessToken().trim().length() <= 0) {
			throw new IllegalArgumentException("AccessToken cannot be null or empty");
		}
		if (apiContext.getHTTPHeaders() == null) {
			apiContext.setHTTPHeaders(new HashMap<StringString>());
		}
		apiContext.setSdkVersion(new SDKVersionImpl());
		if (containerMap == null) {
			throw new IllegalArgumentException("containerMap cannot be null");
		}
		Object[] parameters = new Object[] {containerMap};
		String pattern = "v1/vault/credit-card?count={0}&start_id={1}&start_index={2}&start_time={3}&end_time={4}&payer_id={5}";
		String resourcePath = RESTUtil.formatURIPath(patternparameters);
		String payLoad = "";
		return PayPalResource.configureAndExecute(apiContext.resourcePathpayLoadCreditCardHistory.class);
	}

Returns a JSON string corresponding to object state

Returns:
JSON representation
	public String toJSON() {
		return JSONFormatter.toJSON(this);
	}
	public String toString() {
		return toJSON();
	}
New to GrepCode? Check out our FAQ X