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

> ## Agent Instructions
> Test in the sandbox first: base URL https://api-sandbox.y.uno (Test Mode in the Dashboard). Production is https://api.y.uno (Live Mode).
> Every API request needs the public-api-key and private-secret-key headers. Get them in the Dashboard at https://dashboard.y.uno/developers (Developers > Credentials); sandbox and production keys are different.
> Send an X-Idempotency-Key (a UUID) when creating payments, refunds and cancels, so retries do not create duplicates.
> Start with the Quickstart (https://docs.y.uno/docs/quickstart.md) and the agent guide (https://docs.y.uno/agents.md). To search these docs from a coding agent, connect the docs MCP server at https://docs.y.uno/mcp.

# Funciones avanzadas

> Optimización del rendimiento, deep linking y configuraciones específicas de cada plataforma para React Native.

> [!NOTE]
>
> **Esta página documenta un SDK heredado.** ¿Vas a iniciar una nueva integración? Usa el [Yuno SDK](https://docs.y.uno/docs/yuno-sdk/get-started.md). ¿Ya usas un SDK heredado? Sigue la [guía de migración](https://docs.y.uno/docs/yuno-sdk/migration/overview.md).
>
> El nuevo **Yuno SDK** (Web v2.x, iOS v3.x, Android v3.x, React Native v2.x) reemplaza los SDK Full, Lite, Seamless, Render, Headless y Secure Fields con una sola API en todas las plataformas. Los SDK heredados siguen siendo compatibles en paralelo durante la transición y está previsto dejarlos de usar en **2027**. Contacta a tu Account Manager para planificar la migración.

> [!WARNING]
>
> **Orientación: elige tu flujo de integración**. Antes de comenzar, revisa el [flujo de integración oficial](https://docs.y.uno/docs/sdks/overview/understanding-flows.md).
>
> * **Flujo estándar ([Full Checkout](https://docs.y.uno/docs/sdks/full-checkout/web-payments))**: Recomendado para la mayoría de los comercios. Yuno se encarga de la interfaz, la seguridad y las actualizaciones automáticas de los métodos de pago.
> * **Flujo personalizado (este SDK)**: Úsalo solo si necesitas control total sobre la experiencia de usuario. **Nota**: Serás responsable de gestionar manualmente los estados de los pagos, las transiciones de 3DS y la recopilación de datos para el enrutamiento de fraude.

## Deep linking y regreso desde el navegador externo

Algunos flujos de pago redirigen a los usuarios a un navegador externo, entre ellos los desafíos de autenticación 3DS, las redirecciones de transferencia bancaria, los pagos con PIX y otros métodos de pago alternativos. Gestiona su regreso a tu app con los siguientes pasos.

### Define callback\_url en la sesión de checkout

Incluye `callback_url` al crear la sesión de checkout en tu backend:

```json theme={"theme":{"light":"github-dark","dark":"github-dark-dimmed"}}
{
  "callback_url": "myapp://return"
}
```

### Configura los deep links

**iOS - Info.plist:**

```xml theme={"theme":{"light":"github-dark","dark":"github-dark-dimmed"}}
<key>CFBundleURLTypes</key>
<array>
    <dict>
        <key>CFBundleTypeRole</key>
        <string>Editor</string>
        <key>CFBundleURLName</key>
        <string>com.yourapp</string>
        <key>CFBundleURLSchemes</key>
        <array>
            <string>myapp</string>
        </array>
    </dict>
</array>
```

**Android - AndroidManifest.xml:**

```xml theme={"theme":{"light":"github-dark","dark":"github-dark-dimmed"}}
<activity android:name=".MainActivity">
    <intent-filter android:autoVerify="true">
        <action android:name="android.intent.action.VIEW" />
        <category android:name="android.intent.category.DEFAULT" />
        <category android:name="android.intent.category.BROWSABLE" />
        <data
            android:scheme="myapp"
            android:host="return" />
    </intent-filter>
</activity>
```

### Gestiona los deep links en react-native

```typescript theme={"theme":{"light":"github-dark","dark":"github-dark-dimmed"}}
import { YunoSdk } from '@yuno-payments/yuno-sdk-react-native';
import { Linking } from 'react-native';
import { useEffect } from 'react';

function App() {
  useEffect(() => {
    // Handle initial URL (app opened from closed state)
    Linking.getInitialURL().then((url) => {
      if (url) {
        handleDeepLink(url);
      }
    });
    
    // Handle URL changes (app is running)
    const subscription = Linking.addEventListener('url', (event) => {
      handleDeepLink(event.url);
    });
    
    return () => {
      subscription.remove();
    };
  }, []);
  
  const handleDeepLink = async (url: string) => {
    // Check if it's a payment return URL
    if (url.startsWith('myapp://return')) {
      try {
        await YunoSdk.receiveDeeplink(url);
      } catch (error) {
        console.error('Error processing deep link:', error);
      }
    }
  };
}
```

### Continúa el pago después del regreso

Después de gestionar el deep link, continúa el flujo de pago:

```typescript theme={"theme":{"light":"github-dark","dark":"github-dark-dimmed"}}
const handleDeepLink = async (url: string) => {
  if (url.startsWith('myapp://return')) {
    try {
      await YunoSdk.receiveDeeplink(url);
      
      // Continue payment flow
      await YunoSdk.continuePayment(
        checkoutSessionId,
        'US',
        true // show payment status
      );
    } catch (error) {
      console.error('Error:', error);
    }
  }
};
```

## Rendimiento

### Carga diferida

Inicializa el SDK solo cuando el usuario entre al flujo de pago para ahorrar recursos.

```typescript theme={"theme":{"light":"github-dark","dark":"github-dark-dimmed"}}
const PaymentScreen = () => {
  const [yunoLoaded, setYunoLoaded] = useState(false);
  
  useEffect(() => {
    if (!yunoLoaded) {
      YunoSdk.initialize({
        apiKey: 'pk_test_key',
        countryCode: 'US',
      });
      setYunoLoaded(true);
    }
  }, []);
};
```

## Manejo de errores

Escucha el evento `onPaymentStatus` para gestionar los fallos de forma adecuada.

```typescript theme={"theme":{"light":"github-dark","dark":"github-dark-dimmed"}}
const subscription = YunoSdk.onPaymentStatus((state) => {
  if (state.status === 'FAILED') {
    Alert.alert('Error', 'Payment failed. Please try again.');
  }
});
```

## Configuración específica de cada plataforma

Gestiona las diferencias entre iOS y Android en tu app de React Native.

### Configuración condicional

```typescript theme={"theme":{"light":"github-dark","dark":"github-dark-dimmed"}}
import { Platform } from 'react-native';

await YunoSdk.initialize({
  apiKey: 'your-api-key',
  countryCode: 'US',
  ...(Platform.OS === 'ios' && {
    iosConfig: { /* iOS settings */ },
  }),
  ...(Platform.OS === 'android' && {
    androidConfig: { /* Android settings */ },
  }),
});
```

### Diferencias entre plataformas

| Función | iOS | Android |
| - | - | - |
| Escaneo de tarjetas | No disponible | Disponible |
| Deep links | Universal Links | Intent Filters |
| SO mínimo | iOS 14.0+ | API 21 (5.0)+ |


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.