# Payment API — Progressive Web Apps

Source: https://www.geekswithgeeks.com/hi/pwa/pwa-payment-api

> Web Payment API का उपयोग करके secure payment collection को implement करें।

## Payment Processing

**Payment Request API** browsers में payment collection को standardize करता है। यह credit cards, digital wallets और अन्य payment methods को user authentication के साथ support करता है।

## User से payment request करें

Payment को securely collect करने के लिए Payment Request API का उपयोग करें।

```javascript
const paymentMethods = [{ supportedMethods: 'basic-card' }];
const paymentDetails = {
  total: { label: 'Total', amount: { currency: 'USD', value: '9.99' } }
};

const pr = new PaymentRequest(paymentMethods, paymentDetails);
pr.show()
  .then(response => {
    console.log('Payment successful:', response);
    response.complete('success');
  })
  .catch(err => console.error('Payment failed:', err));
```

Output:

```
Secure payment collection via system-integrated payment interface.
```

## Payment Request Best Practices

Security maintain करते हुए payment flow को conversion के लिए optimize करें।
