robmcvey / cakephp-paypal

CakePHP 2.0 plugin for PayPal Website Payment Pro
60 stars 44 forks source link

suspected error function/update suggestion: storeCreditCard() #18

Closed AndanteC closed 10 years ago

AndanteC commented 10 years ago

Hi,

Just find out function storeCreditCard() isn't working with my test application:

  1. The settings should be fine, but always returns an error message: "There was an problem communicating with the payment gateway"
  2. so I look back into your script and simply hide section if ($response->code == 200) code to test what the response was like:
 \app\Controller\ApiController.php (line 120)

array(
    'id' => 'CARD-7SF881509H6907000KO726SY',
    'state' => 'ok',
    'payer_id' => '186',
    'type' => 'visa',
    'number' => 'xxxxxxxxxxxx5242',
    'expire_month' => '7',
    'expire_year' => '2019',
    'first_name' => 'Joe',
    'last_name' => 'Shopper',
    'valid_until' => '2017-07-10T00:00:00Z',
    'create_time' => '2014-07-11T09:32:59Z',
    'update_time' => '2014-07-11T09:32:59Z',
    'links' => array(
        (int) 0 => array(
            'href' => 'https://api.sandbox.paypal.com/v1/vault/credit-card/CARD-7SF881509H6907000KO726SY',
            'rel' => 'self',
            'method' => 'GET'
        ),
        (int) 1 => array(
            'href' => 'https://api.sandbox.paypal.com/v1/vault/credit-card/CARD-7SF881509H6907000KO726SY',
            'rel' => 'delete',
            'method' => 'DELETE'
        ),
        (int) 2 => array(
            'href' => 'https://api.sandbox.paypal.com/v1/vault/credit-card/CARD-7SF881509H6907000KO726SY',
            'rel' => 'patch',
            'method' => 'PATCH'
        )
    )
)

*seems like there is no such field called "code" in the response JSON.

robmcvey commented 10 years ago

Hi Adante,

The $response variable from HttpSocket is actually an object, and does not contain code (code is the HTTP status code from PayPal's server).

It looks like you're debugging $responseArray.

If you're not getting a 200 response, there IS an issue connecting to PayPal - try debugging $response to see why. We've had a few 500 Internal Server Errors recently when using their sandbox :frowning:

robmcvey commented 10 years ago

Did you establish if this was just an issue with sandbox.paypal.com?