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

# getPaymentStatus

> Check the status of a payment transaction

export const Button = ({children, disabled, variant = "primary", size = "medium", iconName, roundedFull = false, className = '', fullWidth = false, onClick = undefined}) => {
  const variantStyles = {
    primary: 'bg-blue text-black border border-blue hover:bg-blue-80 active:bg-[#06318E] dark:text-white',
    secondary: 'bg-white border border-white text-palette-foreground hover:bg-zinc-15 active:bg-zinc-30',
    outlined: 'bg-transparent text-white border border-white hover:bg-white hover:text-black active:bg-[#E3E7E9]'
  };
  const sizeStyles = {
    medium: 'text-md px-4 py-2 gap-3',
    large: 'text-lg px-6 py-4 gap-5'
  };
  const sizeIconRatio = {
    medium: '0.75rem',
    large: '1rem'
  };
  const classes = ['text-md px-4 py-2 whitespace-nowrap', 'flex items-center justify-center', 'disabled:opacity-40 disabled:pointer-events-none', 'transition-all', variantStyles[variant], sizeStyles[size], roundedFull ? 'rounded-full' : 'rounded-lg', fullWidth ? 'w-full' : 'w-auto', className];
  const buttonClasses = classes.filter(Boolean).join(' ');
  const iconSize = sizeIconRatio[size];
  return <button type="button" disabled={disabled} className={buttonClasses} onClick={onClick}>
      <span>{children}</span>
      {iconName && <Icon name={iconName} width={iconSize} height={iconSize} color="currentColor" />}
    </button>;
};

export const BaseBanner = ({content = null, id, dismissable = true}) => {
  const LOCAL_STORAGE_KEY_PREFIX = 'cb-docs-banner';
  const [isVisible, setIsVisible] = useState(false);
  const onDismiss = () => {
    localStorage.setItem(`${LOCAL_STORAGE_KEY_PREFIX}-${id}`, 'false');
    setIsVisible(false);
  };
  useEffect(() => {
    const storedValue = localStorage.getItem(`${LOCAL_STORAGE_KEY_PREFIX}-${id}`);
    setIsVisible(storedValue !== 'false');
  }, []);
  if (!isVisible) {
    return null;
  }
  return <div className="fixed bottom-0 left-0 right-0 bg-white py-8 px-4 lg:px-12 z-50 text-black dark:bg-black dark:text-white border-t dark:border-gray-95">
      <div className="flex items-center max-w-8xl mx-auto">
        {typeof content === 'function' ? content({
    onDismiss
  }) : content}
        {dismissable && <button onClick={onDismiss} className="flex-shrink-0 text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 transition-colors" aria-label="Dismiss banner">
          ✕
        </button>}
      </div>
    </div>;
};

Defined in the [Base Account SDK](https://github.com/base/account-sdk)

<Info>
  The `getPaymentStatus` function allows you to check the status of a payment transaction after it has been submitted. Use this to track whether a payment has been completed, is still pending, or has failed.

  **Try it out:** Test the `getPaymentStatus` function interactively in our [Base Pay SDK Playground](https://base.github.io/account-sdk/pay-playground).
</Info>

## Parameters

<ParamField body="id" type="string" required>
  Transaction hash from the pay result that you want to check the status of.

  **Pattern:** `^0x[0-9a-fA-F]{64}$`
</ParamField>

<ParamField body="testnet" type="boolean">
  Must match the testnet setting used in the original pay call. Default: false
</ParamField>

## Returns

<ResponseField name="result" type="PaymentStatus">
  Payment status information including current state and details.

  <Expandable title="PaymentStatus properties">
    <ResponseField name="status" type="string">
      Current status of the payment.

      **Possible values:**

      * `"completed"`: Payment successfully processed and confirmed
      * `"pending"`: Payment still being processed by the network
      * `"failed"`: Payment failed to process (funds not transferred)
      * `"not_found"`: Transaction ID not found or invalid
    </ResponseField>

    <ResponseField name="id" type="string">
      Original transaction hash that was queried.
    </ResponseField>

    <ResponseField name="message" type="string">
      Human-readable status message explaining the current state.
    </ResponseField>

    <ResponseField name="sender" type="string">
      Sender address (present for pending, completed, and failed statuses).
    </ResponseField>

    <ResponseField name="amount" type="string">
      Amount that was sent (present for completed transactions).
    </ResponseField>

    <ResponseField name="recipient" type="string">
      Address that received the payment (present for completed transactions).
    </ResponseField>

    <ResponseField name="error" type="string">
      Error details (present for failed status).
    </ResponseField>
  </Expandable>
</ResponseField>

<RequestExample>
  ```typescript Basic Status Check theme={null}
  import { getPaymentStatus } from '@base-org/account';

  const status = await getPaymentStatus({
    id: "0xabcd1234...",
    testnet: false
  });

  console.log("Payment status:", status.status);
  ```

  ```typescript Complete Payment Flow theme={null}
  import { pay, getPaymentStatus } from '@base-org/account';

  try {
    // Send payment
    const payment = await pay({
      amount: "10.50",
      to: "0x1234567890123456789012345678901234567890"
    });
  } catch (error) {
    console.error(`Payment failed: ${error.message}`);
  }

  try {
    // Check status
    const status = await getPaymentStatus({
      id: payment.id,
      testnet: false
    });
    
    console.log("Status:", status.status);
    catch (error) {
    console.error(`Get status Failed: ${error.message}`);
  }
  ```
</RequestExample>

<ResponseExample>
  ```typescript Completed Payment theme={null}
  {
    status: "completed",
    id: "0xabcd1234...",
    message: "Payment completed successfully",
    sender: "0x742d35Cc4Bf53E0e6C42E5d9F0A8D2F6D8A8B7C9",
    amount: "10.50",
    recipient: "0x1234567890123456789012345678901234567890"
  }
  ```

  ```typescript Pending Payment theme={null}
  {
    status: "pending",
    id: "0xabcd1234...",
    message: "Payment is being processed",
    sender: "0x742d35Cc4Bf53E0e6C42E5d9F0A8D2F6D8A8B7C9"
  }
  ```

  ```typescript Failed Payment theme={null}
  {
    status: "failed",
    id: "0xabcd1234...",
    message: "Payment failed due to insufficient balance",
    sender: "0x742d35Cc4Bf53E0e6C42E5d9F0A8D2F6D8A8B7C9",
    error: "Insufficient balance"
  }
  ```

  ```typescript Transaction Not Found theme={null}
  {
    status: "not_found",
    id: "0xabcd1234...",
    message: "Transaction not found"
  }
  ```
</ResponseExample>

## Error Handling

The `getPaymentStatus` function can throw errors for:

* Invalid transaction ID format
* Network connection issues
* Transaction not found

Always wrap calls to `getPaymentStatus` in a try-catch block to handle these errors gracefully.

<BaseBanner
  id="privacy-policy"
  dismissable={false}
  content={({ onDismiss }) => (
<div className="flex items-center">
  <div className="mr-2">
    We're updating the Base Privacy Policy, effective July 25, 2025, to reflect an expansion of Base services. Please review the updated policy here:{" "}
    <a
      href="https://docs.base.org/privacy-policy-2025"
      target="_blank"
      className="whitespace-nowrap"
    >
      Base Privacy Policy
    </a>. By continuing to use Base services, you confirm that you have read and understand the updated policy.
  </div>
  <Button onClick={onDismiss}>I Acknowledge</Button>
</div>
)}
/>
