> For the complete documentation index, see [llms.txt](https://docs.payments.thalescloud.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.payments.thalescloud.io/classic-push-provisioning/es/casos-de-uso/ver-y-controlar/control-operacion-del-ciclo-de-vida.md).

# Control: operación del ciclo de vida

Después de que la aplicación del emisor realiza la verificación del consumidor, puede actualizar el estado de un token (suspender, reanudar, eliminar o activar). El SDK de Provisionamiento Push permite a la aplicación del emisor gestionar esta solicitud. El SDK envía la solicitud al TSH y luego directamente al TSP.

Ver [Código de autorización (formato JWT)](/classic-push-provisioning/es/guia-del-desarrollador/cifrado-y-autenticacion-de-datos/codigo-de-autorizacion-formato-jwt.md) para el `Código de autorización` requerido para este proceso. El `sub` claim debe ser la referencia del token.

> <i class="fa-info-circle">:info-circle:</i>
>
> #### Nota <a href="#note" id="note"></a>
>
> * El SDK de Provisionamiento Push no verifica si una operación de ciclo de vida determinada está permitida para un token.
> * La aplicación del emisor podría necesitar validar el estado del token antes de invocar una operación. Por ejemplo, la acción Activar requiere un token en el [PENDING\_IDV](https://thalesgroup.github.io/d1sdk-docs/tpc-sdk/android/latest/com/thalesgroup/tpcsdk/model/Token.html#getState\(\)) estado.
>   * Apple Pay: [requiresActivation](https://developer.apple.com/documentation/passkit/pksecureelementpass/passactivationstate/requiresactivation) estado.
>   * Google Pay: [GOOGLE\_PAY\_TOKEN\_STATE\_NEEDS\_IDENTITY\_VERIFICATION](https://thalesgroup.github.io/d1sdk-docs/tpc-sdk/android/latest/com/thalesgroup/tpcsdk/provisioning/CardDigitizationStatus.html#GOOGLE_PAY_TOKEN_STATE_NEEDS_IDENTITY_VERIFICATION)
>   * Samsung Pay: [SAMSUNG\_PAY\_PENDING\_PROVISION](https://thalesgroup.github.io/d1sdk-docs/tpc-sdk/android/latest/com/thalesgroup/tpcsdk/provisioning/CardDigitizationStatus.html#SAMSUNG_PAY_PENDING_PROVISION)

<figure><img src="/files/e2d4fd55b88c778d64611756846fccf6577b51e1" alt=""><figcaption></figcaption></figure>

{% tabs %}
{% tab title="iOS" %}

```swift
// relevante solo en caso de que SCHEME sea VISA, para MASTERCARD deje la cadena vacía
let tokenRequestorId = "40010030273" // Apple Pay para Visa

let scheme = "SCHEME" // VISA, MASTERCARD, AMEX
let authorizationCode = "<JWT>" // proporcione el valor JWT relacionado con la tarjeta concreta, obtenido del backend del emisor
let tokenId = pass.secureElementPass?.deviceAccountIdentifier // también puede obtenerse de: `Token.id`

TPCSDK.updateTokenState(tokenId: tokenId,
                        tokenRequestorId: tokenRequestorId,
                        schemeString: scheme,
                        authorizationCode: authorizationCode,
                        action: .Activate) { success, error in
    if let error = error {
      // manejar Error TPC
    } else if success {
      // por hacer: actualizar la IU para indicar el estado de la digitalización de la tarjeta
    }
}
```

{% endtab %}

{% tab title="Android" %}

```java
// relevante solo en caso de que SCHEME sea VISA, para MASTERCARD deje la cadena vacía
String tokenRequestorId = "40010075001"; // para Google Pay o "40010043095" para Samsung Pay

String tokenId = "tokenId";
String scheme = "SCHEME"; // VISA, MASTERCARD
String authorizationCode = "<JWT>"; // proporcione el valor JWT relacionado con la tarjeta concreta, obtenido del backend del emisor

TPCManager.getInstance().getTSHProxy().updateTokenState(tokenId,
        tokenRequestorId,
        scheme,
        authorizationCode,
        TokenAction.ACTIVATE,
        new TPCSDKListener<Boolean>() {
            @Override
            public void onStart() {
                // al iniciar
            }

            @Override
            public void onSuccess(TPCResult<Boolean> result) {
                Log.i(TAG, "Estado del token actualizado");
                Boolean status = result.getResult();

                // TODO: actualizar la IU para el nuevo estado
            }

            @Override
            public void onError(TPCSDKException exception) {
                Log.e("TAG", "Error en la solicitud updateTokenState = " + exception.getMessage());
            }
        });
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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.payments.thalescloud.io/classic-push-provisioning/es/casos-de-uso/ver-y-controlar/control-operacion-del-ciclo-de-vida.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.
