The Square Sandbox can be used for testing Square API calls. Some of the APIs require special test values when creating transactions in the Sandbox, especially when processing test payments.
Square platform clients, such as Web Payments SDK and In-App Payments SDK applications, accept payment cards and return one-time-use encrypted payment tokens to be submitted to Square API payment endpoints to take payments. You can avoid testing your code with a real payment card by testing in the Sandbox.
Test client-side card-not-present logic in your Web Payments SDK or In-App Payments SDK application by using test credit card numbers to generate payment tokens for use with the Square API payments and card-on-file endpoints in the Sandbox.
If you don't need to test your client-side payment token logic, use the test payment tokens provided in the Payment tokens for testing the Payments API section to submit payments in the Sandbox.
You can use Sandbox credit cards with the Web Payments SDK and In-App Payments SDK to input card numbers that generate a payment token for Sandbox online payments testing.
The Sandbox supports a collection of credit card numbers for all Square-supported card brands for simulating the client side of payment scenarios.
Note the following:
- You can set the card expiration date to any future month and year.
- Payments in USD (United States), CAD (Canada), or GBP (United Kingdom) require a valid postal code.
- Payments in Japan do not support postal codes.
- The Sandbox simulates the use of payment cards in Square-supported countries. In production, card brand and country support might be different. Before releasing your application into production, review Supported Payment Methods by Country.
The Sandbox supports ACH bank transfer payments by accepting the test user name
user_good and the test password
pass_good. These test values are provided by the Plaid API and might change in the future. For more information, see the Plaid Sandbox test credentials page.
You can reproduce certain error states in the Sandbox by providing special values in the Web Payments SDK or In-App Payments SDK.
If you use one of the following values, the returned payment token generates an error when it's processed by the CreatePayment endpoint.
To test SCA in the Square Sandbox, you should use a payment token returned by the Web Payments SDK. To test different SCA scenarios, use the cards provided in the following table.
Use the Payments.verifyBuyer function for card-not-present and card-on-file (CoF) SCA challenges with the following test values.
The SCA flow requires buyers to provide 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 using SMS.
The SCA flow and these test values aren't supported in the legacy Sandbox.
To test SCA in the Square Sandbox, you should use a payment token returned by the In-App Payments SDK. To test different SCA scenarios, use the cards provided in the following table.
In the Sandbox, the following payment amounts in a CreatePayment request generate a
Payment object with
risk_evaluation identifying the specific risk levels.