Responses Received From Provider

### `vtupress_api_response`

Intercept and modify API responses before they are returned to the user frontend.

**Before:**

```json

{

  "status": "success",

  "message": "Transaction Successful",

  "balance": 500

}

```

**Hook Example:**

```php

add_filter('vtupress_api_response', function($json_response, $endpoint) {

    $response = json_decode($json_response, true);

    if (isset($response['status']) && $response['status'] == 'success') {

        $response['promotion'] = "You earned 10 points!";

    }

    return json_encode($response);

}, 10, 2);

```

**After:**

```json

{

  "status": "success",

  "message": "Transaction Successful",

  "balance": 500,

  "promotion": "You earned 10 points!"

}

```
Was this page helpful?