# Test Card Numbers
source: https://developer.mastercard.com/mastercard-gateway/documentation/test-cards/test-card-numbers/index.md

The purpose of test card numbers in the Mastercard Gateway is to allow developers and merchants to simulate real payment transactions in a safe, controlled environment without using actual cardholder data.

Mastercard Gateway provides merchants and partners with a **full end-to-end test environment**.

## Testing Process {#testing-process}

The testing process includes **development** , **transactional** , and **production** stages.

* **Merchants** use a merchant ID with the **TEST** prefix to validate their integration, before transitioning to live production.
* **Partners** use a non-TEST prefix to complete **DCF** and clearing testing.   
  Partners perform:
  * Profile setup and integration testing
  * MTF testing with simulators
  * DCF file validation before going live
* When the Merchant Manager creates a merchant ID, it automatically generates a duplicate ID with the **TEST** prefix for testing purposes.

### Test environments {#test-environments}

The test environment is designed to validate integration with the Mastercard Gateway. You can simulate various transaction types and responses, while ensuring correct formatting and authentication of API requests.

## How to Use Test Cards {#how-to-use-test-cards}

#### 1. Use the Test Environment {#1-use-the-test-environment}

Access the **Member Test Facility (MTF)** at:  

<https://mtf.gateway.mastercard.com/>  

This environment simulates real transaction flows without processing actual payments.

#### 2. Use the Merchant ID Format {#2-use-the-merchant-id-format}

When testing, use a merchant ID with the **TEST** prefix (e.g., `TESTmyshop`).  

This ensures the gateway routes the transaction through the test environment.

#### 3. Select the Right Test Card Numbers {#3-select-the-right-test-card-numbers}

Mastercard provides test card numbers that simulate various transaction scenarios:

* Successful payments
* Declines
* Authentication flows  
  These card numbers are **not real** and only valid in the test environment.  
  The test card numbers are listed by [country](https://developer.mastercard.com/mastercard-gateway/documentation/test-cards/test-card-numbers/test-card-numbers-brand/index.md) and by [brand](https://developer.mastercard.com/mastercard-gateway/documentation/test-cards/test-card-numbers/test-card-numbers-country/index.md).

#### 4. Avoid Exposing Sensitive Fields {#4-avoid-exposing-sensitive-fields}

Do **not** expose sensitive fields like:

* Merchant ID
* API Password
* Amount  
  in HTML forms (even as hidden fields).  
  Always calculate these values securely in your backend before sending the transaction request.

#### 5. Create a Valid Transaction Request {#5-create-a-valid-transaction-request}

Include required fields such as:

* `order.id` -- unique identifier for the order
* `transaction.id` -- unique identifier for the transaction
* `sourceOfFunds.provided.card.number` -- test card number
* `sourceOfFunds.provided.card.expiry` -- expiry date
* `sourceOfFunds.provided.card.securityCode` -- CVV

Format the request in **REST JSON** and authenticate using your **test credentials**.
Note: To test your integration using test gift card numbers and response codes, contact your payment service provider for test data.
