Class RefundRequest
Viva Payments (REST) Refund Request
This method allows you to:
- Cancel a card payment occurred within the same business day (before 22:00 GMT+2).
- Make a partial or full refund of a successful payment that has already been cleared.
Example
This example assumes that the payment is successful and the transaction ID is stored in $transaction_id
$transaction = $gateway->refund(array( 'amount' => '10.00', 'transactionReference' => $transaction_id, )); $response = $transaction->send(); if ($response->isSuccessful()) { $refund_id = $response->getTransactionReference(); echo "Refund transaction successful.\n"; echo "Refund transaction reference = " . $refund_id . "\n"; } else { echo "Refund transaction failed.\n"; echo "Error code == " . $response->getCode() . "\n"; echo "Error message == " . $response->getMessage() . "\n"; }
Quirks
- If this refund request is happening on the same day, the gateway assumes that the card payment is being cancelled, and the refund amount must exactly match the payment amount, or an error will be thrown.
- Omnipay\Common\Message\AbstractRequest implements Omnipay\Common\Message\RequestInterface
- Omnipay\VivaPayments\Message\AbstractRestRequest
- Omnipay\VivaPayments\Message\RefundRequest
Namespace: Omnipay\VivaPayments\Message
See:
Link: https://github.com/VivaPayments/API/wiki
Link: https://www.vivawallet.com/en-us/company
Link: https://github.com/VivaPayments/API/wiki/CancelTransaction
Located at Message/RefundRequest.php
See:
Omnipay\VivaPayments\RestGateway
Link: https://github.com/VivaPayments/API/wiki
Link: https://www.vivawallet.com/en-us/company
Link: https://github.com/VivaPayments/API/wiki/CancelTransaction
Located at Message/RefundRequest.php
public
mixed
|
|
protected
string
|
|
protected
string
|
$liveEndpoint,
$testEndpoint
|
$httpClient,
$httpRequest,
$negativeAmountAllowed,
$parameters,
$response,
$zeroAmountAllowed
|