Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  package com.paypal.api.payments;
  
  import java.util.HashMap;
  import java.util.List;
  import java.util.Map;
  
 
 public class CreditCard  extends PayPalResource {

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;

2 digit card expiry month.
 
 	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 Integer 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 customer to whom this bank account belongs to. Generated and provided by the facilitator. This is required when creating or using a stored funding instrument in vault.
 
State of the funding instrument.
 
 	private String state;

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

 
 	private List<Linkslinks;

Payer ID
 
 	private String payerId;


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(Integer cvv2) {
		this. = cvv2;
		return this;
	}

Getter for cvv2 Returns -1 if cvv2 is null
	public int getCvv2() {
		if (this. == null) {
			return -1;
else {
			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 externalCustomerId
	public CreditCard setExternalCustomerId(String externalCustomerId) {
		this. = externalCustomerId;
		return this;
	}

Getter for externalCustomerId
		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.;
	}


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

Getter for payer ID
	public String getpayerId() {
		return this.;
	}


Creates a new Credit Card Resource (aka Tokenize).

Parameters:
accessToken Access Token used for the API call.
Returns:
CreditCard
Throws:
com.paypal.base.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.base.rest.APIContext used for the API call.
Returns:
CreditCard
Throws:
com.paypal.base.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 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.base.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.base.rest.APIContext used for the API call.
creditCardId String
Returns:
CreditCard
Throws:
com.paypal.base.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 configureAndExecute(apiContext.resourcePathpayLoadCreditCard.class);
	}


Delete the Credit Card resource for the given identifier.

Parameters:
accessToken Access Token used for the API call.
Throws:
com.paypal.base.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.base.rest.APIContext used for the API call.
Throws:
com.paypal.base.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 = "";
		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.base.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.base.rest.APIContext used for the API call.
Returns:
CreditCard
Throws:
com.paypal.base.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 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.base.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.base.rest.APIContext used for the API call.
containerMap Map<String, String>
Returns:
CreditCardHistory
Throws:
com.paypal.base.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 configureAndExecute(apiContext.resourcePathpayLoadCreditCardHistory.class);
	}
New to GrepCode? Check out our FAQ X