sumup / sumup-ecom-php-sdk

SumUp eCom PHP SDK
Other
42 stars 19 forks source link

Response error: request_not_allowed. Error 403 on Payment #31

Open fokkerprop opened 2 years ago

fokkerprop commented 2 years ago

Hi

I am trying to use the payments widget in a test environment initially but am having a 403 error when trying to create a checkout. I have previously had an email indicating that the payment scope was active when I was using the woocommerce interface.

My code is

try{
    $sumup = new \SumUp\SumUp([
        'app_id'     => get_option('cws_sumup_key'),
        'app_secret' => get_option('cws_sumup_secret_key'),
        'grant_type' => 'client_credentials',
        'scopes'      => ['payments', 'transactions.history', 'user.app-settings', 'user.profile_readonly']
    ]);
    $accessToken = $sumup->getAccessToken();
    $value = $accessToken->getValue();
    error_log("ACCESS TOKEN=" . $value);

    $sumup = new \SumUp\SumUp([
        'app_id'     => get_option('cws_sumup_key'),
        'app_secret' => get_option('cws_sumup_secret_key'),
        'access_token' => $value
    ]);

    $checkoutsService = $sumup->getCheckoutService();

//     WORKING FINE TO THIS POINT

    $response = $checkoutsService->create(10, 'GBP', 'DYS00001', 'webmaster-test@sumup.com');
    $checkoutId = $response->getBody()->id;

} 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();
}

I am getting an access token and the checkout service seems to work but I\'m getting Response error: request_not_allowed

with the create method. This is taking too much time and I need to get it sorted. Please help. Is there a better PHP guide or a sample app that I can take a look at.

Thanks

liedekef commented 2 years ago

Apparently you need to contact sump for checkout activation. Seems weird ... See https://github.com/sumup/sumup-ecom-php-sdk/issues/24 and https://github.com/sumup/sumup-ecom-php-sdk/issues/19