globalpayments / php-sdk

GNU General Public License v2.0
49 stars 66 forks source link

Global payments showing error as Unexpected HTTP status code 404 #59

Closed anburaja-2020 closed 2 years ago

anburaja-2020 commented 4 years ago

I am using the global payments PHP SDK for API integration. and previously it worked well But for few days It does not work for both sandbox and live credentials. It shows the below error "Unexpected HTTP status code [ 404 ]". I followed the documentation in the GitHub link and did accordingly. Sample code what I used require_once('vendor/autoload.php');

use GlobalPayments\Api\ServicesConfig; use GlobalPayments\Api\ServicesContainer; use GlobalPayments\Api\Entities\Exceptions\ApiException; use GlobalPayments\Api\PaymentMethods\CreditCardData;

$config = new ServicesConfig(); $config->merchantId = ""; $config->accountId = ""; $config->sharedSecret = ""; $config->serviceUrl = "https://api.sandbox.realexpayments.com/epage-remote.cgi"; ServicesContainer::configure($config);

// create the card object $card = new CreditCardData(); $card->number = "4263970000005262"; $card->expMonth = 12; $card->expYear = 2025; $card->cvn = "131"; $card->cardHolderName = "James Mason";

try { // process an auto-capture authorization $response = $card->charge(19.99) ->withCurrency("EUR") ->execute();

} catch (ApiException $e) { echo $e->getMessage(); }

Could you please help me to fix the issue

seanthepottingshed commented 4 years ago

Has the API been updated as none of my code works either

ahumulescu commented 4 years ago

Hello!

In v2.1.0 we changed the SDK's gateway configuration handling. In a nutshell, the change is that each gateway now has a named serviceConfig instead of all of the gateways working from the same class/obj. All the documentation was updated accordingly on the Global Payments Developer Hub.