# API Environments

Easypay provides two distinct environments for developing and running your payment integration.

## Test Environment

**Base URL**: `https://api.test.easypay.pt/2.0`

The test environment is designed for:

- Development and integration testing
- Experimenting with API features
- Testing payment flows without real money
- Validating your implementation before going live


### Test Credentials


```
AccountId: 2b0f63e2-9fb5-4e52-aca0-b4bf0339bbe6
ApiKey: eae4aa59-8e5b-4ec2-887d-b02768481a92
```

**Note**: These credentials only work in the test environment.

### Test Payment Methods

In the test environment, you can simulate different payment scenarios:

- Use test credit card numbers to simulate successful and failed transactions
- Test MB WAY payments without requiring actual phone confirmations
- Generate Multibanco references that can be marked as paid through the backoffice


## Production Environment

**Base URL**: `https://api.prod.easypay.pt/2.0`

The production environment is for:

- Live payment processing with real money
- Serving actual customers
- Production-grade operations


### Production Credentials

Production credentials must be generated through your Easypay account. Follow [this guide](https://www.easypay.pt/blog/como-gerar-chaves-de-autenticacao/) to create your production API keys.

**Important Security Notes**:

- Never use test credentials in production
- Keep production credentials secure and private
- Rotate production keys regularly
- Monitor production API usage for anomalies


## Switching Between Environments

To switch between environments, simply change the base URL in your API calls:

**Test Request**:


```bash
curl -L -X POST 'https://api.test.easypay.pt/2.0/single' \
  -H 'AccountId: <TEST_ACCOUNT_ID>' \
  -H 'ApiKey: <TEST_API_KEY>' \
  -H 'Content-Type: application/json' \
  --data-raw '{ ... }'
```

**Production Request**:


```bash
curl -L -X POST 'https://api.prod.easypay.pt/2.0/single' \
  -H 'AccountId: <PROD_ACCOUNT_ID>' \
  -H 'ApiKey: <PROD_API_KEY>' \
  -H 'Content-Type: application/json' \
  --data-raw '{ ... }'
```

## Best Practices

1. **Always Start with Test**: Develop and test your integration in the test environment first
2. **Use Environment Variables**: Store environment-specific configuration (URLs, credentials) in environment variables
3. **Separate Configurations**: Keep test and production configurations completely separate
4. **Monitor Both Environments**: Set up monitoring and alerting for both test and production
5. **Test Before Deploying**: Always test changes in the test environment before deploying to production


## Environment Differences

| Feature | Test Environment | Production Environment |
|  --- | --- | --- |
| Real Money | No | Yes |
| Test Credentials Available | Yes | No |
| Rate Limiting | Relaxed | Enforced |
| Data Persistence | May be reset | Permanent |
| Support SLA | Best effort | Production SLA |


## Next Steps

- [Authentication](/docs/authentication) - Learn how to authenticate your requests
- [Quick Start](/docs/quickstart) - Make your first API call
- [Error Handling](/docs/error-handling) - Handle errors in both environments