If you don’t want to cancel the whole transaction, but to refund a part of the paid amount, you can use the ‘Partial Refund’ feature. This feature just needs a little more information than cancelling a transaction, but it’s still as easy to implement.
Like for creating a purchase, you need to collect some data and save them in a variable to use this function, but this time it’s only about 5 parameters.They are all mandatory this time, but it shouldn’t be too difficult to provide them.
$data = array( 'purchaseId' => 'AAEAAADoKU6421HOOB_aPVn34sGc1cwHIikItYez4BicVrRe15YHGF4f', 'refundAmount' => '1', 'merchantReferenceId' => '1444643320', 'refundCurrency' => 'SGD', 'description' => '[your company name] refund' );
$data = array( 'purchaseId' => '', 'refundAmount' => '', 'merchantReferenceId' => '', 'refundCurrency' => '', 'description' => '' );
It is the ID you got in the response for creating a purchase.
The amount of money you want to refund.
Merchant Reference ID
This is just the ID, you gave the purchase in your system (you also provided it for creating a purchase).
This should be the same currency you used for creating the purchase!
Just a short description of this api call. It’s enough to just call it “[your company name] refund”.
This command executes the api call with the data, you saved in $data, and saves the response in $response.
$response = $helloPay->refundAmount($data);