sumup / sumup-ecom-php-sdk

SumUp eCom PHP SDK
Other
41 stars 18 forks source link

SDK not working on shared hosting #23

Closed codebeginer closed 2 years ago

codebeginer commented 3 years ago

I am facing this weird issue. I tried the sdk on local system, where it is working fine. When I move the code to live server, it stopped working. The live server not getting the response from api.sumup.com.

Is their any criteria that sumup server blocks the domain from accessing it or it might have any other issue. I checked the error logs and do not find any error in requesting the api.

<?php 
require_once('vendor/autoload.php');
try {
    $sumup = new \SumUp\SumUp([
        'app_id'     => 'xxxxx',
        'app_secret' => 'xxxx',
        'grant_type' => 'client_credentials',
        'scopes'      => ['payments']
    ]);
    $checkoutService = $sumup->getCheckoutService();
    $checkoutResponse = $checkoutService->create(1,'USD', 'ASDASDSAD', 'merchant@example.com');
    $checkoutId = $checkoutResponse->getBody()->id;

    echo $checkoutId;die;
//  pass the $chekoutId to the front-end to be processed
} catch (\SumUp\Exceptions\SumUpAuthenticationException $e) {
    echo 'Authentication error: ' . $e->getMessage();
} catch (\SumUp\Exceptions\SumUpResponseException $e) {
    echo 'Response error: ' . $e->getMessage();
} catch(\SumUp\Exceptions\SumUpSDKException $e) {
    echo 'SumUp SDK error: ' . $e->getMessage();
}
ptrovatelli commented 2 years ago

it may be complicated to get all logs from a shared hosting platform. have you tried adding this at the begining of the file to help troubleshoot?

error_reporting(-1);
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
joelrose commented 2 years ago

Hi, If you are still experiencing the same problem, please open a new issue!