{"action":"opened","issue":{"url":"https://api.github.com/repos/paypal/PayPal-PHP-SDK/issues/701","repository_url":"https://api.github.com/repos/paypal/PayPal-PHP-SDK","labels_url":"https://api.github.com/repos/paypal/PayPal-PHP-SDK/issues/701/labels{/name}","comments_url":"https://api.github.com/repos/paypal/PayPal-PHP-SDK/issues/701/comments","events_url":"https://api.github.com/repos/paypal/PayPal-PHP-SDK/issues/701/events","html_url":"https://github.com/paypal/PayPal-PHP-SDK/issues/701","id":185309198,"number":701,"title":"[Sandbox]Got Http response code 500 when accessing https://api.sandbox.paypal.com/v1/payments/payment.","user":{"login":"yopop666","id":5624862,"avatar_url":"https://avatars.githubusercontent.com/u/5624862?v=3","gravatar_id":"","url":"https://api.github.com/users/yopop666","html_url":"https://github.com/yopop666","followers_url":"https://api.github.com/users/yopop666/followers","following_url":"https://api.github.com/users/yopop666/following{/other_user}","gists_url":"https://api.github.com/users/yopop666/gists{/gist_id}","starred_url":"https://api.github.com/users/yopop666/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yopop666/subscriptions","organizations_url":"https://api.github.com/users/yopop666/orgs","repos_url":"https://api.github.com/users/yopop666/repos","events_url":"https://api.github.com/users/yopop666/events{/privacy}","received_events_url":"https://api.github.com/users/yopop666/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-10-26T06:40:44Z","updated_at":"2016-10-26T06:40:44Z","closed_at":null,"body":"Hi,\r\n\r\nMy configuration details:\r\n\tPHP 5.6.20 (cli) (built: Mar 31 2016 07:17:10)\r\n\tPayPalSDK/PayPal-PHP-SDK 1.8.0 (platform-ver=5.6.20; \r\n\tbit=64;\r\n\tos=Linux_3.10.0-327.4.4.el7.x86_64;\r\n\tmachine=x86_64;\r\n\tcrypto-lib-ver=1.0.1e-fips;\r\n\tcurl=7.29.0\r\n\r\nI want to use vault and make payment with card, I use sdk sample,\r\n```\r\npublic function getOauthToken() {\r\n        $client = '<client_key>';\r\n        $secret = '<secret_key>';\r\n        $sdkConfig = array(\r\n            \"mode\" => \"sandbox\"\r\n        );\r\n\r\n        $token = new OAuthTokenCredential($client, $secret,$sdkConfig);\r\n        return  $token;\r\n\r\n    }\r\n\r\n    public function getApiContext() {\r\n        $credential = $this->getOauthToken();\r\n        $apiContext = new ApiContext($credential);\r\n        return $apiContext;\r\n    }\r\n\r\n    public function createCard() {\r\n        ///////////////////\r\n        // ### CreditCard\r\n        // A resource representing a credit card that is \r\n        // to be stored with PayPal.\r\n        $card = new CreditCard();\r\n        $card->setType(\"visa\")\r\n            // ->setNumber(\"4917912523797702\") // work well (from paypal sample)\r\n            // ->setNumber(\"4012888888881881\") // work well (from paypal test cards)\r\n            ->setNumber(\"4111111111111111\") // didnt work (from paypal test cards)\r\n            // ->setNumber(\"4222222222222\")    // didnt work (from paypal test cards)\r\n            ->setExpireMonth(\"12\")\r\n            ->setExpireYear(\"2016\")\r\n            ->setCvv2(\"123\")\r\n            ->setFirstName(\"asdf\")\r\n            ->setLastName(\"afsd\");\r\n        // ### Additional Information\r\n        // Now you can also store the information that could help you connect\r\n        // your users with the stored credit cards.\r\n        // All these three fields could be used for storing any information that could help merchant to point the card.\r\n        // However, Ideally, MerchantId could be used to categorize stores, apps, websites, etc.\r\n        // ExternalCardId could be used for uniquely identifying the card per MerchantId. So, combination of \"MerchantId\" and \"ExternalCardId\" should be unique.\r\n        // ExternalCustomerId could be userId, user email, etc to group multiple cards per user.\r\n\r\n        $card->setMerchantId(\"MyStore1\");\r\n        $card->setExternalCardId(\"CardNumber123\" . uniqid());\r\n        $card->setExternalCustomerId(\"123123-myUser1@something.com\");\r\n\r\n\r\n        // For Sample Purposes Only.\r\n        $request = clone $card;\r\n        // ### Save card\r\n        // Creates the credit card as a resource\r\n        // in the PayPal vault. The response contains\r\n        // an 'id' that you can use to refer to it\r\n        // in future payments.\r\n        // (See bootstrap.php for more on `ApiContext`)\r\n        $apiContext = $this->getApiContext();\r\n\r\n        try {\r\n            $card->create($apiContext);\r\n        } catch (Exception $ex) {\r\n            // NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY\r\n            // ResultPrinter::printError(\"Create Credit Card\", \"Credit Card\", null, $request, $ex);\r\n            var_dump($request, $ex);\r\n            die;\r\n            exit(1);\r\n        }\r\n        // NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY\r\n         // ResultPrinter::printResult(\"Create Credit Card\", \"Credit Card\", $card->getId(), $request, $card);\r\n            return $card->getId();\r\n        ///////////////////\r\n    }\r\n\r\n    public function makePayment($creditCardId) {\r\n        $creditCardToken = new CreditCardToken();\r\n        $creditCardToken->setCreditCardId($creditCardId);\r\n\r\n        $fundingInstrument = new FundingInstrument();\r\n        $fundingInstrument->setCreditCardToken($creditCardToken);\r\n\r\n        $payer = new Payer();\r\n        $payer->setPaymentMethod(\"credit_card\");\r\n        $payer->setFundingInstruments(array($fundingInstrument));\r\n// new\r\n        $item1 = new Item();\r\n        $item1->setName('Ground Coffee 40 oz')\r\n            ->setCurrency('USD')\r\n            ->setQuantity(1)\r\n            ->setPrice(7.5);\r\n        $item2 = new Item();\r\n        $item2->setName('Granola bars')\r\n            ->setCurrency('USD')\r\n            ->setQuantity(5)\r\n            ->setPrice(2);\r\n\r\n        $itemList = new ItemList();\r\n        $itemList->setItems(array($item1, $item2));\r\n\r\n        $details = new Details();\r\n        $details->setShipping(1.2)\r\n            ->setTax(1.3)\r\n            ->setSubtotal(17.5);\r\n\r\n        $amount = new Amount();\r\n        $amount->setCurrency(\"USD\")\r\n            ->setTotal(20)\r\n            ->setDetails($details);\r\n\r\n        $transaction = new Transaction();\r\n        $transaction->setAmount($amount)\r\n            ->setItemList($itemList)\r\n            ->setDescription(\"Payment description\")\r\n            ->setInvoiceNumber(uniqid());\r\n\r\n        $payment = new Payment();\r\n        $payment->setIntent(\"sale\")\r\n            ->setPayer($payer)\r\n            ->setTransactions(array($transaction));\r\n// new\r\n\r\n        $apiContext = $this->getApiContext();\r\n        $request = clone $payment;\r\n        $paymentResult = $payment->create($apiContext);\r\n        dd($paymentResult);\r\n    }\r\n\r\n    public function mainAction(Request $request) {\r\n        $creditCardId = $this->createCard();\r\n        $this->makePayment($creditCardId);\r\n    }\r\n```\r\n\r\nI can't get debug id, only detail about transaction failed is:\r\n    PayPal-Request-Id = 13808355661757314774631741372 \r\n\r\nI have 4 Visa test cards:\r\n**4917912523797702** // work well (from paypal sample)\r\n**4012888888881881** // work well (from paypal test)\r\n**4111111111111111** // didnt work (from paypal test)\r\n**4222222222222**  // didnt work (from paypal test)\r\n from them only 2 works fine.\r\n\r\nThe error is trowed from https://github.com/paypal/PayPal-PHP-SDK/blob/master/lib/PayPal/Core/PayPalHttpConnection.php#L183"}}
{"actor":{"display_login":"yopop666"}}