How to Make a Basic Refund Using the Merchant API
Important: This integration method is deprecated as of January 1, 2017. PayPal continues to support existing merchants using this method, but please be advised new features and enhancements will not be applied to these integrations. For new integrations, see the PayPal Checkout Integration Guide.
You can use the RefundTransaction
call, which is part of the Merchant API, to make a full or partial refund to a customer.
The default refund period is 180 days from the transaction date.
If you refund a payment for goods or services, there are no fees to make the refund, but the fees you originally paid as the seller are not returned to you. The amount of the refunded payment will be deducted from your PayPal account.
If a transaction occurred after the default refund period of 180 days, you cannot use the RefundTransaction
API operation to issue the refund. For more information, see the RefundTransaction
(NVP | SOAP) API Operation.
For more about refunds, see All about refunds at PayPal.
Step 1: Process a Payment and Store the Transaction ID
In the RefundTransaction call, you will use a PayPal transaction ID from a payment that has been processed.
The following documents show examples of how to process a payment and obtain a PayPal transaction ID:
- How to Authorize and Process a Credit Card Payment Using Direct Payment. Use the value of
TRANSACTIONID
, returned by theDoCapture
call. - How to Use Express Checkout to Create One-Time Payments. Use the value of
PAYMENTINFO_0_TRANSACTIONID
, returned by theDoExpressCheckoutPayment
call.
Step 2: Refund the Customer
To use a transaction ID in a RefundTransaction
call, replace the value of transaction_ID
in the example below with a transaction ID from Step 1.
The following example shows how to make a full refund. (To make a partial refund, see the "Issuing Refunds" section of Related API Operations.)
Request
-------
Endpoint URL: https://api-3t.sandbox.paypal.com/nvp
HTTP method: POST
POST data:
USER=merchant_user_name
&PWD=merchant_password
&SIGNATURE=merchant_signature
&METHOD=RefundTransaction
&VERSION=94
&TRANSACTIONID=transaction_ID #ID of the transaction for which the refund is made
&REFUNDTYPE=Full #Specifies a full refund; a partial refund requires more input fields
Response
--------
REFUNDTRANSACTIONID=7XH234440V8691234 #New transaction ID, for the refund
&FEEREFUNDAMT=0%2e03
&GROSSREFUNDAMT=1%2e00
&NETREFUNDAMT=0%2e97
&CURRENCYCODE=USD
&TOTALREFUNDEDAMOUNT=1%2e00
&ACK=Success
&REFUNDSTATUS=Instant
&PENDINGREASON=None
...