> For the complete documentation index, see [llms.txt](https://docs.one-cp.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.one-cp.com/integration-and-development/testing/test-credentials.md).

# Test Environment Setup

Test environment setup and general credentials for 1-CP Corporate Checkout

This page covers the general testing environment setup for 1-CP Corporate Checkout. For payment provider-specific test cards, see the individual payment configuration sections.

## 🌍 Environment Configuration

### Staging Environment (`*.1-cp.io`)

* **API Base URL**: `https://api.1-cp.io`
* **Dashboard URL**: `https://dash.1-cp.io`
* **Checkout URL**: `https://checkout.1-cp.io`
* **Purpose**: Development, testing, and integration validation

### Production Environment (`*.1-cp.com`)

* **API Base URL**: `https://api.1-cp.com`
* **Dashboard URL**: `https://dash.1-cp.com`
* **Checkout URL**: `https://checkout.1-cp.com`
* **Purpose**: Live transactions and production workloads

## 🔑 Test API Credentials

### Getting Your Test Credentials

1. Register at [Staging Dashboard](https://dash.1-cp.io)
2. Navigate to **Config** → **Widget**
3. Create a test widget to get your `client-id` and `client-secret`
4. Use these credentials for all staging API calls

### Authentication Example

```javascript
// Staging environment configuration
const config = {
  env: "sandbox",
  apiBase: "https://api.1-cp.io",
  clientId: "your-staging-client-id",
  clientSecret: "your-staging-client-secret",
};
```

## 🏢 Test Business Units

### Default Test Business Unit

* **Name**: Test Corporate BU
* **Currency**: EUR, USD (multi-currency enabled)
* **Features**: All payment methods enabled
* **Location**: Available in staging dashboard

### Creating Additional Test Business Units

1. Log in to [dash.1-cp.io](https://dash.1-cp.io)
2. Navigate to **Organization** → **Business Units**
3. Create new business unit with test data
4. Configure payment methods and permissions

## 👥 Test User Accounts

### Test Admin User

* **Email**: `admin@test-company.example`
* **Role**: Admin (full access)
* **Business Unit**: Test Corporate BU
* **Permissions**: All resources (read, write, admin)

### Test Employee User

* **Email**: `employee@test-company.example`
* **Role**: User (limited access)
* **Business Unit**: Test Corporate BU
* **Permissions**: Transaction creation only

## ⚙️ SDK Configuration for Testing

### Web SDK Test Setup

```javascript
import { init } from "@one-cp/web-checkout";

init({
  transactionID: "your-test-transaction-id",
  widgetID: "your-test-widget-id",
  config: {
    env: "sandbox", // ← Important: Use sandbox environment
    mode: "lightbox",
  },
  onSuccess: (data) => {
    console.log("Test transaction completed!", data);
  },
  onError: (error) => {
    console.error("Test transaction failed:", error);
  },
});
```

### Backend API Configuration

```javascript
// Node.js example for staging environment
const axios = require("axios");

const oneCP = axios.create({
  baseURL: "https://api.1-cp.io",
  headers: {
    Authorization: `Bearer ${stagingAccessToken}`,
    "Content-Type": "application/json",
  },
});
```

## 💰 Test Transaction Limits

### Staging Environment Limits

* **Minimum Amount**: €0.01 / $0.01
* **Maximum Amount**: €10,000 / $10,000
* **Daily Limit**: €50,000 / $50,000 per business unit
* **Monthly Limit**: No limit in staging

### Test Amount Guidelines

* Use round numbers for easy verification (€100.00, $250.00)
* Test both small amounts (€1.00) and larger amounts (€1,000.00)
* Include decimal precision testing (€123.45)

## 📊 Test Data Guidelines

### Customer Information

Use realistic but obviously fake data:

```json
{
  "customer": {
    "firstName": "John",
    "lastName": "Doe",
    "email": "john.doe@test-company.example",
    "phone": "+49 30 12345678"
  },
  "billing": {
    "name": "Test Company GmbH",
    "email": "billing@test-company.example",
    "address": {
      "street": "Test Street",
      "house": "123",
      "city": "Berlin",
      "country": "Germany",
      "zipCode": "10115"
    }
  }
}
```

### Transaction Data

* **Reference Numbers**: Use prefixes like `TEST-`, `DEMO-`, `STAGING-`
* **Descriptions**: Clear indication of test nature
* **Categories**: Use all available categories (ACCOMMODATION, FLIGHT, etc.)

## 🔗 Webhook Testing

### Test Webhook Endpoints

For local development and testing:

* **ngrok**: `https://ngrok.com` - For local testing with public URLs
* **webhook.site**: `https://webhook.site` - For quick webhook testing
* **requestbin.com**: `https://requestbin.com` - For inspecting webhook payloads

### Webhook Configuration

```javascript
// Example webhook endpoint for testing
app.post("/test-webhook", (req, res) => {
  console.log("Received webhook:", req.body);

  // Verify webhook signature in production
  const signature = req.headers["x-one-cp-signature"];

  // Process webhook event
  const { event, data } = req.body;
  console.log(`Event: ${event}`, data);

  res.status(200).send("OK");
});
```

### Test Webhook Events

All webhook events are triggered in staging:

* `transaction.created`
* `transaction.updated`
* `transaction.completed`
* `payment.completed`
* `payment.failed`

## 🧪 Testing Best Practices

### Test Scenarios Checklist

* [ ] **Successful Payment Flow**: Complete transaction end-to-end
* [ ] **Failed Payment Handling**: Test error scenarios and user experience
* [ ] **Webhook Processing**: Verify all webhook events are handled correctly
* [ ] **Multi-currency**: Test with EUR, USD, and other supported currencies
* [ ] **User Permissions**: Test with different user roles and business units
* [ ] **Mobile Responsiveness**: Test on various screen sizes
* [ ] **Network Issues**: Test timeout and retry scenarios

### Data Cleanup

* Test transactions are automatically purged after 30 days in staging
* No real money is processed in staging environment
* All test data is clearly marked in the dashboard
* Use consistent test data prefixes for easy identification

## 🔧 Rate Limits in Testing

### Staging Environment Limits

* **API Calls**: 1,000 requests/minute
* **Transaction Creation**: 100 transactions/minute
* **Webhook Delivery**: 500 events/minute

*Note: Production limits are more restrictive. Contact* [*support@one-cp.com*](mailto:support@one-cp.com) *for production rate limit information.*

## 🎯 Provider-Specific Test Credentials

For actual test card numbers and provider-specific testing scenarios:

* [**Stripe Test Cards**](/configuration-and-setup/payment/receiving/stripe-test-credentials.md) - Stripe-specific test cards and scenarios
* [**Gateway Test Cards**](/configuration-and-setup/payment/receiving/gateway-test-credentials.md) - Gateway Payment sandbox credentials

## ❗ Troubleshooting Test Environment

### Common Issues

**Invalid API Credentials**

* Ensure you're using staging credentials from dash.1-cp.io
* Verify your widget configuration is active
* Check that your client-id and client-secret are correct

**CORS Errors**

* Verify your domain is whitelisted in widget configuration
* Check that you're using the correct staging URLs
* Ensure proper headers are set in your requests

**Payment Failures**

* Verify you're using correct test cards for the payment provider
* Check that the payment method is enabled in your business unit
* Ensure currency compatibility between transaction and payment method

### Getting Help

* **Test Environment Issues**: <support@one-cp.com>
* **Integration Questions**: Check our [certification guide](/integration-and-development/testing/certification.md)
* **API Documentation**: [docs.one-cp.com/api-reference](https://docs.one-cp.com/api-reference)
* **Error Reference**: [Error Messages & Troubleshooting](/integration-and-development/testing/error-messages.md)
