square/connect-php-sdk

User deprecated function: ?[33mCalling deprecated API:

TonyTheFerg opened this issue · 3 comments

I am brand new to the square module for drupal commerce, and i am getting the following php debug message with both charges and refunds and was looking for some pointers on finding the source of the problem. These are the full errors:

User deprecated function: �[33mCalling deprecated API: TransactionsApi.charge�[0m in SquareConnect\Api\TransactionsApi->charge() (line 191 of /*/*/*/code/sites/all/libraries/square/lib/Api/TransactionsApi.php).

User deprecated function: �[33mCalling deprecated API: TransactionsApi.createRefund�[0m in SquareConnect\Api\TransactionsApi->createRefund() (line 300 of /*/*/*/code/sites/all/libraries/square/lib/Api/TransactionsApi.php).

Transactions API is deprecated, so it's letting you know. If you wish to suppress these errors, then you'll need to add the following line to your code (before you call Transactions API), I believe:

error_reporting(E_ALL & ~E_USER_DEPRECATED);

@StephenJosey thanks. So that means those messages don't indicate that anything is wrong in the installation then? Also, Is this latest release library what I should be using then?

Correct - it's just letting you know the API is deprecated. Transactions API has been replaced with the Payments API, so eventually, it would no longer work (I think the date is September 1st, 2021 so you still have awhile). So, yes, this is the latest SDK release, but there's just a different API (Payments API) that you should be moving to. This SDK has both built in; Payments API can be seen here https://github.com/square/connect-php-sdk/blob/master/docs/Api/PaymentsApi.md