Method: simulateTransferFunds

Initiates a request to simulate a transfer from an account associated by the association ID for a given amount provided in the request. The return value contains the payment simulation result for the 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"
  },
  "associationId": "LmddbXBsZSByZWZlcmVuY2UgdG9rZW4gdmFsdWU_",
  "amount": {
    "amountMicros": "728000000",
    "currencyCode": "INR"
  }
}

An example response looks like:


{
  "responseHeader": {
    "responseTimestamp": "1481900013178"
  },
  "result": {
    "successWithAlternateFunds": {
      "currentBalance": {
        "amountMicros": 5000000,
        "currencyCode": "MYR"
      },
      "alternateFunds": [
        {
          "description": "ChiliPoints",
          "value": {
            "value": "120"
          },
          "equivalentMonetaryValue": {
            "amountMicros": 1000,
            "currencyCode": "MYR"
          }
        }
      ]
    }
  }
}

HTTP request

POST https://www.integratorhost.example.com/integrator-base-path/e-wallets-v1/simulateTransferFunds

Request body

The request body contains data with the following structure:

JSON representation
{
  "requestHeader": {
    object (RequestHeader)
  },
  "associationId": string,
  "amount": {
    object (Amount)
  }
}
Fields
requestHeader

object (RequestHeader)

REQUIRED: Common header for all requests.

associationId

string

REQUIRED: The associationId of the user's account, originally provided in the associateAccount() call during account linking.

amount

object (Amount)

REQUIRED: The transaction amount to evaluate.

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 (SimulateTransferFundsResponse)

HTTP 4XX / 5XX Status

object (ErrorResponse)

SimulateTransferFundsResponse

Response object for the payment integrator hosted e-wallets-v1.simulateTransferFunds method.

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

object (ResponseHeader)

REQUIRED: Common header for all responses.

result

object (SimulateTransferFundsResult)

REQUIRED: The result of the e-wallets-v1.simulateTransferFunds call.

SimulateTransferFundsResult

Result codes for e-wallets-v1.simulateTransferFunds.

JSON representation
{

  // Union field result can be only one of the following:
  "success": {
    object (SuccessDetails)
  },
  "successWithAlternateFunds": {
    object (SuccessDetails)
  },
  "insufficientFunds": {
    object (InsufficientFunds)
  },
  "chargeExceedsTransactionLimit": {
    object (ChargeExceedsTransactionLimit)
  },
  "chargeExceedsDailyLimit": {
    object (ChargeExceedsDailyLimit)
  },
  "chargeExceedsMonthlyLimit": {
    object (ChargeExceedsMonthlyLimit)
  },
  "chargeUnderLimit": {
    object (ChargeUnderLimit)
  },
  "accountDoesNotSupportCurrency": {
    object (AccountDoesNotSupportCurrency)
  },
  "accountClosed": {
    object (AccountClosed)
  },
  "accountClosedAccountTakenOver": {
    object (AccountClosedAccountTakenOver)
  },
  "accountOnHold": {
    object (AccountOnHold)
  },
  "accountClosedFraud": {
    object (AccountClosedFraud)
  },
  "googlePaymentTokenInvalidatedByUser": {
    object (GooglePaymentTokenInvalidatedByUser)
  }
  // End of list of possible types for union field result.
}
Fields

Union field result.

result can be only one of the following:

success

object (SuccessDetails)

Successful transfer.

successWithAlternateFunds

object (SuccessDetails)

Successful transfer with alternate funding sources.

insufficientFunds

object (InsufficientFunds)

This account does not have sufficient funds to guarantee this transfer. Based on the remedyMethod user will be recommended for top-up.

chargeExceedsTransactionLimit

object (ChargeExceedsTransactionLimit)

This transfer request's amount exceeds per-transaction limit. If this code is used populate the transactionLimit field for user messaging purposes.

chargeExceedsDailyLimit

object (ChargeExceedsDailyLimit)

This account cannot be used for transfers right now as it has exceeded its daily limits.

chargeExceedsMonthlyLimit

object (ChargeExceedsMonthlyLimit)

This account cannot be used for transfers right now as it has exceeded its monthly limits.

chargeUnderLimit

object (ChargeUnderLimit)

This transfer request's amount does not meet the minimum transaction amount.

accountDoesNotSupportCurrency

object (AccountDoesNotSupportCurrency)

This account does not support the requested currency.

accountClosed

object (AccountClosed)

The user's 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.

accountOnHold

object (AccountOnHold)

The account is on hold.

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.

googlePaymentTokenInvalidatedByUser

object (GooglePaymentTokenInvalidatedByUser)

The account is active, but the GPT has been invalidated by the user on the integrator's side.

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.

SuccessDetails

Success details for e-wallets-v1.simulateTransferFunds.

JSON representation
{
  "currentBalance": {
    object (Amount)
  },
  "alternateFunds": [
    {
      object (AlternateFunds)
    }
  ]
}
Fields
currentBalance

object (Amount)

OPTIONAL: This is the current available balance for the account. If provided, this value will be included in user-facing messaging.

alternateFunds[]

object (AlternateFunds)

OPTIONAL: Funding source information provided by the integrator, for example if or how the transaction could be partially funded by alternate sources.

AlternateFunds

JSON representation
{
  "description": string,
  "value": {
    object (Decimal)
  },
  "equivalentMonetaryValue": {
    object (Amount)
  }
}
Fields
description

string

REQUIRED: This is the label that describes the funding source, for example "Auto top-up" or "InvisiPoints".

value

object (Decimal)

OPTIONAL: This is the value of the funding source.

equivalentMonetaryValue

object (Amount)

OPTIONAL: This is the monetary value equivalent to the alternate funds used.

Decimal

A representation of a decimal value, such as 2.5. Clients may convert values into language-native decimal formats, such as Java's [BigDecimal][] or Python's [decimal.Decimal][].

[BigDecimal]: https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/math/BigDecimal.html [decimal.Decimal]: https://docs.python.org/3/library/decimal.html

JSON representation
{
  "value": string
}
Fields
value

string

The decimal value, as a string.

The string representation consists of an optional sign, + (U+002B) or - (U+002D), followed by a sequence of zero or more decimal digits ("the integer"), optionally followed by a fraction, optionally followed by an exponent.

The fraction consists of a decimal point followed by zero or more decimal digits. The string must contain at least one digit in either the integer or the fraction. The number formed by the sign, the integer and the fraction is referred to as the significand.

The exponent consists of the character e (U+0065) or E (U+0045) followed by one or more decimal digits.

Services should normalize decimal values before storing them by:

  • Removing an explicitly-provided + sign (+2.5 -> 2.5).
  • Replacing a zero-length integer value with 0 (.5 -> 0.5).
  • Coercing the exponent character to lower-case (2.5E8 -> 2.5e8).
  • Removing an explicitly-provided zero exponent (2.5e0 -> 2.5).

Services may perform additional normalization based on its own needs and the internal decimal implementation selected, such as shifting the decimal point and exponent value together (example: 2.5e-1 <-> 0.25). Additionally, services may preserve trailing zeroes in the fraction to indicate increased precision, but are not required to do so.

Note that only the . character is supported to divide the integer and the fraction; , should not be supported regardless of locale. Additionally, thousand separators should not be supported. If a service does support them, values must be normalized.

The ENBF grammar is:

DecimalString =
  [Sign] Significand [Exponent];

Sign = '+' | '-';

Significand =
  Digits ['.'] [Digits] | [Digits] '.' Digits;

Exponent = ('e' | 'E') [Sign] Digits;

Digits = { '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9' };

Services should clearly document the range of supported values, the maximum supported precision (total number of digits), and, if applicable, the scale (number of digits after the decimal point), as well as how it behaves when receiving out-of-bounds values.

Services may choose to accept values passed as input even when the value has a higher precision or scale than the service supports, and should round the value to fit the supported scale. Alternatively, the service may error with 400 Bad Request (INVALID_ARGUMENT in gRPC) if precision would be lost.

Services should error with 400 Bad Request (INVALID_ARGUMENT in gRPC) if the service receives a value outside of the supported range.