Testing in Sandbox
Test Payment Methods
We provide
test single-use payment methods in Sandbox, which can be used instead of tokenizing a new payment method every time. These function as IDs
for normal single-use payment methods, but will not be consumed. You may pass any of these payment
method "nonces" as the paymentMethodId
in the
chargePaymentMethod
mutations or any of the other payment-method-related queries and
mutations.
To test vaulted payment methods, use one of the test single-use payment methods in a
vaultPaymentMethod
mutation, then pass the resulting payment method's ID into the
chargePaymentMethod
mutation.
Example of vaulting a test "nonce":
- Mutation
mutation VaultPayPal($input: VaultPaymentMethodInput!) {
vaultPaymentMethod(input: $input) {
paymentMethod {
id
usage
details {
... on PayPalAccountDetails
email
}
}
}
}
- Variables
{ "input": { "id": "fake-paypal-billing-agreement-nonce" } }
- Response
"data": {
"vaultPaymentMethod": {
"paymentMethod": {
"id": "cGF5bWVudG1ldGhvZF9jY19iemo3N25z",
"usage": "MULTI-USE",
"details": {
"email": "jane.doe@paypal.com"
}
}
}
}
Testing Different Transaction Statuses
To create transactions with different statuses, use
these test amounts as
the amount
on TransactionInput
when charging a payment method.
Note: the
values for testing card verification
are not useful for forcing transactions into different states. They are for workflows related to
initial validation of payment methods. When seeking different statuses in a
chargePaymentMethod
mutation, you must use the appropriate test value for the
transaction amount.
Example:
- Mutation
mutation ChargeCreditCardUnsuccessfully($input: ChargePaymentMethodInput!) {
chargePaymentMethod(input: $input) {
transaction {
status
paymentMethodSnapshot {
... on CreditCardTransactionDetails {
creditCard {
brandCode
bin
last4
}
}
}
}
}
}
- Variables
{
"input": {
"paymentMethodId": "fake-valid-nonce",
"transaction": { "amount": "2046.00" }
}
}
- Response
"data": {
"chargePaymentMethod": {
"transaction": {
"status": "PROCESSOR_DECLINED",
"paymentMethodSnapshot": {
"brandCode": "VISA"
"bin": "401288",
"last4": "1881",
}
}
}
}
Forcing Settlement of Transactions
In our sandbox environment, you can force transactions to move from
SUBMITTED_FOR_SETTLEMENT
to a SETTLED
state (or
SETTLEMENT_DECLINED
, depending on the
test amount
you've chosen).
This method will only work in the Sandbox environment. In production, you have to wait for the normal settlement processes to complete. Calling this method in production will produce an error.
Example:
- Mutation
mutation SettleATransaction($input: SandboxSettleTransactionInput!) {
sandboxSettleTransaction(input: $input) {
transaction {
status
}
}
}
- Variables
{ "input": { "transactionId": "dHJhbnNhY3Rpb25fazZqdHZ4NWM" } }
- Response
"data": {
"sandboxSettleTransaction": {
"transaction": {
"status": "SETTLED"
}
}
}