Once the Virtual Cards APIs have been implemented, it's time to test them. Google provides test cases that may aid you in this process.
Test cases
This section outlines the test cases expected to be executed to validate your Virtual Cards APIs implementation.
Outbound tests
Outbound tests refer to flow direction Google -> Integrator.
Common (applies to all outbound endpoints)
- Invalid encryption returns
invalidPayloadEncryption
- Invalid signature returns
invalidPayloadSignature
- Invalid JSON returns
invalidDecryptedRequest
- Timestamp not within +/- 60 seconds returns
requestTimestampOutOfRange
(this requirement helps protect against replay attacks) - RequestId missing returns
missingRequiredField
- Invalid
PIAID (paymentIntegratorAccountId)
returns
invalidIdentifier
Echo
- Happy Path (clientMessage is echoed in response)
Enroll
- Happy Path
- PAN is not found returns
unknownPan
decline - PAN is recognized but is no longer valid returns
panNoLongerValid
- PAN is recognized but the card account has been closed returns
cardAccountClosed
- PAN is not eligible returns
cardIneligible
decline - PAN invalid format returns
invalidFieldValue
error - Expiration date mismatch returns
incorrectExpiration
decline - Red-path PAN* returns
riskDeclined
decline - Externally-managed terms of service not accepted by user returns
tosNotAccepted
decline - Externally-managed terms of service acceptance timestamp out of date returns
tosAcceptanceOutdated
decline - Idempotency - Same
requestId
+ same PAN returnssuccess
- Idempotency - Same
requestId
+ different PAN returnsidempotencyViolation
- Different
requestId
+ same PAN returnssuccess
(2nd enrollment)- This can happen if the same PAN is registered by multiple users (different
hashedEmailAddress
) or a single user (samehashedEmailAddress
) with multiple payment profiles
- This can happen if the same PAN is registered by multiple users (different
RetrieveVirtualCardNumber
- Green path* returns success
- Yellow path* returns
challengeRequired
decline - Yellow path* (including valid challenge result) returns success
- Yellow path* (including INVALID challenge result) returns
challengeResultInvalid
decline - Yellow path* (too many** attempts at challenge result) returns
challengeResultVerificationLimitExceeded
decline - Yellow path* (including expired** OTP challenge result) returns
challengeResultExpired
decline - Yellow path* (including expired** challenge option) returns
challengeResultExpired
decline- for example if the send OTP limit is 3, OTP timeout is 10 min, and the challenge option timeout is 15 min, the user could timeout the first OTP at 10 min but then timeout the whole challenge at 15 min
- Red path* returns
riskDeclined
- Idempotency - Same
requestId
+ same contents returns same response- Green path returns
success
- Yellow path returns
challengeRequired
decline - Yellow path (including valid challenge result) returns
success
- Green path returns
- Idempotency - Same
requestId
+ different contents returnsidempotencyViolation
enrollmentRequestId
not found returnsinvalidIdentifier
errorenrollmentRequestId
that has been unenrolled returnsinvalidIdentifier
error
SendOTP
- Happy Path
- Expired** challenge option returns
challengeOptionExpired
decline - Too many** sendOtps returns
sendLimitExceeded
decline enrollmentRequestId
has been unenrolled returnschallengeOptionExpired
- for example, if (1)
retrieveVirtualCardNumber
returnschallengeRequired
, (2) the card is unenrolled in virtual cards, and then (3)sendOtp
is called.
- for example, if (1)
challengeOptionId
not found returnsinvalidIdentifier
error- Idempotency - Same
requestId
+ same contents returns same response- Does not cause
sendLimitExceeded
for multiple retries (send count only incremented once) - Does not resend SMS OTP if it was already sent
- Does not change expiration result (example w/ 30 min expiration timer: first
attempt at 29 minutes, retry (same request ID) at 31 minutes. It should return
the same result from the first attempt, not
challengeOptionExpired
)
- Does not cause
- Idempotency - same
requestId
+ different contents returnsidempotencyViolation
enrollmentRequestId
not found returnsinvalidIdentifier
error
GetTransactions
getTransactions
withouttransactionListContinuationToken
returns all transactions for the maximum period prior to the requestgetTransactions
withtransactionListContinuationToken
returns all transactions added or updated since the request represented by the tokentransactionListContinuationToken
not found returnsunknownTransactionListContinuationToken
(not anErrorResponse
withinvalidIdentifier
like other APIs)- Idempotency - Same
requestId
+ same contents returns same transaction list andtransactionListContinuationToken
in response - Idempotency - Same
requestId
+ different contents returnsidempotencyViolation
enrollmentRequestId
not found returnsunknownEnrollment
(not anErrorResponse
withinvalidIdentifier
like other APIs)
Unenroll
- Happy Path
- Idempotency -
enrollmentRequestId
that has already been unenrolled returns success
Inbound tests
Inbound tests refer to flow direction Integrator -> Google.
TransactionEventNotification
- Happy Path