# Create a Test Transaction
source: https://developer.mastercard.com/transaction-notifications/documentation/tutorials-and-guides/test-transaction/index.md

Use the transaction simulation endpoint to create a test transaction in Sandbox and verify that your webhook receives notifications and processes them correctly.
Note: This endpoint is limited to **Sandbox** environment.

## Before You Begin {#before-you-begin}

Confirm the following:

* You have enrolled a card through [Consent Management \& Enrollment](https://developer.mastercard.com/consent-management/documentation/) and obtained a `cardReference`.
* Your webhook endpoint is registered and accessible.
* You have [configured OAuth credentials](https://developer.mastercard.com/transaction-notifications/documentation/api-basics/index.md#client-authentication) for Sandbox.

## Create a Test Transaction {#create-a-test-transaction}

1. Prepare your card identifier using a `cardReference` from your Consent Management \& Enrollment flow, or a `cardNumber` (PAN). If you have neither, set up a cardholder enrollment first using the [Consent Management \& Enrollment](https://developer.mastercard.com/consent-management/documentation/). If both `cardReference` and `cardNumber` are provided, `cardReference` takes precedence.

2. Make a simulation request by sending a `POST` request to the Transaction Simulation endpoint with your card identifier and transaction details.


   API Reference: `POST /notifications/transactions`

   <br />

3. Receive the webhook notification. Mastercard sends a simulated notification to your registered webhook endpoint within seconds. The notification contains:

   * Card reference
   * Transaction amount and currency
   * Merchant details
   * Issuer decision (approval or decline)

   For a complete list of notification data elements, see the [Transaction Notifications Webhook API](https://developer.mastercard.com/transaction-notifications/documentation/api-reference/transaction-notification-webhook/index.md#api-specification) specification.
4. Acknowledge the notification by returning a `200` or `201` response from your webhook to acknowledge receipt of the notification.

5. Verify the transaction and associate the cardholder using the card reference. You can then store or process the transaction data. Test downstream logic such as notifications, categorization, or alerts.

## Troubleshooting {#troubleshooting}

| Error                     | Cause                                                                                                     | Solution                                                                                                                      |
|:--------------------------|:----------------------------------------------------------------------------------------------------------|:------------------------------------------------------------------------------------------------------------------------------|
| `404 UnknownCard`         | Card reference is invalid or the card is not yet enrolled using the Consent Management \& Enrollment API. | Verify the card reference is valid and the card is enrolled.                                                                  |
| `400 MissingFields`       | Required fields are missing.                                                                              | Check that `cardholderAmount`, `cardholderCurrency`, `merchantName`, and either `cardReference` or `cardNumber` are included. |
| Notification not received | Webhook endpoint is unreachable                                                                           | Verify your webhook URL is accessible and returning `200`/`201`.                                                              |

## Next Steps {#next-steps}

* Review [Testing](https://developer.mastercard.com/transaction-notifications/documentation/testing/index.md) for more test scenarios and troubleshooting.
* Explore [Retrieve Clearing Data](https://developer.mastercard.com/transaction-notifications/documentation/tutorials-and-guides/clearing-data/index.md) to fetch historical transaction details.
* Proceed to [Expense Management Use Case](https://developer.mastercard.com/transaction-notifications/documentation/use-case-expense-mangement/index.md) for a complete end-to-end example.
