> 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/overview-and-getting-started/getting-started.md).

# Getting Started

Quick start guide to integrate 1-CP Corporate Checkout

Welcome to 1-CP Corporate Checkout! This guide will help you integrate our corporate payment solution into your application in just a few minutes.

## Overview

1-CP Corporate Checkout is a comprehensive payment solution designed specifically for corporate transactions. It provides:

* **Streamlined Corporate Purchasing**: Simplify business expense management
* **Multiple Payment Methods**: Support for cards, corporate accounts, and virtual payment solutions
* **Compliance & Reporting**: Built-in compliance features and detailed reporting
* **Global Currency Support**: Process payments in multiple currencies worldwide

## Prerequisites

Before you begin, ensure you have:

* [ ] **1-CP Account**: [Sign up](https://dash.1-cp.io) for a staging account
* [ ] **Business Unit Setup**: Configure your business unit in the dashboard
* [ ] **API Credentials**: Obtain your `client-id` and `client-secret`
* [ ] **Development Environment**: Node.js 14+ or any web development setup

## Quick Start (5 minutes)

### Step 1: Get Your Credentials

1. Log in to the [Staging Dashboard](https://dash.1-cp.io)
2. Navigate to **Config** → **Widget**
3. Create a new widget configuration
4. Copy your `client-id` and `client-secret`

### Step 2: Install the SDK

Choose your preferred installation method:

**NPM:**

```bash
npm install @one-cp/web-checkout
```

**CDN:**

```html
<script src="https://one-cp-public.s3.eu-central-1.amazonaws.com/init.min.js"></script>
```

### Step 3: Create Your First Transaction

**Backend (Create Transaction):**

```javascript
// Example using Node.js/Express
// For complete API documentation: https://docs.one-cp.com/api-reference
const response = await fetch("https://api.1-cp.io/v1/transactions/initialize", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${accessToken}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    title: "Hotel Booking",
    currency: "EUR",
    items: [
      {
        name: "Business Hotel Room",
        category: "ACCOMMODATION",
        price: 15000, // €150.00 in minor units
        quantity: {
          amount: 2,
          unit: "FLAT_FEE",
        },
      },
    ],
  }),
});

const { transactionID } = await response.json();
```

**Frontend (Initialize Checkout):**

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

// Initialize checkout
init({
  transactionID: "your-transaction-id",
  widgetID: "your-widget-id",
  config: {
    env: "sandbox", // Use 'production' for live transactions
    mode: "lightbox",
  },
  onSuccess: (data) => {
    console.log("Payment completed successfully!", data);
    // Handle successful payment
  },
  onError: (error) => {
    console.error("Payment failed:", error);
    // Handle payment errors
  },
});
```

### Step 4: Test Your Integration

Use our test credentials to verify your setup:

**Test Card Numbers:**

* Visa: `4242 4242 4242 4242`
* Mastercard: `5555 5555 5555 4444`
* CVV: `123`
* Expiry: Any future date

## Configuration Options

### Environment Setup

Configure your environment based on your needs:

```javascript
const config = {
  env: "sandbox", // 'sandbox' | 'production'
  mode: "lightbox", // 'lightbox' | 'inline'
  lang: "en", // 'en' | 'de'
  redirectURL: "https://yoursite.com/success",
};
```

### Payment Methods

Configure which payment methods to accept:

1. Navigate to **Dashboard** → **Payment Configuration**
2. Select your payment providers / acquirer
3. Configure payment method restrictions
4. Set up business unit mappings

### Webhook Configuration

Set up webhooks to receive real-time payment notifications:

1. Go to **Dashboard** → **Configurations** → **Connectors**
2. Create a new Webhook connector
3. Configure your endpoint URL
4. Select event triggers (create, update, complete, etc.)

## Common Integration Patterns

### E-commerce Integration

```javascript
// Add to your checkout flow
function initiatePayment(cartItems) {
  const transactionData = {
    title: "Purchase Order #12345",
    currency: "USD",
    items: cartItems.map((item) => ({
      name: item.name,
      category: item.category,
      price: item.price * 100, // Convert to minor units
      quantity: {
        amount: item.quantity,
        unit: "FLAT_FEE",
      },
    })),
  };

  // Create transaction via your backend
  createTransaction(transactionData).then(({ transactionID }) => {
    init({
      transactionID,
      widgetID: "your-widget-id",
      config: { env: "production" },
      onSuccess: handlePaymentSuccess,
      onError: handlePaymentError,
    });
  });
}
```

### Travel Booking Integration

```javascript
// Travel-specific transaction
const travelTransaction = {
  title: "Business Trip - Berlin",
  currency: "EUR",
  items: [
    {
      name: "Hotel Accommodation",
      category: "ACCOMMODATION",
      price: 25000, // €250.00
      accommodationType: "HOTEL",
      roomType: "SINGLE",
      period: {
        start: "2025-12-01T15:00:00Z",
        end: "2025-12-03T11:00:00Z",
      },
      location: {
        street: "Unter den Linden",
        house: "1",
        city: "Berlin",
        country: "Germany",
        postCode: "10117",
      },
    },
    {
      name: "Flight Ticket",
      category: "FLIGHT",
      price: 45000, // €450.00
      flightNumber: "LH441",
      departure: "FRA",
      destination: "TXL",
      serviceClass: "BUSINESS_CLASS",
    },
  ],
};
```

## Next Steps

Now that you have a basic integration running:

1. **Configure Payment Methods**: Set up your preferred payment providers
2. **Customize Appearance**: Brand the checkout experience with your colors and logo
3. **Set Up Reporting**: Configure webhooks and reporting connectors
4. **Test Thoroughly**: Use our comprehensive test scenarios
5. **Go Live**: Switch to production environment

## Need Help?

* **Documentation**: Browse our complete [API reference](https://docs.one-cp.com/api-reference) and guides
* **Test Scenarios**: Review our [certification test cases](/integration-and-development/testing/certification.md)
* **Support**: Contact our integration team at <support@one-cp.com>
* **Community**: Join our developer community forum

## Troubleshooting

### Common Issues

**Invalid Transaction ID**

* Ensure the transaction was created successfully
* Check that you're using the correct environment (sandbox/production)
* Verify your API credentials are valid

**Payment Method Not Available**

* Check your payment configuration in the dashboard
* Ensure the payment method is enabled for your business unit
* Verify currency compatibility

**Checkout Not Loading**

* Confirm the SDK is loaded correctly
* Check for JavaScript console errors
* Ensure the container element exists (for inline mode)

For more detailed troubleshooting, see our [Error Messages](/integration-and-development/testing/error-messages.md) reference.
