Overview

Namespaces

  • Guzzle
    • Batch
      • Exception
    • Cache
    • Common
      • Exception
    • Http
      • Curl
      • Exception
      • Message
        • Header
      • QueryAggregator
    • Inflection
    • Iterator
    • Log
    • Parser
      • Cookie
      • Message
      • UriTemplate
      • Url
    • Plugin
      • Async
      • Backoff
      • Cache
      • Cookie
        • CookieJar
        • Exception
      • CurlAuth
      • ErrorResponse
        • Exception
      • History
      • Log
      • Md5
      • Mock
      • Oauth
    • Service
      • Builder
      • Command
        • Factory
        • LocationVisitor
          • Request
          • Response
      • Description
      • Exception
      • Resource
    • Stream
    • Tests
      • Batch
      • Cache
      • Common
        • Cache
        • Exception
      • Http
        • Curl
        • Exception
        • Message
          • Header
      • Inflection
      • Iterator
      • Log
      • Message
      • Mock
      • Parser
        • Cookie
        • Message
      • Parsers
        • UriTemplate
      • Plugin
        • Async
        • Backoff
        • Cache
        • Cookie
          • CookieJar
        • CurlAuth
        • ErrorResponse
        • History
        • Log
        • Md5
        • Mock
        • Oauth
        • Redirect
      • Service
        • Builder
        • Command
          • LocationVisitor
            • Request
            • Response
        • Description
        • Exception
        • Mock
          • Command
            • Sub
          • Model
        • Resource
      • Stream
  • None
  • Omnipay
    • Common
      • Exception
      • Message
    • Dummy
      • Message
    • VivaPayments
      • Message
  • PHP

Classes

  • AbstractRestRequest
  • FetchTransactionsRequest
  • NativeAuthorizeRequest
  • NativePurchaseRequest
  • RedirectAuthorizeRequest
  • RedirectPurchaseRequest
  • RedirectResponse
  • RefundRequest
  • RestResponse
  • Overview
  • Namespace
  • Class
  • Tree

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
Extended by Omnipay\VivaPayments\Message\AbstractRestRequest
Extended by Omnipay\VivaPayments\Message\RefundRequest
Namespace: Omnipay\VivaPayments\Message
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
Methods summary
public mixed
# getData( )

Get the raw data array for this message. The format of this varies from gateway to gateway, but will usually be either an associative array, or a SimpleXMLElement.

Get the raw data array for this message. The format of this varies from gateway to gateway, but will usually be either an associative array, or a SimpleXMLElement.

Returns

mixed

Overrides

Omnipay\VivaPayments\Message\AbstractRestRequest::getData()
protected string
# getHttpMethod( )

Get HTTP Method.

Get HTTP Method.

This is nearly always POST but can be over-ridden in sub classes.

Returns

string

Overrides

Omnipay\VivaPayments\Message\AbstractRestRequest::getHttpMethod()
protected string
# getEndpoint( )

Get transaction endpoint.

Get transaction endpoint.

Purchases are created using the /purchases resource.

Returns

string

Overrides

Omnipay\VivaPayments\Message\AbstractRestRequest::getEndpoint()
Methods inherited from Omnipay\VivaPayments\Message\AbstractRestRequest
createResponse(), getApiKey(), getBaseEndpoint(), getMerchantId(), getRequestLang(), getSourceCode(), sendData(), setApiKey(), setMerchantId(), setRequestLang(), setSourceCode()
Methods inherited from Omnipay\Common\Message\AbstractRequest
__construct(), formatCurrency(), getAmount(), getAmountInteger(), getCancelUrl(), getCard(), getCardReference(), getClientIp(), getCurrency(), getCurrencyDecimalPlaces(), getCurrencyNumeric(), getDescription(), getIssuer(), getItems(), getNotifyUrl(), getParameter(), getParameters(), getPaymentMethod(), getResponse(), getReturnUrl(), getTestMode(), getToken(), getTransactionId(), getTransactionReference(), initialize(), send(), setAmount(), setCancelUrl(), setCard(), setCardReference(), setClientIp(), setCurrency(), setDescription(), setIssuer(), setItems(), setNotifyUrl(), setParameter(), setPaymentMethod(), setReturnUrl(), setTestMode(), setToken(), setTransactionId(), setTransactionReference(), toFloat(), validate()
Properties inherited from Omnipay\VivaPayments\Message\AbstractRestRequest
$liveEndpoint, $testEndpoint
Properties inherited from Omnipay\Common\Message\AbstractRequest
$httpClient, $httpRequest, $negativeAmountAllowed, $parameters, $response, $zeroAmountAllowed
Omnipay Viva Payments Gateway Module API Documentation API documentation generated by ApiGen