- [HTTP request](https://developers.google.com/pay/e-wallets-v1/payment-integrator-e-wallets-api/simulatePayment#body.HTTP_TEMPLATE)
- [Request body](https://developers.google.com/pay/e-wallets-v1/payment-integrator-e-wallets-api/simulatePayment#body.request_body)
  - [JSON representation](https://developers.google.com/pay/e-wallets-v1/payment-integrator-e-wallets-api/simulatePayment#body.request_body.SCHEMA_REPRESENTATION)
- [Response body](https://developers.google.com/pay/e-wallets-v1/payment-integrator-e-wallets-api/simulatePayment#body.response_body)
- [SimulatePaymentResponse](https://developers.google.com/pay/e-wallets-v1/payment-integrator-e-wallets-api/simulatePayment#SimulatePaymentResponse)
  - [JSON representation](https://developers.google.com/pay/e-wallets-v1/payment-integrator-e-wallets-api/simulatePayment#SimulatePaymentResponse.SCHEMA_REPRESENTATION)
- [SimulatePaymentResult](https://developers.google.com/pay/e-wallets-v1/payment-integrator-e-wallets-api/simulatePayment#SimulatePaymentResult)
  - [JSON representation](https://developers.google.com/pay/e-wallets-v1/payment-integrator-e-wallets-api/simulatePayment#SimulatePaymentResult.SCHEMA_REPRESENTATION)
- [SuccessDetails](https://developers.google.com/pay/e-wallets-v1/payment-integrator-e-wallets-api/simulatePayment#SuccessDetails)
  - [JSON representation](https://developers.google.com/pay/e-wallets-v1/payment-integrator-e-wallets-api/simulatePayment#SuccessDetails.SCHEMA_REPRESENTATION)
- [AlternateFunds](https://developers.google.com/pay/e-wallets-v1/payment-integrator-e-wallets-api/simulatePayment#AlternateFunds)
  - [JSON representation](https://developers.google.com/pay/e-wallets-v1/payment-integrator-e-wallets-api/simulatePayment#AlternateFunds.SCHEMA_REPRESENTATION)
- [Decimal](https://developers.google.com/pay/e-wallets-v1/payment-integrator-e-wallets-api/simulatePayment#Decimal)
  - [JSON representation](https://developers.google.com/pay/e-wallets-v1/payment-integrator-e-wallets-api/simulatePayment#Decimal.SCHEMA_REPRESENTATION)

Initiates a request to simulate a payment 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 `https://developers.google.com/pay/e-wallets-v1/payment-integrator-e-wallets-api/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"
      },
      "payeeProxy": {
        "payeeProxyKey": {
          "qrCode": "QrCode",
          "networkId": "PaymentNetwork1"
        }
      },
      "paymentIntegratorAccountId": "InvisiCash"
    }

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"
              },
              "autoTopUpEnabled": {},
              "autoPaymentEnabled": {}
            }
          ]
        }
      }
    }

### HTTP request

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

### Request body

The request body contains data with the following structure:

| JSON representation |
|---|
| ``` { "requestHeader": { object (`https://developers.google.com/pay/e-wallets-v1/payment-integrator-e-wallets-api/RequestHeader`) }, "associationId": string, "amount": { object (`https://developers.google.com/pay/e-wallets-v1/payment-integrator-e-wallets-api/Amount`) }, "paymentIntegratorAccountId": string, // The following is a list of mutually exclusive fields. At most one of the // fields will be set in a response: "payeeProxy": { object (`https://developers.google.com/pay/e-wallets-v1/payment-integrator-e-wallets-api/PayeeProxyDestination`) }, "fundsDestinationNotApplicable": { object (`https://developers.google.com/pay/e-wallets-v1/payment-integrator-e-wallets-api/Empty`) } // End of mutually exclusive fields. } ``` |

| Fields ||
|---|---|
| `requestHeader` | ``object (`https://developers.google.com/pay/e-wallets-v1/payment-integrator-e-wallets-api/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 (`https://developers.google.com/pay/e-wallets-v1/payment-integrator-e-wallets-api/Amount`)`` **REQUIRED**: The transaction amount to evaluate. |
| `paymentIntegratorAccountId` | `string` **REQUIRED**: This is the payment integrator account identifier that identifies contractual constraints around this transaction. |
| **REQUIRED**: The form of payment where money will be deposited. The following is a list of mutually exclusive fields. At most one of the fields will be set in a response: ||
| `payeeProxy` | ``object (`https://developers.google.com/pay/e-wallets-v1/payment-integrator-e-wallets-api/PayeeProxyDestination`)`` Payee that is referenced by a PayeeProxyKey |
| `fundsDestinationNotApplicable` | ``object (`https://developers.google.com/pay/e-wallets-v1/payment-integrator-e-wallets-api/Empty`)`` Funds destination information is not applicable for this payment. |
| End of mutually exclusive fields. ||

### 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](https://developers.google.com/pay/e-wallets-v1/guides/connectivity/protocol-standards#http_status_codes).

| Possible response messages ||
|---|---|
| HTTP 200 Status | ``object (`https://developers.google.com/pay/e-wallets-v1/payment-integrator-e-wallets-api/simulatePayment#SimulatePaymentResponse`)`` |
| HTTP 4XX / 5XX Status | ``object (`https://developers.google.com/pay/e-wallets-v1/payment-integrator-e-wallets-api/ErrorResponse`)`` |
| End of mutually exclusive fields. ||

## SimulatePaymentResponse

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

| JSON representation |
|---|
| ``` { "responseHeader": { object (`https://developers.google.com/pay/e-wallets-v1/payment-integrator-e-wallets-api/ResponseHeader`) }, "result": { object (`https://developers.google.com/pay/e-wallets-v1/payment-integrator-e-wallets-api/simulatePayment#SimulatePaymentResult`) } } ``` |

| Fields ||
|---|---|
| `responseHeader` | ``object (`https://developers.google.com/pay/e-wallets-v1/payment-integrator-e-wallets-api/ResponseHeader`)`` **REQUIRED**: Common header for all responses. |
| `result` | ``object (`https://developers.google.com/pay/e-wallets-v1/payment-integrator-e-wallets-api/simulatePayment#SimulatePaymentResult`)`` **REQUIRED**: The result of the e-wallets-v1.simulatePayment call. |

## SimulatePaymentResult

Result codes for `e-wallets-v1.simulatePayment`.

| JSON representation |
|---|
| ``` { // The following is a list of mutually exclusive fields. At most one of the // fields will be set in a response: "success": { object (`https://developers.google.com/pay/e-wallets-v1/payment-integrator-e-wallets-api/simulatePayment#SuccessDetails`) }, "successWithAlternateFunds": { object (`https://developers.google.com/pay/e-wallets-v1/payment-integrator-e-wallets-api/simulatePayment#SuccessDetails`) }, "insufficientFunds": { object (`https://developers.google.com/pay/e-wallets-v1/payment-integrator-e-wallets-api/InsufficientFunds`) }, "chargeExceedsTransactionLimit": { object (`https://developers.google.com/pay/e-wallets-v1/payment-integrator-e-wallets-api/ChargeExceedsTransactionLimit`) }, "chargeExceedsDailyLimit": { object (`https://developers.google.com/pay/e-wallets-v1/payment-integrator-e-wallets-api/ChargeExceedsDailyLimit`) }, "chargeExceedsMonthlyLimit": { object (`https://developers.google.com/pay/e-wallets-v1/payment-integrator-e-wallets-api/ChargeExceedsMonthlyLimit`) }, "chargeUnderLimit": { object (`https://developers.google.com/pay/e-wallets-v1/payment-integrator-e-wallets-api/ChargeUnderLimit`) }, "accountDoesNotSupportCurrency": { object (`https://developers.google.com/pay/e-wallets-v1/payment-integrator-e-wallets-api/AccountDoesNotSupportCurrency`) }, "accountClosed": { object (`https://developers.google.com/pay/e-wallets-v1/payment-integrator-e-wallets-api/AccountClosed`) }, "accountClosedAccountTakenOver": { object (`https://developers.google.com/pay/e-wallets-v1/payment-integrator-e-wallets-api/AccountClosedAccountTakenOver`) }, "accountOnHold": { object (`https://developers.google.com/pay/e-wallets-v1/payment-integrator-e-wallets-api/AccountOnHold`) }, "accountClosedFraud": { object (`https://developers.google.com/pay/e-wallets-v1/payment-integrator-e-wallets-api/AccountClosedFraud`) }, "googlePaymentTokenInvalidatedByUser": { object (`https://developers.google.com/pay/e-wallets-v1/payment-integrator-e-wallets-api/GooglePaymentTokenInvalidatedByUser`) }, "payeeProxyNotRegistered": { object (`https://developers.google.com/pay/e-wallets-v1/payment-integrator-e-wallets-api/PayeeProxyNotRegistered`) }, "declinedByBusinessRule": { object (`https://developers.google.com/pay/e-wallets-v1/payment-integrator-e-wallets-api/DeclinedByBusinessRule`) } // End of mutually exclusive fields. } ``` |

| Fields ||
|---|---|
| **REQUIRED**: The result of the SimulatePayment call. The following is a list of mutually exclusive fields. At most one of the fields will be set in a response: ||
| `success` | ``object (`https://developers.google.com/pay/e-wallets-v1/payment-integrator-e-wallets-api/simulatePayment#SuccessDetails`)`` Successful payment. |
| `successWithAlternateFunds` | ``object (`https://developers.google.com/pay/e-wallets-v1/payment-integrator-e-wallets-api/simulatePayment#SuccessDetails`)`` Successful payment with alternate funding sources. |
| `insufficientFunds` | ``object (`https://developers.google.com/pay/e-wallets-v1/payment-integrator-e-wallets-api/InsufficientFunds`)`` This account does not have sufficient funds to guarantee this payment. Based on the remedyMethod user will be recommended for top-up. |
| `chargeExceedsTransactionLimit` | ``object (`https://developers.google.com/pay/e-wallets-v1/payment-integrator-e-wallets-api/ChargeExceedsTransactionLimit`)`` This payment request's `amount` exceeds per-transaction limit. If this code is used populate the transactionLimit field for user messaging purposes. |
| `chargeExceedsDailyLimit` | ``object (`https://developers.google.com/pay/e-wallets-v1/payment-integrator-e-wallets-api/ChargeExceedsDailyLimit`)`` This account cannot be used for payments right now as it has exceeded its daily limits. |
| `chargeExceedsMonthlyLimit` | ``object (`https://developers.google.com/pay/e-wallets-v1/payment-integrator-e-wallets-api/ChargeExceedsMonthlyLimit`)`` This account cannot be used for payments right now as it has exceeded its monthly limits. |
| `chargeUnderLimit` | ``object (`https://developers.google.com/pay/e-wallets-v1/payment-integrator-e-wallets-api/ChargeUnderLimit`)`` This payment request's `amount` does not meet the minimum transaction amount. |
| `accountDoesNotSupportCurrency` | ``object (`https://developers.google.com/pay/e-wallets-v1/payment-integrator-e-wallets-api/AccountDoesNotSupportCurrency`)`` This account does not support the requested currency. |
| `accountClosed` | ``object (`https://developers.google.com/pay/e-wallets-v1/payment-integrator-e-wallets-api/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 (`https://developers.google.com/pay/e-wallets-v1/payment-integrator-e-wallets-api/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 (`https://developers.google.com/pay/e-wallets-v1/payment-integrator-e-wallets-api/AccountOnHold`)`` The account is on hold. |
| `accountClosedFraud` | ``object (`https://developers.google.com/pay/e-wallets-v1/payment-integrator-e-wallets-api/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 (`https://developers.google.com/pay/e-wallets-v1/payment-integrator-e-wallets-api/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. |
| `payeeProxyNotRegistered` | ``object (`https://developers.google.com/pay/e-wallets-v1/payment-integrator-e-wallets-api/PayeeProxyNotRegistered`)`` The payee proxy is not registered. |
| `declinedByBusinessRule` | ``object (`https://developers.google.com/pay/e-wallets-v1/payment-integrator-e-wallets-api/DeclinedByBusinessRule`)`` The transaction was declined due to business rule violations on the integrator's side. |
| End of mutually exclusive fields. ||

## SuccessDetails

Success details for `e-wallets-v1.simulatePayment`.

| JSON representation |
|---|
| ``` { "currentBalance": { object (`https://developers.google.com/pay/e-wallets-v1/payment-integrator-e-wallets-api/Amount`) }, "alternateFunds": [ { object (`https://developers.google.com/pay/e-wallets-v1/payment-integrator-e-wallets-api/simulatePayment#AlternateFunds`) } ] } ``` |

| Fields ||
|---|---|
| `currentBalance` | ``object (`https://developers.google.com/pay/e-wallets-v1/payment-integrator-e-wallets-api/Amount`)`` **OPTIONAL**: This is the current available balance for the account. If provided, this value will be included in user-facing messaging. |
| `alternateFunds[]` | ``object (`https://developers.google.com/pay/e-wallets-v1/payment-integrator-e-wallets-api/simulatePayment#AlternateFunds`)`` **OPTIONAL**: Funding source information provided by the integrator, for example if or how the transaction could be partially funded by alternate sources. |

## AlternateFunds

Alternate funding source information.

| JSON representation |
|---|
| ``` { "description": string, "value": { object (`https://developers.google.com/pay/e-wallets-v1/payment-integrator-e-wallets-api/simulatePayment#Decimal`) }, "equivalentMonetaryValue": { object (`https://developers.google.com/pay/e-wallets-v1/payment-integrator-e-wallets-api/Amount`) }, "autoTopUpEnabled": { object (`https://developers.google.com/pay/e-wallets-v1/payment-integrator-e-wallets-api/Empty`) }, "autoPaymentEnabled": { object (`https://developers.google.com/pay/e-wallets-v1/payment-integrator-e-wallets-api/Empty`) } } ``` |

| Fields ||
|---|---|
| `description` | `string` **REQUIRED**: This is the label that describes the funding source, for example "InvisiPoints". |
| `value` | ``object (`https://developers.google.com/pay/e-wallets-v1/payment-integrator-e-wallets-api/simulatePayment#Decimal`)`` **OPTIONAL**: This is the value of the funding source. |
| `equivalentMonetaryValue` | ``object (`https://developers.google.com/pay/e-wallets-v1/payment-integrator-e-wallets-api/Amount`)`` **OPTIONAL**: This is the monetary value equivalent to the alternate funds used. |
| `autoTopUpEnabled` | ``object (`https://developers.google.com/pay/e-wallets-v1/payment-integrator-e-wallets-api/Empty`)`` **OPTIONAL**: This is to indicate that this funding source can be used to top up a user's eWallet balance. |
| `autoPaymentEnabled` | ``object (`https://developers.google.com/pay/e-wallets-v1/payment-integrator-e-wallets-api/Empty`)`` **OPTIONAL**: This is to indicate that this funding source can be used to complete the payment when the balance amount is below a threshold. |

## 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` **REQUIRED**: 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. |