---
page_source: https://docs.juspay.io/payout-sea/docs/resources/weblabs
page_title: Weblabs
---


# Weblabs



Payouts can fail at the payment gateway in case of insufficient funds in your merchant account. Juspay provides merchants a way to pause transactions from being sent to the downstream gateway and resume sending the transactions only when the fund account is topped up.

Merchants can set weblab using Juspay dashboard via Payout Management → Gateways → Weblabs


### Step 1 Weblab Structure


Weblab accepts JSON as input which should have at least one JS condition. When this condition is satisfied weblab can alter attempt of transactions to the payment gateways.



#### Code Snippets: -

#### JSON Code Snippet:

```json
//Sample structure of weblab
{
"case1": {
  "c": "JS Condition here",
  "r": {
    "ATTEMPT": 0
  }
},
"case2": {
  "c": "JS condition here",
  "r": {
    "ATTEMPT": 0
  }
}
}

```



### Example 1 Pause transaction attempt on low balance


Provide balance threshold below which transactions should get paused and not sent to the downstream gateway.

This weblab will pause transaction when balance falls below 500,000 for YESNODAL_UPI, YESBANK (all rails), and CFGEN_IMPS (with gateway reference id as ABC) gateways.



#### Code Snippets: -

#### JSON Code Snippet:

```json
{"success":false,"message":"No Data found for the given path"}
```



### Exmaple 2 Pause transaction attempt for specific time period


During scheduled downtimes for underlying payment gateways, merchants can provide a weblab to pause transactions.This weblab will pause transaction in between the time specified for YESBANK_UPI gateway. Please note the time to be specified is in UTC



## Sample Code Snippets:
### Weblab:

#### Sample Structure Code Snippet:

```sample structure
//Sample structure of weblab
{
"case1": {
  "c": "JS Condition here",
  "r": {
    "ATTEMPT": 0
  }
},
"case2": {
  "c": "JS condition here",
  "r": {
    "ATTEMPT": 0
  }
}
}

```

#### Example 1 Code Snippet:

```example 1
//pause merchant transactions when balance falls below 500,000 for selected gateways
{
  "pauseMerchant": {
    "c": "((balance <= 500000) && ((currentGateway.indexOf('YESBANK') >= 0) || (currentGateway.indexOf('YESNODAL_UPI') >= 0) || (currentGateway.indexOf('CFGEN_IMPS.ABC') >= 0))",
    "r": {
      "ATTEMPT": 0
    }
  },
}

```

#### Example 2 Code Snippet:

```example 2
//pause merchant transactions for specified time period
{
"pauseMerchant": {
"c": "(currentGateway.indexOf('YESBANK_UPI')>=0  && (new Date('2023-07-08T20:30:00Z')< new Date() && new Date()<new Date('2023-07-08T23:30:00Z'))",
"r": {
  "ATTEMPT": 0
  }
},
}

```

