> ## Documentation Index
> Fetch the complete documentation index at: https://razorpay-881012b3.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Create Async Payment

> Create Async Payments for Custom Web Integration.

<div style={{display:"flex",flexWrap:"wrap",alignItems:"center",gap:"0.35rem 0.9rem",border:"1px solid rgba(128,128,128,0.28)",borderRadius:"0.5rem",padding:"0.45rem 0.75rem",margin:"0 0 1.25rem",fontSize:"0.875rem"}}>
  <span style={{fontWeight:600}}>Available in</span>
  <span>🇮🇳 India</span>
</div>

The `createPayment` method must be called synchronously within user-initiated action. Hence, this method doesn't work if the pop-up blocker is enabled. You can decouple pop-up opening and payment creation if you need to perform any asynchronous operation such as sending an AJAX request before starting payment. Check the code below:

```javascript theme={null}
rp.createPayment(data, {
   paused: true,
   message: 'Confirming order..'
});
```

After you make AJAX requests, emit resume or cancel the event using this code:

```javascript theme={null}
if(ajax_success) {
  rp.emit('payment.resume');
} else {
  rp.emit('payment.cancel');
}
```

## Format of Data Object and Success/Error Handlers

`payment.resume`
: Event initiates the usual payment process and emits `payment.success`
or `payment.error` events according to the payment result.

`payment.cancel`
: Razorpay will not initiate the payment.
