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

# Analizzare un flusso di pagamento Stripe end-to-end

export const UseCaseHero = ({title, description, prompt, category, features, devinUrl, agent, intent, playbookId, type}) => {
  const encodedPrompt = encodeURIComponent(prompt || '');
  const tag = 'docs-use-case-gallery';
  const utm = 'utm_source=docs&utm_medium=use-case-gallery&utm_campaign=hero-cta';
  const agentParams = (agent ? '&agent=' + agent : '') + (intent ? '&intent=' + intent : '') + (playbookId ? '&playbookId=' + playbookId : '');
  const devinHref = type === 'schedule' ? 'https://app.devin.ai/settings/schedules/create?' + utm + agentParams + (prompt ? '&prompt=' + encodedPrompt : '') : type === 'review' ? 'https://app.devin.ai/review?' + utm : agent === 'ada' ? 'https://app.devin.ai/search?' + utm + '&noSubmit=true' + (prompt ? '&prompt=' + encodedPrompt : '') : devinUrl ? devinUrl.includes('?') ? devinUrl + '&' + utm + agentParams : devinUrl + '?' + utm + agentParams : prompt ? 'https://app.devin.ai/?tags=' + tag + '&' + utm + agentParams + '&prompt=' + encodedPrompt : 'https://app.devin.ai/?' + utm + agentParams;
  const buttonLabel = type === 'schedule' ? 'Schedule in Devin ↗' : type === 'review' ? 'Set Up Devin Review ↗' : agent === 'advanced' ? 'Try in Devin ↗' : agent === 'dana' ? 'Try in Dana ↗' : agent === 'ada' ? 'Try in Ask Devin ↗' : 'Try in Devin ↗';
  const featureList = features ? features.split(',').map(f => f.trim()) : [];
  return <div className="uc-hero">
      <div className="uc-hero-inner">
        <div className="uc-hero-left">
          <h1 className="uc-hero-title">{title}</h1>
          <p className="uc-hero-desc">{description}</p>
          <div>
            <a href={devinHref} target="_blank" rel="noopener noreferrer" className="try-in-devin-btn">
              {buttonLabel}
            </a>
          </div>
        </div>
        <div className="uc-hero-meta">
          <div className="uc-meta-item">
            <span className="uc-meta-label">Author</span>
            <span className="uc-meta-value">Cognition</span>
          </div>
          <div className="uc-meta-item">
            <span className="uc-meta-label">Category</span>
            <span className="uc-meta-value">{category}</span>
          </div>
          {featureList.length > 0 && <div className="uc-meta-item">
              <span className="uc-meta-label">Features</span>
              <span className="uc-meta-value">{featureList.join(', ')}</span>
            </div>}
        </div>
      </div>
    </div>;
};

export const PromptBlock = ({children, type, agent, intent, playbookId}) => {
  var utm = 'utm_source=docs&utm_medium=use-case-gallery&utm_campaign=prompt-block';
  var tag = 'docs-use-case-gallery';
  var agentParams = (agent ? '&agent=' + agent : '') + (intent ? '&intent=' + intent : '') + (playbookId ? '&playbookId=' + playbookId : '');
  var label = type === 'schedule' ? 'Schedule in Devin' : type === 'playbook' ? 'Create Playbook' : type === 'knowledge' ? 'Add to Knowledge' : agent === 'advanced' ? 'Try in Devin' : agent === 'dana' ? 'Try in Dana' : agent === 'ada' ? 'Try in Ask Devin' : 'Try in Devin';
  var buildUrl = function (text) {
    var encoded = encodeURIComponent(text);
    if (type === 'schedule') return 'https://app.devin.ai/settings/schedules/create?' + utm + agentParams + '&prompt=' + encoded;
    if (type === 'playbook') return 'https://app.devin.ai/settings/playbooks/create?' + utm + '&body=' + encoded;
    if (type === 'knowledge') return 'https://app.devin.ai/knowledge?' + utm + '&body=' + encoded;
    if (agent === 'ada') return 'https://app.devin.ai/search?' + utm + '&noSubmit=true&prompt=' + encoded;
    return 'https://app.devin.ai/?tags=' + tag + '&' + utm + agentParams + '&prompt=' + encoded;
  };
  const ref = React.useRef(null);
  const [href, setHref] = React.useState('#');
  React.useEffect(() => {
    if (!ref.current) return;
    var codeEl = ref.current.querySelector('pre code');
    if (codeEl) {
      var text = codeEl.textContent.trim();
      if (text) setHref(buildUrl(text));
    }
    var header = ref.current.querySelector('[data-component-part="code-block-header"]');
    if (header && !header.querySelector('.prompt-block-devin-link')) {
      var link = document.createElement('a');
      link.href = href;
      link.target = '_blank';
      link.rel = 'noopener noreferrer';
      link.className = 'prompt-block-devin-link';
      link.style.cssText = 'display:inline-flex;align-items:center;gap:6px;text-decoration:none;color:#fff;font-size:11px;font-weight:500;padding:4px 10px;border-radius:6px;white-space:nowrap;background:#317CFF;transition:background 0.2s;margin-left:8px;';
      link.innerHTML = '<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"/><polyline points="15 3 21 3 21 9"/><line x1="10" y1="14" x2="21" y2="3"/></svg> ' + label;
      link.onmouseenter = function () {
        link.style.background = '#2968D9';
      };
      link.onmouseleave = function () {
        link.style.background = '#317CFF';
      };
      header.appendChild(link);
    }
    var existingLink = ref.current.querySelector('.prompt-block-devin-link');
    if (existingLink && href !== '#') existingLink.href = href;
  });
  return <div className="prompt-block" ref={ref}>{children}</div>;
};

<UseCaseHero title="Tracciare un flusso di pagamento Stripe end-to-end" description="Usa Ask Devin per mappare tutti i file e le funzioni in un flusso di checkout Stripe, dal pulsante Subscribe al gestore del webhook, prima di scrivere una sola riga di codice." prompt="Ho bisogno di aggiungere la logica di retry al nostro gestore del webhook di pagamento. Prima di iniziare, guidami attraverso l'intero flusso di pagamento — dal pulsante di checkout del frontend, passando per l'API, l'integrazione con Stripe, l'elaborazione del webhook e gli aggiornamenti del database. Elenca tutti i file e le funzioni coinvolti." category="Sviluppo di funzionalità" features="MCP" agent="ada" />

<div className="uc-detail-wrapper">
  <Tip>Non vuoi configurarlo manualmente? Incolla un collegamento a questa pagina in una sessione di Devin e chiedigli di impostare tutto per te.</Tip>

  <Steps>
    <Step title="Chiedi a Devin di tracciare il flusso dei pagamenti">
      Ti è stato assegnato un ticket per aggiungere la logica di retry all'handler del webhook Stripe, ma sei entrato nel team due settimane fa e non ti sei mai occupato di pagamenti prima. Invece di passare un'ora a navigare tra i file sorgente, apri [Ask Devin](https://app.devin.ai/search?utm_source=docs\&utm_medium=use-case-gallery) e chiedigli di tracciare il flusso per te.

      Seleziona **Ask Devin** dalla barra laterale di sinistra, scegli il tuo repo e descrivi il flusso che devi capire:

      <PromptBlock agent="ada">
        ```txt Trace the payment flow theme={null}
        I need to add retry logic to our payment webhook handler. Before I
        start, walk me through how payments work end-to-end:

        1. What happens when a user clicks "Subscribe" on the pricing page?
        2. Which API route handles the request?
        3. How does the Stripe integration work — where are subscriptions created?
        4. How do webhooks get processed and where does the DB get updated?

        For each step, give me the file path, function name, and a one-line
        summary of what it does.
        ```
      </PromptBlock>

      Devin legge la documentazione [DeepWiki](/it/work-with-devin/deepwiki) per il tuo repo, analizza il codice sorgente effettivo e traccia le chiamate di funzione tra i file per costruire un quadro completo. Restituisce una mappa strutturata dell'intero flusso:

      ```
      ## Payment Flow: Subscribe → Database

      1. src/pages/pricing/PricingCard.tsx:45
         handleSubscribe() → POST /api/v2/subscriptions

      2. src/api/v2/subscriptions/create.ts:12
         Validates input, checks eligibility → calls SubscriptionService.create()

      3. src/services/SubscriptionService.ts:89
         Creates Stripe subscription via stripe.subscriptions.create()
         Stores pending record with status="pending"

      4. src/webhooks/stripe.ts:34
         Receives invoice.payment_succeeded → calls SubscriptionService.activate()
         ⚠ Nessuna logica di retry qui — è qui che apporterai le modifiche

      5. src/services/SubscriptionService.ts:134
         Updates status to "active", creates invoice record, emits event
      ```

      In meno di un minuto ottieni una mappa, a livello di file, della pipeline di pagamento: cinque file, i nomi esatti delle funzioni e il punto preciso in cui inserire la tua modifica.
    </Step>

    <Step title="Approfondisci il gestore del webhook con domande di approfondimento">
      Ask Devin è conversazionale: puoi fare tutte le domande di approfondimento di cui hai bisogno. Ora che puoi vedere la pipeline, analizza nel dettaglio l'area che andrai a modificare:

      <PromptBlock agent="ada">
        ```txt Trova i pattern di gestione degli errori theme={null}
        Mostrami come gli altri gestori di webhook in questo codebase gestiscono gli errori.
        Esistono meccanismi di retry o dead letter queue che dovrei
        riutilizzare? Controlla src/webhooks/ e qualsiasi middleware condiviso.
        ```
      </PromptBlock>

      <PromptBlock agent="ada">
        ```txt Verifica i caller correlati theme={null}
        Trova tutti i punti in cui viene chiamato SubscriptionService: voglio assicurarmi
        che la mia logica di retry non crei problemi ad altri chiamanti. Controlla anche se esiste un
        wrapper StripeClient condiviso con supporto di retry integrato.
        ```
      </PromptBlock>

      Continua a fare domande di approfondimento finché non hai un quadro completo. Ask Devin mantiene il contesto dell'intera conversazione, quindi ogni domanda si basa sulle risposte precedenti. Puoi anche chiedere a Devin di delineare il tuo approccio di implementazione.
    </Step>

    <Step title="Avvia una sessione di programmazione direttamente da Ask Devin">
      Ora conosci esattamente il file da modificare (`src/webhooks/stripe.ts`), la utility di retry esistente da riutilizzare (`src/lib/retry.ts`) e la dead letter queue a cui già inviano gli altri handler (`src/queues/dlq.ts`).

      Premi **⌥ Option + Invio** (oppure fai clic sull'icona a freccia) per avviare una sessione di Devin direttamente dalla conversazione Ask Devin. Devin mantiene tutto ciò che ha appreso — la mappa dei file, i pattern di gestione degli errori, la utility di retry — così salta la fase di analisi e passa direttamente all'implementazione. **Lo stato della sessione sarà visibile direttamente nella tua conversazione Ask Devin**, così puoi monitorare i progressi senza cambiare contesto.

      Puoi anche digitare un prompt di implementazione specifico prima di premere ⌥ Invio per indirizzare ciò che Devin costruisce:

      <PromptBlock>
        ```txt Implement with full context theme={null}
        Add exponential backoff retry logic to the Stripe webhook handler at
        src/webhooks/stripe.ts. Reuse the existing RetryPolicy class from
        src/lib/retry.ts that other webhook handlers already use.

        If webhook processing fails, retry up to 3 times with backoff
        (1s, 4s, 16s). After all retries are exhausted, push the event to
        the existing SQS dead letter queue at src/queues/dlq.ts.

        Add tests covering the retry and DLQ scenarios.
        ```
      </PromptBlock>

      Poiché la sessione eredita il contesto dalla tua conversazione Ask, Devin produce una PR più accurata con meno iterazioni. Questo flusso di lavoro Ask-to-Agent è il modo più rapido per passare da "non conosco questa codebase" a "ecco una PR." Scopri di più nella [guida Ask Devin](/it/work-with-devin/ask-devin).
    </Step>
  </Steps>
</div>
