Refunding PayPal transactions with Webservices API

  Last updated: 

 

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.

  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).

Python PHP cURL Raw JSON Raw XML
#!/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

Replace <DOMAIN> with a supported domain. Click here for a full list.

 

REFUND response

The following is an example of a REFUND response returned:

Python PHP Raw JSON Raw XML
{
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'
}]
}
Was this article helpful?
0 out of 0 found this helpful