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": 2
    },
    "requestId": "liUrreQY233839dfFFb24gaQM",
    "requestTimestamp": {
      "epochMillis": "1502220434778"
    },
    "paymentIntegratorAccountId": "InvisiCashUSA_USD"
  },
  "transactionId": "bWVyY2hhbnQgdHJhbnNhY3Rpb24gaWQ",
  "refundAmount": {
    "amountMicros": "208000000",
    "currencyCode": "INR"
  }
}

An example response looks like:


{
  "responseHeader": {
    "responseTimestamp": {
      "epochMillis": "1481900013178"
    }
  },
  "result": {
    "success": {}
  }
}

HTTP request

POST https://www.integratordomain.com/v2/refund

Request body

The request body contains data with the following structure:

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

object (RequestHeader)

REQUIRED: Common header for all requests.

captureRequestId

string

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

transactionId

string

REQUIRED: A unique identifier for this transaction. This is a requestId generated by Google. The call during which this requestId is generated will depend on the buy flow.

refundAmount

object (Amount)

REQUIRED: The amount of the refund. Must be a positive number.

Response body

If successful, the response body contains data with the following structure:

Response object for the refund method.

JSON representation
{
  "responseHeader": {
    object (ResponseHeader)
  },
  "result": {
    object (RefundResult)
  }
}
Fields
responseHeader

object (ResponseHeader)

REQUIRED: Common header for all responses.

result

object (RefundResult)

REQUIRED: Result of this refund.

RefundResult

Result codes for refunds.

JSON representation
{

  // Union field result can be only one of the following:
  "success": {
    object (Empty)
  },
  "accountClosed": {
    object (AccountClosed)
  },
  "accountClosedAccountTakenOver": {
    object (AccountClosedAccountTakenOver)
  },
  "accountClosedFraud": {
    object (AccountClosedFraud)
  },
  "accountOnHold": {
    object (AccountOnHold)
  },
  "refundExceedsMaximumBalance": {
    object (RefundExceedsMaximumBalance)
  },
  "refundWindowExceeded": {
    object (RefundWindowExceeded)
  }
  // End of list of possible types for union field result.
}
Fields

Union field result.

result can be only one of the following:

success

object (Empty)

Successful refund.

accountClosed

object (AccountClosed)

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.

accountClosedAccountTakenOver

object (AccountClosedAccountTakenOver)

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.

accountClosedFraud

object (AccountClosedFraud)

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.

accountOnHold

object (AccountOnHold)

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.

refundExceedsMaximumBalance

object (RefundExceedsMaximumBalance)

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.

refundWindowExceeded

object (RefundWindowExceeded)

The refund cannot be processed because the request is outside of the allowed refund period.

RefundExceedsMaximumBalance

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.

JSON representation
{
  "rawResult": {
    object (RawResult)
  }
}
Fields
rawResult

object (RawResult)

OPTIONAL: Raw result of this event. 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.

RefundWindowExceeded

The refund cannot be processed because the request is outside of the allowed refund period.

JSON representation
{
  "rawResult": {
    object (RawResult)
  }
}
Fields
rawResult

object (RawResult)

OPTIONAL: Raw result of this event. 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.