> ## Documentation Index
> Fetch the complete documentation index at: https://docs.hub2.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Integration

> Learn how to integrate Processing Only mode into your application

## API Integration

**Processing Only** mode uses dedicated HUB2 API endpoints that are different from our traditional aggregation model. The main difference is that transactions are processed directly through your provider accounts instead of our aggregated accounts.
Available endpoint are availble at:

<Card title="Delegation API" icon="link" href="https://api.hub2.io/docs#/Delegation" arrow="true" cta="Go to API Delegation documentation" />

## Authentication

Your integration uses the same HUB2 API keys for authentication but the key must have new permissions:

* `Api.delegated_payment_create`
* `Api.delegated_transfer_create`

<Card title="Permissions Configuration" icon="link" href="/integration/en/processing_only/processing_only_setup#configuration-in-hub2-dashboard" arrow="true" cta="Go to API key permissions configuration guide" />

## Transaction Flow

### 1. Transaction Request

When you initiate a transaction, HUB2 will:

1. **Validate Request**: Check your API key and request format
2. **Route to Provider**: Direct the request to your configured provider account
3. **Process Transaction**: Execute the transaction using your provider credentials
4. **Return Response**: Provide a unified response format regardless of the provider

### 2. Provider Processing

The actual transaction processing happens directly with your provider:

```mermaid theme={null}
sequenceDiagram
    participant M as Merchant
    participant H as HUB2
    participant P as Provider

    M->>H: Payment Request
    H->>P: Process via Merchant Account
    P->>H: Transaction Response
    H->>M: Unified Response
```

## API Endpoints

Processing Only mode uses dedicated creation endpoints, while reading endpoints remain the same as traditional ones:

### Payments

* `POST /delegated/payments` - Create a payment using your provider account
  Unlike classic payments, there's no need to create a payment intent first before attempting a payment.
  Here, you directly make the payment attempt. Here's an example.

<CodeGroup>
  ```bash Curl {1} theme={null}
  curl --location 'https://api.hub2.io/delegated/payments' \
  --header 'environment: sandbox' \
  --header 'merchantId: [REDACTED]' \
  --header 'Content-Type: application/json' \
  --header 'ApiKey: [REDACTED]' \
  --data '{
      "customerReference": "<YOUR_INTERNAL_CUSTOMER_REFERENCE>",
      "purchaseReference": "<YOUR_INTERNAL_REFERENCE>",
      "amount": 120,
      "currency": "XOF",
      "paymentMethod": "mobile_money",
      "country": "CI",
      "provider": "orange",
      "mobileMoney": {
          "msisdn": "00000001",
          "onCancelRedirectionUrl": "https://failed.com",
          "onFinishRedirectionUrl": "https://success.com",
          "workflow": "redirection"
      }
  }'
  ```
</CodeGroup>

* `POST /delegated/payments/sync` - Create a payment using your provider account with synchronous mode (the list of providers supporting synchronous is availabe at [https://docs.hub2.io/integration/en/getting\_started/api\_operation#synchronous-circuit](https://docs.hub2.io/integration/en/getting_started/api_operation#synchronous-circuit))
* `GET /payments` - List payments (same as classic payments)
* `GET /payments/{id}/status` - Get payment status (same as classic payments)

<Card title="Payments integration guide" icon="link" href="/integration/en/payments/payments_integration" arrow="true" cta="Go to payments integration guide" />

### Transfers

* `POST /delegated/transfers` - Create a transfer using your provider accounts. Below is an example. Only the endpoint changes here in the request.

<CodeGroup>
  ```bash Curl {1} theme={null}
  curl --location --request POST 'https://api.hub2.io/delegated/transfers' \
  --header 'ApiKey: [REDACTED]' \
  --header 'MerchantId: [REDACTED]' \
  --header 'Environment: sandbox' \
  --header 'Content-Type: application/json' \
  --data-raw '{
    "reference": "<YOUR_INTERNAL_REFERENCE>",
    "amount": 2000,
    "currency": "XOF",
    "description": "<YOUR_DESCRIPTION>",
    "destination": {
      "type": "mobile_money",
      "country": "CI",
      "recipientName": "John Doe",
      "msisdn": "+225000000000",
      "provider": "orange"
    }
  }'
  ```

  ```typescript Typescript {4} theme={null}
  import fetch from 'node-fetch';

  async function postTransfer() {
      const response = await fetch('https://api.hub2.io/delegated/transfers', {
          method: 'POST',
          headers: {
              'ApiKey': '[REDACTED]',
              'MerchantId': '[REDACTED]',
              'Environment': 'sandbox',
              'Content-Type': 'application/json'
          },
          body: JSON.stringify({
              "reference": "<YOUR_INTERNAL_REFERENCE>",
              "amount": 2000,
              "currency": "XOF",
              "description": "<YOUR_DESCRIPTION>",
              "destination": {
                  "type": "mobile_money",
                  "country": "CI",
                  "recipientName": "John Doe",
                  "msisdn": "+225000000000",
                  "provider": "orange"
              }
          })
      });

      if (response.ok) {
          const result = await response.json();
          console.log(result);
      } else {
          console.log(`HTTP Status: ${response.status}`);
      }
  }

  postTransfer();
  ```

  ```python Python lines {26} theme={null}
  import json
  import requests

  headers = {
      'ApiKey': '[REDACTED]',
      'MerchantId': '[REDACTED]',
      'Environment': 'sandbox',
      'Content-Type': 'application/json',
  }

  data = {
      "reference": "<YOUR_INTERNAL_REFERENCE>",
      "amount": 2000,
      "currency": "XOF",
      "description": "<YOUR_DESCRIPTION>",
      "destination": {
          "type": "mobile_money",
          "country": "CI",
          "recipientName": "John Doe",
          "msisdn": "+225000000000",
          "provider": "orange"
      }
  }

  response = requests.post(
      'https://api.hub2.io/delegated/transfers',
      headers=headers,
      data=json.dumps(data)
  )

  if response.status_code == 200:
      print(response.json())
  else:
      print(f'HTTP Status: {response.status_code}')
  ```
</CodeGroup>

* `POST /delegated/transfers/irt` - Create an IRT transfer using your provider accounts
* `GET /transfers` - List transfers (same as classic transfers)
* `GET /transfers/{id}/status` - Get transfer status (same as classic transfers)

<Card title="Transfers integration guide" icon="link" href="/integration/en/transfers/transfers_integration" arrow="true" cta="Go to transfers integration guide" />

## Webhooks

This uses the same webhooks as the classic circuit. If you've already configured webhooks for payments/
transfers, no extra steps are required. Else, see:

<Card title="Webhooks integration guide" icon="link" href="https://docs.hub2.io/integration/en/webhooks/webhooks_overview" arrow="true" cta="Go to the Webhooks integration guide" />
