TomorrowIdeas / plaid-sdk-php

PHP bindings for the Plaid API
MIT License
111 stars 42 forks source link

local.ERROR: Bad Request (on Reports createAssetReport) #52

Closed jayomayan closed 2 years ago

jayomayan commented 2 years ago

Hi I'm not sure what I'm doing wrong but I'm getting Bad Request.

local.ERROR: Bad Request {"userId":2,"exception":"[object] (TomorrowIdeas\\Plaid\\PlaidRequestException(code: 400): Bad Request at /Users/jayomayan/GitHub/plaidlogic/vendor/tomorrow-ideas/plaid-sdk-php/src/Resources/AbstractResource.php:114)

This is my config an parameters.

**This is for $options variable**
array (
  'client_report_id' => 'UserID:2',
  'webhook' => 'https://www.example.com',
  'user' => 
  array (
    'client_user_id' => 'Omayan19',
    'first_name' => 'Joe',
    'last_name' => 'Omayan',
    'ssn' => '000-00-0000',
    'phone_number' => '(818) 388-9999',
    'email' => 'notmyemail@gmail.com',
  ),
)  

    public function create_asset_report($access_tokens, $days_requested, $options)
    {
        $plaid = new Plaid(
            \getenv("PLAID_CLIENT_ID"),
            \getenv("PLAID_CLIENT_SECRET"),
            \getenv("PLAID_ENVIRONMENT")
        );

        $asset_report_token = $plaid->reports->createAssetReport([$access_tokens], 30, $options);

        return $asset_report_token;

    }

Any help would be greatly appreciated.

jayomayan commented 2 years ago

Tried to get the exception but it seems like nothing is showing..

       try {
            $asset_report_token = $plaid->reports->createAssetReport([$access_tokens], $days_requested, $options);
        } catch ( PlaidRequestException $exception) {
          \dd($exception->getResponse());
        }
jayomayan commented 2 years ago

Nevermind.. my bad... there was a white space on my SECRET