> ## 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.

# Headless no React Native

> Crie uma UI totalmente personalizada para os seus pagamentos com a integração Headless.

> [!NOTE]
>
> **Esta página documenta um SDK legado.** Vai começar uma nova integração? Use o [Yuno SDK](https://docs.y.uno/pt-br/docs/yuno-sdk/get-started.md). Já usa um SDK legado? Siga o [guia de migração](https://docs.y.uno/pt-br/docs/yuno-sdk/migration/overview.md).
>
> O novo **Yuno SDK** (Web v2.x, iOS v3.x, Android v3.x, React Native v2.x) substitui os SDKs Full, Lite, Seamless, Render, Headless e Secure Fields por uma única API em todas as plataformas. Os SDKs legados continuam com suporte em paralelo durante a transição, e a descontinuação deles está prevista para **2027**. Entre em contato com o seu Account Manager para planejar a migração.

> [!WARNING]
>
> **Orientation: Choosing Your Integration Flow**, before you begin, please review the [Official Integration Flow](https://docs.y.uno/docs/sdks/overview/understanding-flows.md).
>
> * **Standard Flow ([Full Checkout](https://docs.y.uno/docs/sdks/full-checkout/web-payments))**: Recommended for most merchants. Yuno handles the UI, security, and automatic updates for payment methods.
> * **Custom Flow (This SDK)**: Use this only if you require full control over the UX. **Note**: You will be responsible for manually handling payment statuses, 3DS transitions, and fraud routing data collection.

Crie formulários de pagamento totalmente personalizados quando você precisar de controle completo sobre cada elemento da UI, de uma experiência de checkout altamente sob medida, ou quando tiver os recursos de desenvolvimento para construir a sua própria UI.

## Fluxo de integração

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

const CustomPaymentForm = () => {
  const [cardNumber, setCardNumber] = useState('');
  const [expiry, setExpiry] = useState('');
  const [cvv, setCvv] = useState('');
  
  const processPayment = async () => {
    try {
      // 1. Use headless API to generate a one-time token
      const result = await YunoSdk.generateToken({
        checkoutSession: 'session_id',
        paymentMethod: {
          type: 'CARD',
          card: {
            number: cardNumber,
            expirationMonth: parseInt(expiry.split('/')[0]),
            expirationYear: parseInt(expiry.split('/')[1]),
            securityCode: cvv,
            holderName: 'John Doe',
            type: 'CREDIT',
          },
        },
      }, 'session_id', 'US');
      
      
      // 2. Create payment with token on your backend
      await createPayment(result.token);
      
      // 3. Handle 3DS if needed - use getThreeDSecureChallenge
      const challengeResult = await YunoSdk.getThreeDSecureChallenge('session_id', 'US');
      if (challengeResult.type === 'URL') {
        // Open 3DS URL in WebView, then continue payment
        await YunoSdk.continuePayment('session_id', 'US', true);
      }
      
    } catch (error) {
      console.error('Payment error:', error);
    }
  };
  
  return (
    <View>
      <TextInput
        placeholder="Card Number"
        value={cardNumber}
        onChangeText={setCardNumber}
      />
      <TextInput
        placeholder="MM/YY"
        value={expiry}
        onChangeText={setExpiry}
      />
      <TextInput
        placeholder="CVV"
        value={cvv}
        onChangeText={setCvv}
        secureTextEntry
      />
      <Button title="Pay" onPress={processPayment} />
    </View>
  );
};
```

## Tratamento do 3DS

Em integrações headless, você precisa disparar manualmente o desafio 3DS se o pagamento exigir autenticação.

1. Depois de criar o pagamento no seu backend, se o status for `WAITING_FOR_ACTION`, chame `YunoSdk.getThreeDSecureChallenge`.
2. Se uma URL for retornada, exiba-a ao usuário.
3. Quando o usuário concluir o desafio, chame `YunoSdk.continuePayment` para finalizar a transação.


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