retailcrm / api-client-php

PHP client for RetailCRM API
http://www.retailcrm.ru
MIT License
60 stars 58 forks source link

ordersPaymentEdit() always return error 403 #44

Closed XOlegator closed 7 years ago

XOlegator commented 7 years ago

I try to change status of existed payment by method ordersPaymentEdit(), but can't do it (error "Forbidden"). Example code and returned message see there - https://gist.github.com/XOlegator/5dfb60d46a4d487597d313f56cbd2697 Before that I successfully uploaded orders with payments by method ordersUpload(). Ids in example are proper. If I try to add payment by method ordersPaymentCreate() to order where was no payments, I have the same error.

muxx commented 7 years ago

It meens that your api key don't have permissions for payment methods. You should add permissions, that's all.

XOlegator commented 7 years ago

This error was gone away, thanks! But I still can't update my payment :-( This data I get from RetailCRM:

Array
(
    [id] => 112
    [status] => paid
    [type] => bank-card
    [externalId] => p37
    [amount] => 12500
    [paidAt] => 2017-07-17 21:41:33
) 

This I want to send (by externalId):

Array
(
    [externalId] => p37
    [amount] => 12500.00
    [status] => not-paid
    [id] => 112
    [type] => bank-card
)

It return error:

(
    [statusCode:protected] => 400
    [response:protected] => Array
        (
            [success] => 
            [errorMsg] => Errors in the entity format
            [errors] => Array
                (
                    [externalId] => This external id is already set for another payment
                )
        )
)
muxx commented 7 years ago

And what did you not understand? This error means that you used this externalId for payment in some order (this or other)