Method: refund

Refunds a portion of or the entire transaction initiated through capture. The combination of requestId within the header and paymentIntegratorAccountId is the idempotency key, which uniquely identifies this transaction.

If the endpoint encounters an error while processing the request, the response body from this endpoint should be of type ErrorResponse.

An example request looks like:


{
  "requestHeader": {
    "protocolVersion": {
      "major": 1,
      "minor": 0,
      "revision": 0
    },
    "requestId": "liUrreQY233839dfFFb24gaQM",
    "requestTimestamp": "1502220434778"
  },
  "paymentIntegratorAccountId": "InvisiCashUSA_USD",
  "captureRequestId": "bWVyY2hhbnQgdHJhbnNhY3Rpb24gaWQ",
  "currencyCode": "INR",
  "refundAmount": "208000000"
}

An example response looks like:


{
  "responseHeader": {
    "responseTimestamp": "1481900013178"
  },
  "result": "SUCCESS",
  "paymentIntegratorRefundId": "cmVmdW5kIGlkZW50aWZpZXINCg"
}

HTTP request

POST https://www.integratorhost.example.com/integrator-base-path/redirect-payment-token-v1/refund

Request body

The request body contains data with the following structure:

JSON representation
{
  "requestHeader": {
    object (RequestHeader)
  },
  "paymentIntegratorAccountId": string,
  "captureRequestId": string,
  "currencyCode": string,
  "refundAmount": string
}
Fields
requestHeader

object (RequestHeader)

REQUIRED: Common header for all requests.

paymentIntegratorAccountId

string

REQUIRED: This is the payment integrator account ID that defines contractual constraints around this transaction.

captureRequestId

string

REQUIRED: A unique identifier for this transaction. This is the requestId generated by Google during the capture call which this request is associated with.

currencyCode

string

REQUIRED: ISO 4217 3-letter currency code

refundAmount

string (Int64Value format)

REQUIRED: The amount of the refund, a positive number of micros of the currency unit.

Response body

This method supports multiple return types. For additional information about what 4XX or 5XX HTTP status code to return with an ErrorResponse, consult the ErrorResponse object and HTTP status codes documentation.

Possible response messages
HTTP 200 Status

object (RefundResponse)

HTTP 4XX / 5XX Status

object (ErrorResponse)

RefundResponse

Response object for the refund method.

JSON representation
{
  "responseHeader": {
    object (ResponseHeader)
  },
  "paymentIntegratorRefundId": string,
  "result": enum (RefundResultCode),
  "rawResult": {
    object (RawResult)
  }
}
Fields
responseHeader

object (ResponseHeader)

REQUIRED: Common header for all responses.

paymentIntegratorRefundId

string

OPTIONAL: This identifier is specific to the integrator and is generated by the integrator. This is the identifier that the integrator knows this refund by.

For convenience, this identifier is included with in the remittance details

result

enum (RefundResultCode)

REQUIRED: Result of this refund.

rawResult

object (RawResult)

OPTIONAL: Raw result of this refund. Used to help inform Google's risk engine and analytics. In decline code–mapping situations, data is sometimes lost. The integrator can choose to give Google a raw code. For example, a credit card gateway (the integrator) may use this field to communicate to Google the exact decline code that was received from the VISA network. In that case, the scope would be "visa" and the rawCode would be whatever the VISA network returned.

This value is required if the result is not SUCCESS.

RefundResultCode

The unique result codes refunds.

Enums
UNKNOWN_RESULT Do not ever set this default value!
SUCCESS Successful refund.
NO_MONEY_LEFT_ON_TRANSACTION redirect-payment-token-v1.refund failed, there is no money left on the transaction. Typically this represents bug between the integrator and Google. Google should not ask to refund an amount greater than the original capture.
ACCOUNT_CLOSED

The account held with the integrator has been closed.

Returning this value will cause the user's instrument to be closed with Google. The user will be forced to add a new instrument by going through the association flow again.

ACCOUNT_CLOSED_ACCOUNT_TAKEN_OVER

The user's account with the integrator has been closed, suspected account take over.

Returning this value will cause the user's instrument to be closed with Google. The user will be forced to add a new instrument by going through the association flow again.

ACCOUNT_CLOSED_FRAUD

The user's account held with the integrator has been closed because of fraud.

Returning this value will cause the user's instrument to be closed with Google. The user will be forced to add a new instrument by going through the association flow again.

ACCOUNT_ON_HOLD The user's account is currently on hold and cannot accept the refund, but the user's account may later be able to accept the refund. Google may request another refund in the future, but will do so with a new requestId, so this request should be considered finished.
REFUND_EXCEEDS_MAXIMUM_BALANCE The refund cannot be processed at the current time, because doing so would cause the user's balance to exceed the maximum allowed amount. Google may request another refund in the future, but will do so with a new requestId, so this request should be considered finished.
REFUND_WINDOW_EXCEEDED The refund cannot be processed because the request is outside of the allowed refund period.