Sandbox Test Values
Test credit card numbers and payment nonces you can use to make test payments.
Sandbox test values are used to test payments in the Square Sandbox. You can use test credit cards with the payment form and In-App Payments SDK to input a fake credit card that will generate a testable payment nonce.
If you are using the Connect v2 Payments API to generate payments in the sandbox, you can use one of the sandbox test nonces as the
source_id in the payment request.
For information about test values for the deprecated legacy Sandbox, see Legacy Sandbox Test Values.
The sandbox supports a collection of special credit card values you can use to simulate payment scenarios.
Use the information below to get started quickly to generate a valid sandbox nonce with the Square payment form or In-App Payments SDK.
|Card number||4111 1111 1111 1111|
You can use the following test credit card numbers to generate a sandbox card nonce with the Square payment form or In-App Payments SDK.
|Visa||4111 1111 1111 1111||111||N/A|
|Visa EU||4310 0000 0000 0007||111||123456|
|MasterCard||5105 1051 0510 5100||111||N/A|
|MasterCard EU||5500 0000 0000 0004||111||123456|
|Discover||6011 0000 0000 0004||111||N/A|
|Diners Club||3000 0000 0000 04||111||N/A|
|JCB||3569 9900 1009 5841||111||N/A|
|American Express||3400 000000 00009||1111||N/A|
|American Express EU||37000 00000 00002||1111||123456|
|China UnionPay||6222 9888 1234 0000||123||N/A|
When testing the SCA flow with one of the European Union test cards, the Verification Code simulates the SMS verification code sent to the buyer mobile phone during an actual transaction.
To test a successful payment, provide any future-dated expiration date.
American Express cards have a four digit CVV.
Payments in USD (United States), CAD (Canada), or GBP (United Kingdom) also require a valid postal code.
If you do not want to generate a nonce with the Square Payment Form or In-App Payments SDK, you can generate a successful response from the payment endpoint supported in the sandbox that you are using.
Use the Payments.CreatePayment endpoint for card and card on file (CoF) payments with the following test values:
|API Call||Field Name||Value|
|Payments API |
|Payments API |
(card on file)
|Customers API |
If you provide a sandbox nonce value to the CreateCustomerCard endpoint, you must provide "94103" as the postal code in the
billing_address field or the request will fail and return an with an invalid postal code error.
Use the SqPaymentForm.verifyBuyer function for card and card on file (CoF) SCA challenges with the following test values:
|API Call||Field Name||Value||Verification Code|
(card on file)
The SCA flow requires that the buyer provides a code sent to their mobile phone in an SMS message. When testing in the sandbox use the Verification Code to simulate the code sent via SMS.
When testing the SCA flow in v2 Sandbox, be sure to initialize SqPaymentForm with a UK location ID.
The SCA flow and these test values are not supported in the legacy sandbox.
You can reproduce certain error states in the sandbox by providing special values in the Square payment form, In-App Payments SDK, or the CreatePayment endpoint.
If you use one of the following values in the Square payment form or In-App Payments SDK, the nonce returned will trigger an error when it is processed by the CreatePayment endpoint:
|Desired error state||Test values|
|Card CVV incorrect||CVV: 911|
|Card postal code incorrect||Postal code: 99999|
|Card expiration date incorrect||Expiration date: 01/40|
|Card declined number||Card number: 4000000000000002|
|Card on file auth declined||PAN: 4000000000000010|
If you do not want to generate a nonce with the Square payment form or In-App Payments SDK, you can generate errors directly in your request to the Payments.CreatePayment endpoint.
If you send a sandbox
card_nonce value to CreateCustomerCard, you must provide 94103 as the postal code in the
billing_address field or the request will fail and return an invalid postal code error.
Use the CreatePayment endpoint.
|Bad postal code||cnon:card-nonce-rejected-postalcode||ccof:customer-card-id-rejected-postalcode|
|Bad expiration date||cnon:card-nonce-rejected-expiration||ccof:customer-card-id-rejected-expiration|
|Card nonce already used||cnon:card-nonce-rejected-cvv||N/A|
Your sandbox account comes with 1 mock location per application. This location is unrelated to the production locations listed in the Square Dashboard
The sandbox location ID for a given application is listed on the Locations tab of the application control panel in the Application Dashboard. You can also fetch the location ID programmatically by calling ListLocations with a sandbox access token.