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 Payment  extends PayPalResource {

Identifier of the payment resource created.
 
 	private String id;

Time the resource was created in UTC ISO8601 format.
 
 	private String createTime;

Time the resource was last updated in UTC ISO8601 format.
 
 	private String updateTime;

Intent of the payment - Sale or Authorization or Order.
 
 	private String intent;

    
Payment Experience Web Profile ID to be used for this payment. Experience profile can be obtained by using the Payment Experience API.
 
     private String experienceProfileId;

Source of the funds for this payment represented by a PayPal account or a direct credit card.
 
 	private Payer payer;

 
 	private Payee payee;

Cart for which the payment is done.
 
 	private Object cart;

A payment can have more than one transaction, with each transaction establishing a contract between the payer and a payee
 
state of the payment
 
 	private String state;

Redirect urls required only when using payment_method as PayPal - the only settings supported are return and cancel urls.
 
 
 	private List<Linkslinks;

Default Constructor
 
 	public Payment() {
 	}

Parameterized Constructor
 
 	public Payment(String intentPayer payer) {
 		this. = intent;
 		this. = payer;
 	}
 	
 	public Payee getPayee() {
 		return ;
 	}
 
 	public Payment setPayee(Payee payee) {
 		this. = payee;
 		return this;
 	}

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

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


Setter for createTime
	public Payment setCreateTime(String createTime) {
		this. = createTime;
		return this;
	}

Getter for createTime
	public String getCreateTime() {
		return this.;
	}


Setter for updateTime
	public Payment setUpdateTime(String updateTime) {
		this. = updateTime;
		return this;
	}

Getter for updateTime
	public String getUpdateTime() {
		return this.;
	}


Setter for intent
	public Payment setIntent(String intent) {
		this. = intent;
		return this;
	}

Getter for intent
	public String getIntent() {
		return this.;
	}

    
Getter for Experience Profile ID
    public String getExperienceProfileId() {
        return ;
    }

    
Setter for Experience Profile ID
    public void setExperienceProfileId(String experienceProfileId) {
        this. = experienceProfileId;
    }

    
Setter for payer
	public Payment setPayer(Payer payer) {
		this. = payer;
		return this;
	}

Getter for payer
	public Payer getPayer() {
		return this.;
	}


Setter for cart
	public Payment setCart(Object cart) {
		this. = cart;
		return this;
	}

Getter for cart
	public Object getCart() {
		return this.;
	}


Setter for transactions
	public Payment setTransactions(List<Transactiontransactions) {
		this. = transactions;
		return this;
	}

Getter for transactions
		return this.;
	}


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

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


Setter for redirectUrls
	public Payment setRedirectUrls(RedirectUrls redirectUrls) {
		this. = redirectUrls;
		return this;
	}

Getter for redirectUrls
		return this.;
	}


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

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


Creates (and processes) a new Payment Resource.

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

Creates (and processes) a new Payment Resource.

Parameters:
apiContext com.paypal.base.rest.APIContext used for the API call.
Returns:
Payment
Throws:
com.paypal.base.rest.PayPalRESTException
	public Payment 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/payments/payment";
		String payLoad = this.toJSON();
		return configureAndExecute(apiContext.resourcePathpayLoadPayment.class);
	}


Obtain the Payment resource for the given identifier.

Parameters:
accessToken Access Token used for the API call.
paymentId String
Returns:
Payment
Throws:
com.paypal.base.rest.PayPalRESTException
	public static Payment get(String accessTokenString paymentIdthrows PayPalRESTException {
		APIContext apiContext = new APIContext(accessToken);
		return get(apiContextpaymentId);
	}

Obtain the Payment resource for the given identifier.

Parameters:
apiContext com.paypal.base.rest.APIContext used for the API call.
paymentId String
Returns:
Payment
Throws:
com.paypal.base.rest.PayPalRESTException
	public static Payment get(APIContext apiContextString paymentIdthrows 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 (paymentId == null) {
			throw new IllegalArgumentException("paymentId cannot be null");
		}
		Object[] parameters = new Object[] {paymentId};
		String pattern = "v1/payments/payment/{0}";
		String resourcePath = RESTUtil.formatURIPath(patternparameters);
		String payLoad = "";
		return configureAndExecute(apiContext.resourcePathpayLoadPayment.class);
	}


Executes the payment (after approved by the Payer) associated with this resource when the payment method is PayPal.

Parameters:
accessToken Access Token used for the API call.
paymentExecution PaymentExecution
Returns:
Payment
Throws:
com.paypal.base.rest.PayPalRESTException
	public Payment execute(String accessTokenPaymentExecution paymentExecutionthrows PayPalRESTException {
		APIContext apiContext = new APIContext(accessToken);
		return execute(apiContextpaymentExecution);
	}

Executes the payment (after approved by the Payer) associated with this resource when the payment method is PayPal.

Parameters:
apiContext com.paypal.base.rest.APIContext used for the API call.
paymentExecution PaymentExecution
Returns:
Payment
Throws:
com.paypal.base.rest.PayPalRESTException
	public Payment execute(APIContext apiContextPaymentExecution paymentExecutionthrows 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");
		}
		if (paymentExecution == null) {
			throw new IllegalArgumentException("paymentExecution cannot be null");
		}
		Object[] parameters = new Object[] {this.getId()};
		String pattern = "v1/payments/payment/{0}/execute";
		String resourcePath = RESTUtil.formatURIPath(patternparameters);
		String payLoad = paymentExecution.toJSON();
		return configureAndExecute(apiContext.resourcePathpayLoadPayment.class);
	}

Partially update a payment resource by by passing the payment_id in the request URI. In addition, pass a patch_request_object in the body of the request JSON that specifies the operation to perform, path of the target location, and new value to apply. Please note that it is not possible to use patch after execute has been called.

Parameters:
accessToken Access Token used for the API call.
patchRequest List<Patch>
Returns:
Throws:
com.paypal.base.rest.PayPalRESTException
	public void update(String accessTokenList<PatchpatchRequestthrows PayPalRESTException {
		APIContext apiContext = new APIContext(accessToken);
		update(apiContextpatchRequest);
		return;
	}

Partially update a payment resource by by passing the payment_id in the request URI. In addition, pass a patch_request_object in the body of the request JSON that specifies the operation to perform, path of the target location, and new value to apply. Please note that it is not possible to use patch after execute has been called.

Parameters:
apiContext com.paypal.base.rest.APIContext used for the API call.
patchRequest List<Patch>
Returns:
Throws:
com.paypal.base.rest.PayPalRESTException
	public void update(APIContext apiContextList<PatchpatchRequestthrows 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");
		}
		if (patchRequest == null) {
			throw new IllegalArgumentException("patchRequest cannot be null");
		}
		Object[] parameters = new Object[] {this.getId()};
		String pattern = "v1/payments/payment/{0}";
		String resourcePath = RESTUtil.formatURIPath(patternparameters);
		String payLoad = new GsonBuilder().create().toJson(patchRequest);
		PayPalResource.configureAndExecute(apiContext.resourcePathpayLoadnull);
		return;
	}


Retrieves a list of Payment resources.

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

Retrieves a list of Payment resources.

Parameters:
apiContext com.paypal.base.rest.APIContext used for the API call.
containerMap Map<String, String>
Returns:
PaymentHistory
Throws:
com.paypal.base.rest.PayPalRESTException
	public static PaymentHistory 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/payments/payment?count={0}&start_id={1}&start_index={2}&start_time={3}&end_time={4}&payee_id={5}&sort_by={6}&sort_order={7}";
		String resourcePath = RESTUtil.formatURIPath(patternparameters);
		String payLoad = "";
		return configureAndExecute(apiContext.resourcePathpayLoadPaymentHistory.class);
	}
New to GrepCode? Check out our FAQ X