square / connect-php-sdk

PHP client library for the Square Connect APIs
https://developer.squareup.com/docs
Apache License 2.0
114 stars 55 forks source link

User deprecated function: ?[33mCalling deprecated API: #115

Closed TonyTheFerg closed 4 years ago

TonyTheFerg commented 4 years ago

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: Calling deprecated API: TransactionsApi.charge in SquareConnect\Api\TransactionsApi->charge() (line 191 of /*/*/*/code/sites/all/libraries/square/lib/Api/TransactionsApi.php).

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

StephenJosey commented 4 years ago

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);
TonyTheFerg commented 4 years ago

@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?

StephenJosey commented 4 years ago

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