> For the complete documentation index, see [llms.txt](https://aplazo.gitbook.io/aplazo-integrations/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://aplazo.gitbook.io/aplazo-integrations/online-api/getting-started.md).

# Getting Started

Consider these points about the Online API integration path:

## Obtain API Keys

Before you begin, you’ll need the credentials required to authenticate requests to our API.

* Initially, we’ll provide you with a Merchant ID and API Token.
* After you finish the onboarding process with our commercial team and are ready to dive into the technical details, we’ll share your credentials.
* If needed, send an email to <soporte-integraciones@aplazo.mx> to request your API keys.

***

## Authentication

All requests to Aplazo’s Online API must include a valid Bearer token in the header. You’ll obtain this token by calling the [Authentication](/aplazo-integrations/api-reference/online-api/authentication.md) endpoint using your API Token and Merchant ID.

{% hint style="warning" %}
**Important:** A new Bearer token should be generated for each request to ensure that every API call is properly authenticated.
{% endhint %}

**Example Request**

```bash
curl --location 'https://api.aplazo.net/api/auth' \
--header 'Content-Type: application/json' \
--data '{
    "apiToken": "93e28f44-e352-42df-af84-7a9ffc9f5734",
    "merchantId": 2639
}'
```

**Example Response**

```json
{
    "Authorization": "Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9..."
}
```

When you receive the Authorization token, include it in the `Authorization` header for your immediate API call. For example:

```
Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9...
```

If you need to make another request, retrieve another new token following the same authentication process.

***

## Environments

### Development Environment

You can test and validate all scenarios in our development environment before going live.

| Endpoint                                                                                                                                 | Description                                        | Development Server                       |
| ---------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------- | ---------------------------------------- |
| [<mark style="color:blue;">`POST`</mark> /auth](/aplazo-integrations/api-reference/online-api/authentication.md)                         | Get Bearer Token for authentication                | <https://api.aplazo.net/api>             |
| [<mark style="color:blue;">`POST`</mark> /loan](/aplazo-integrations/api-reference/online-api/create-a-payment.md)                       | Create payment, get checkout url for your customer | <https://api.aplazo.net/api>             |
| [<mark style="color:green;">`GET`</mark>  /v1/merchant/loan/cancel](/aplazo-integrations/api-reference/online-api/cancel-payment.md)     | Cancel a payment                                   | <https://refunds-bifrost.aplazo.net/api> |
| [<mark style="color:green;">`GET`</mark> /v1/loan/status](/aplazo-integrations/api-reference/online-api/get-payment-status.md)           | Consult payment status                             | <https://merchant.aplazo.net/api>        |
| [<mark style="color:blue;">`POST`</mark> /loan/refund-from-cart](/aplazo-integrations/api-reference/online-api/request-a-refund.md)      | Request a partial or full refund                   | <https://merchant.aplazo.net/api>        |
| [<mark style="color:green;">`GET`</mark> /v1/merchant/refund/status](/aplazo-integrations/api-reference/online-api/get-refund-status.md) | Consult refund status                              | <https://merchant.aplazo.net/api>        |

### Production Environment

After thorough testing and certification of your integration, you can switch to production and start offering installment payments to your customers.

{% hint style="warning" %}
When switching to our production environment, replace the `.net` top-level domain for `.mx`&#x20;
{% endhint %}

***

## Webhooks

For each payment request you send, you'll have to provide Aplazo with the URL where you want to receive webhook notifications.

When a payment is completed, Aplazo will send a real-time notification to your configured endpoint, allowing you to keep your system up to date.

### Webhook Security

* **IP Whitelisting**: If necessary, you can whitelist the static IP addresses from which Aplazo sends webhooks.
* **Authentication**: Aplazo supports sending either Basic or Bearer authentication headers in webhooks for added security.

[\[View Webhook Documentation →\]](/aplazo-integrations/api-reference/webhook-confirmation.md)
