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

# Payment Methods

> Fetch enabled payment methods and bank details for checkout

## `shop.getPaymentMethods()`

Returns the payment methods enabled by the shop owner, plus bank transfer details if applicable. Use this to render the checkout payment step.

```typescript theme={null}
const { payment_methods, bank_details } = await shop.getPaymentMethods();
```

### Response

```typescript theme={null}
{
  payment_methods: Array<{
    method_id: string;
    method_name: string;
    enabled: boolean;
  }>;
  bank_details: Array<{
    bank_name: string;
    branch_name: string | null;
    account_number: string;
    account_holder_name: string;
  }>;
}
```

Only enabled payment methods are returned. `bank_details` is populated when the shop has bank transfer enabled.

### Example — Render payment options

```typescript theme={null}
const { payment_methods, bank_details } = await shop.getPaymentMethods();

// Render payment method radio buttons
payment_methods.forEach(method => {
  const option = document.createElement('label');
  option.innerHTML = `
    <input type="radio" name="payment" value="${method.method_id}" />
    ${method.method_name}
  `;
  paymentForm.appendChild(option);
});

// Show bank details if bank transfer is selected
const hasBankTransfer = payment_methods.some(m => m.method_id === 'bank_transfer');
if (hasBankTransfer && bank_details.length > 0) {
  const bank = bank_details[0];
  bankInfo.textContent = `
    ${bank.bank_name} — ${bank.account_number}
    Account holder: ${bank.account_holder_name}
  `;
}
```
