To ensure our records remain in sync with PayPal, you should only perform refunds through Trust Payments, by submitting a REFUND request as described below. We strongly advise against performing refunds directly using your PayPal admin portal, as changes may not be reflected on Trust Payments’s records.
- Only settled transactions (settle status “100”) can be refunded.
- If the transaction has not settled, you can opt to cancel the payment by updating the settle status to “3”.
Settle status “10”
Standard PayPal refunds are settled immediately (settle status “100”). However, under certain conditions defined by PayPal, refunds can be set to settle status “10” (“settling”), which is an intermediate step prior to settlement.
If a PayPal refund on your account is in settle status “10”, it is recommended you query it with our Support Team in case further actions need to be completed to ensure settlement.
REFUND request
The following is an example of a REFUND request for PayPal:
Ensure you include the parenttransactionreference value returned in the AUTH response of the transaction to be refunded (NOT from the ORDER or ORDERDETAILS responses).
#!/usr/bin/python
import securetrading
stconfig = securetrading.Config()
stconfig.username = "webservices@securetrading.net"
stconfig.password = "password"
st = securetrading.Api(stconfig)
refund = {
"requesttypedescriptions": ["REFUND"],
"sitereference": "test_site12345",
"parenttransactionreference": "72-32-20006"
}
strequest = securetrading.Request()
strequest.update(refund)
stresponse = st.process(strequest)
#stresponse contains the transaction response
$configData = array(
'username' => 'webservices@securetrading.net',
'password' => 'your_webservices_password'
);
$requestData = array(
'requesttypedescriptions' => array('REFUND'),
'sitereference' =>'test_site12345',
'parenttransactionreference' =>'72-32-20006'
);
$api = \Securetrading\api($configData);
$response = $api->process($requestData);
// $response contains the transaction response
curl --user webservices@securetrading.com:Password1^ <DOMAIN>/json/ -H "Content-type: application/json" -H "Accept: application/json" -X POST -d '{
"alias": "webservices@securetrading.net",
"version": "1.00",
"request": [{
"requesttypedescriptions": ["REFUND"],
"sitereference": "test_site12345",
"parenttransactionreference": "72-32-20006"
}]
}'
{
"alias":"webservices@securetrading.net",
"version":"1.00",
"request":[{
"requesttypedescriptions":["REFUND"],
"sitereference":"test_site12345",
"parenttransactionreference":"72-32-20006"
}]
}
<requestblock version="3.67">
<alias>webservices@securetrading.net</alias>
<request type="REFUND">
<merchant>
<orderreference>REFUND_PAYPAL</orderreference>
</merchant>
<operation>
<sitereference>test_site12345</sitereference>
<parenttransactionreference>11-32-3</parenttransactionreference>
</operation>
</request>
</requestblock>
Replace <DOMAIN> with a supported domain. Click here for a full list.
REFUND response
The following is an example of a REFUND response returned:
{
u 'requestreference': u 'Ak70u1ujh',
u 'version': u '1.00',
u 'responses': [{
u 'transactionreference': u '72-32-20005',
u 'merchantname': u 'Test Merchant',
u 'paymenttypedescription': u 'PAYPAL',
u 'transactionstartedtimestamp': u '2016-12-25 12:31:00',
u 'errormessage': u 'Ok',
u 'parenttransactionreference': u '72-32-20004',
u 'accounttypedescription': u 'ECOM',
u 'errorcode': u '0',
u 'settleduedate': u '2016-12-26',
u 'baseamount': u '1050',
u 'currencyiso3a': u 'GBP',
u 'authcode': u 'REFUND ACCEPTED',
u 'requesttypedescription': u 'REFUND',
u 'operatorname': u 'webservices@example.com',
u 'livestatus': u '0',
u 'settlestatus': u '100'
}]
}
array(3) {
["requestreference"] => string(9) "Acdefhwxy"
["version"] => string(4) "1.00"
["responses"] => array(1) {
[0] => array(16) {
["transactionreference"] => string(11) "72-32-20005"
["merchantname"] => string(13) "Test Merchant"
["paymenttypedescription"] => string(5) "PAYPAL"
["transactionstartedtimestamp"] => string(19) "2016-12-25 12:31:00"
["errormessage"] => string(2) "Ok"
["parenttransactionreference"] => string(11) "72-32-20004"
["accounttypedescription"] => string(4) "ECOM"
["errorcode"] => string(1) "0"
["settleduedate"] => string(10) "2016-12-26"
["baseamount"] => string(4) "1050"
["currencyiso3a"] => string(3) "GBP"
["authcode"] => string(15) "REFUND ACCEPTED"
["requesttypedescription"] => string(6) "REFUND"
["operatorname"] => string(23) "webservices@example.com"
["livestatus"] => string(1) "0"
["settlestatus"] => string(3) "100"
}
}
}
{
"requestreference":"W23-22rd4301",
"version":"1.00",
"response":[{
"transactionreference":"72-32-20005",
"merchantname":"Test Merchant",
"paymenttypedescription":"PAYPAL",
"transactionstartedtimestamp":"2016-12-25 12:31:00",
"errormessage":"Ok",
"parenttransactionreference":"72-32-20004",
"accounttypedescription":"ECOM",
"errorcode":"0",
"settleduedate":"2016-12-26",
"baseamount":"1050",
"currencyiso3a":"GBP",
"authcode":"REFUND ACCEPTED",
"requesttypedescription":"REFUND",
"operatorname":"webservices@example.com",
"livestatus":"0",
"settlestatus":"100"
}],
"secrand":"SNQVg"
}
<responseblock version="3.67">
<requestreference>X827513709</requestreference>
<response type="REFUND">
<merchant>
<merchantname>My Test Site</merchantname>
<orderreference>REFUND_PAYPAL</orderreference>
<operatorname>webservices@example.com</operatorname>
</merchant>
<transactionreference>11-32-4</transactionreference>
<billing>
<amount currencycode="GBP">100</amount>
<payment type="PAYPAL"/>
</billing>
<timestamp>2010-03-13 12:00:00</timestamp>
<settlement>
<settleduedate>2010-03-13</settleduedate>
<settlestatus>100</settlestatus>
</settlement>
<live>1</live>
<error>
<message>Ok</message>
<code>0</code>
</error>
<authcode>REFUND ACCEPTED</authcode>
<operation>
<parenttransactionreference>11-32-3</parenttransactionreference>
<accounttypedescription>ECOM</accounttypedescription>
</operation>
</response>
<secrand>4AzyrfELeN1PoEl</secrand>
</responseblock>