# Ir a producción

### 1. Obtener certificado de producción

Si aún no lo hiciste, en este momento necesitas obtener los certificados de producción. Aquí te dejo una guía sobre cómo obtenerlos.

{% embed url="<https://afipsdk.com/blog/como-obtener-certificado-para-web-services-arca/>" %}

### 2. Cambiar los parámetros

{% tabs %}
{% tab title="Node" %}
Debes agregar el `cert`, `key` y configurar `production` en `true`.

```javascript
import Afip from '@afipsdk/afip.js';
import fs from 'fs';

// Certificado (Puede estar guardado en archivos, DB, etc)
const cert = fs.readFileSync('./certificado.crt', {encoding: 'utf8'});

// Key (Puede estar guardado en archivos, DB, etc)
const key = fs.readFileSync('./key.key', {encoding: 'utf8'});

const afip = new Afip({ 
    CUIT: 20111111112,
    cert: cert,
    key: key,
    access_token: 'access_token obtenido en https://app.afipsdk.com/',
    production: true
});
```

{% endtab %}

{% tab title="PHP" %}
Debes agregar el `cert`, `key` y configurar `production` en `true`.

<pre class="language-php"><code class="lang-php">// Certificado (Puede estar guardado en archivos, DB, etc)
$cert = file_get_contents('./certificado.crt');

// Key (Puede estar guardado en archivos, DB, etc)
$key = file_get_contents('./key.key');

<strong>$afip = new Afip(array(
</strong>    'CUIT' => 20111111112,
    'cert' => $cert,
    'key' => $key,
    'access_token' => 'access_token obtenido en https://app.afipsdk.com/',
    'production' => TRUE
));
</code></pre>

{% endtab %}

{% tab title="Ruby" %}
Debes agregar el `cert`, `key` y configurar `production` en `true`.

```ruby
# Certificado (Puede estar guardado en archivos, DB, etc)
cert = File.read("./certificado.crt")

# Key (Puede estar guardado en archivos, DB, etc)
key = File.read("./key.key")

afip = Afip.new({ 
    "CUIT": 20111111112,
    "cert": cert,
    "key": key,
    "access_token": "access_token obtenido en https://app.afipsdk.com/",
    "production": true
})
```

{% endtab %}

{% tab title="Python" %}
Debes agregar el `cert`, `key` y configurar `production` en `true`.

```python
# Certificado (Puede estar guardado en archivos, DB, etc)
cert = open("./certificado.crt").read()

# Key (Puede estar guardado en archivos, DB, etc)
key = open("./key.key").read()

afip = Afip({ 
    "CUIT": 20111111112,
    "cert": cert,
    "key": key,
    "access_token": "access_token obtenido en https://app.afipsdk.com/",
    "production": True
})
```

{% endtab %}

{% tab title=".NET" %}
Debes agregar el `Cert`, `Key` y configurar `Production` en `true`.

```csharp
// Certificado (Puede estar guardado en archivos, DB, etc)
string cert = "-----BEGIN CERTIFICATE-----\nMIIDRzC...";

// Key (Puede estar guardado en archivos, DB, etc)
string key = "-----BEGIN RSA PRIVATE KEY-----\r\nMIIEowIBAAKCA...";

var afip = new Afip(new AfipOptions
{
    CUIT = 20111111112,
    Cert = cert,
    Key = key,
    AccessToken = "access_token obtenido en https://app.afipsdk.com/",
    Production = true
});
```

{% endtab %}

{% tab title="API" %}
En los requests cambiar el parámetro `environment: prod`

```json
{
    "environment": "prod"
}
```

En los request de Autorización agregarle el cert y key de producción

```json
{
    "environment": "prod",
    "cert": "-----BEGIN CERTIFICATE-----\nMIIDRzC...",
    "key": "-----BEGIN RSA PRIVATE KEY-----\r\nMIIEowIBAAKCA..."
}
```

{% endtab %}
{% endtabs %}

Eso es todo. Los requests que realices con esta configuración ya van a impactar en los web services de producción.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.afipsdk.com/siguientes-pasos/ir-a-produccion.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
