All docs This doc
Skip to end of metadata
Go to start of metadata


The following operations allow you to work with sales and refunds. Click an operation name to see details on how to use it.

For a sample proxy service the illustrates how to work with sales and refunds, see Sample configuration.



Looks up details on a sale transaction


Refunds a completed payment


Looks up details about a specific refund

Operation details

This section provides details on each of the operations.

Looking up details on a sale transaction 

Use this operation to get details about a sale transaction.



  • id: Required - The transaction ID.
Sample request

Following is a sample REST request that can be handled by the lookupSale operation.

Sample request for lookupSale

Related PayPal documentation

Refunding a sale 

Use this operation to refund a completed payment. For partial refunds, you can include an amount.



  • saleId: Required - ID of the sale.
  • total: Required - Total amount charged from the payer to the payee. In case of a refund, this is the refunded amount to the original payer from the payee. 10 characters max. with support for two decimal places.
  • currency: Required - 3-letter currency code. PayPal does not support all currencies.
Sample request

Following is a sample REST request that can be handled by the refundSale operation.

Sample request for refundSale

Related PayPal documentation

Looking up a refund 

Use this call to get details about a specific refund. To get a list of your refunds, you can first get a list of payments. Within the list, you can see the state of the sale object as refunded and a refund object with the state of completed.

  • refundId: Required - ID of the refund.
Sample request

Following is a sample REST request that can be handled by the lookupRefund operation.

Sample request for lookupRefund

Related PayPal documentation

Sample configuration

Following is a sample proxy service that illustrates how to connect to PayPal with the init operation and use the lookupSale operation. The sample request for this proxy can be found in lookupSale sample request. You can use this sample as a template for using other operations in this category.

 As a best practice, create a separate sequence for handling the response payload for errors. In the following sample, this sequence is "faultHandlerSeq".

Sample Proxy
<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns=""
      <inSequence onError="faultHandlerSeq">
         <property name="apiUrl" expression="json-eval($.apiUrl)"/>
         <property name="accessToken" expression="json-eval($.accessToken)"/>
         <property name="id" expression="json-eval($.id)"/>
         <filter source="$axis2:HTTP_SC" regex="^[^2][\d][\d]">
               <property name="ERROR_CODE" expression="$axis2:HTTP_SC"/>
               <switch source="$axis2:HTTP_SC">
                  <case regex="401">
                     <property name="ERROR_MESSAGE" value="Unauthorized"/>
                  <case regex="404">
                     <property name="ERROR_MESSAGE" value="Not Found"/>
                  <case regex="400">
                     <property name="ERROR_MESSAGE" value="Bad Request"/>
                     <property name="error_description" expression="json-eval($.error_description)"/>
               <sequence key="faultHandlerSeq"/>
         <log level="custom">
            <property name="text" value="An unexpected error occured"/>
            <property name="message" expression="get-property('ERROR_MESSAGE')"/>
  • No labels