> ## 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 payment links into your application

## API Integration

The **Payment Link** uses HUB2 API endpoints.
The available endpoints are listed in the following documentation:

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

## Authentication

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

* `Api.payment_create`
* `Api.payment_intent_create`
* `Api.payment_intent_read`
* `Api.payment_intent_auth_create`
* `Api.payment_fees_read`

<Card title="Permissions configuration" icon="link" href="/integration/en/payment_links/payment-links_setup#configuration-in-the-hub2-dashboard" arrow="true" cta="Go to the permissions configuration guide for API keys" />

## API Endpoints

Payment links use creation and read endpoints similar to standard endpoints

### Payment Link

* `POST /payment-links/` - Create a payment link by defining the necessary payment methods.
  Payment and payment intent will be handled based on the customer journey.
  Here is an example.

<CodeGroup>
  ```bash Curl {1} theme={null}
  curl --location 'https://api.hub2.io/payment-links' \
  --header 'environment: sandbox' \
  --header 'merchantId: [REDACTED]' \
  --header 'Content-Type: application/json' \
  --header 'ApiKey: [REDACTED]' \
  --data '{
      "purchaseReference": "<YOUR_INTERNAL_CUSTOMER_REFERENCE>",
      "description":"Payment Links are the fastest way to start accepting payments from your customers.",
      "amount": 500,
      "currency": "XOF",
      "type":"single_use",
      "expirationDate": "2025-10-28T20:30:00",
      "paymentMethods": [
          "mobile_money"
      ],
      "country": "CI",
      "providers": [
          "Orange",
          "Wave",
          "MTN",
          "Moov"
      ],
      "successUrl":"pay.hub2.io/success",
      "failureUrl":"pay.hub2.io/failure"
      
  }'
  ```
</CodeGroup>

* `PATCH /payment-links/{id}/close` - Close a payment link before expiration
* `GET /payment-links` - List created payment links
* `GET /payment-links/{id}` - Retrieve a specific payment link and display associated payments attempts

## Webhooks

This uses the same webhooks as the payment endpoints. If you have already configured webhooks for payments/, no additional steps are required. Otherwise, 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" />
