sumup / sumup-ecom-php-sdk

SumUp eCom PHP SDK
Other
41 stars 18 forks source link

403 error posting a checkout request #19

Closed rleo79 closed 4 years ago

rleo79 commented 4 years ago

I really cannot figure out how to create a checkout request ` try { $sumup = new \SumUp\SumUp([ 'app_id' => $app_config['app_id'], 'app_secret' => $app_config['app_secret'], 'grant_type' => 'client_credentials', 'scopes' => ['payments', 'transactions.history', 'user.app-settings', 'user.profile_readonly'], 'use_guzzlehttp_over_curl' => $app_config['force_guzzle'], ]);

$accessToken = $sumup->getAccessToken();
$value = $accessToken->getValue();

$checkoutsService = $sumup->getCheckoutService();

$response = $checkoutsService->create(10, 'EUR', 'CO746453', 'docuser@sumup.com', 'Sample one-time payment');

$checkoutId = $response->getBody()->id;
stampa_info('CHECKOUT ID: '.$checkoutId);

} catch (\SumUp\Exceptions\SumUpValidationException $e) { die(stampa_errore('Validation error: ' . $e->getMessage() . ' - Code: '.$e->getCode())); } catch (\SumUp\Exceptions\SumUpArgumentException $e) { die(stampa_errore('Argument error: ' . $e->getMessage() . ' - Code: '.$e->getCode())); } catch (\SumUp\Exceptions\SumUpAuthenticationException $e) { die(stampa_errore('Authentication error: ' . $e->getMessage() . ' - Code: '.$e->getCode())); } catch (\SumUp\Exceptions\SumUpResponseException $e) { die(stampa_errore('Response error: ' . $e->getMessage() . ' - Code: '.$e->getCode())); } catch(\SumUp\Exceptions\SumUpSDKException $e) { die(stampa_errore('SumUp SDK error message: ' . $e->getMessage() . ' - Code: '.$e->getCode())); } catch(\SumUp\Exceptions\SumUpServerException $e) { die(stampa_errore('SumUp server error message: ' . $e->getMessage() . ' - Code: '.$e->getCode())); } catch (Exception $e){ die(stampa_errore('Si è verificato un problema: ' . $e->getMessage() . ' - Code: '.$e->getCode())); } `

I get a "Response error: request_not_allowed - Code: 403" exception. I am sure that $accessToken has a value. So I cannot figure why it's not working.

lyubomir-sumup commented 4 years ago

Hi @rleo79, There is nothing wrong with your code. You are missing the payments scope. You can read more about the restricted scopes here. You should write to integration@sumup.com to be properly onboarded for this functionality.

chrisreiter commented 3 years ago

what does " You should write to integration@sumup.com to be properly onboarded for this functionality." mean? Is there anything to be activated in the account as well? I am having that issue on test- and real accounts

rleo79 commented 3 years ago

We were missing the payments scope. We had to complete our onboarding with sumup offices by signing an agreement where we stated the kind of products we could sell or not because they have limitation of their license. After that we could complete our development and we did not get the error anymore.

Il giorno ven 7 mag 2021 alle ore 14:34 chrisreiter < @.***> ha scritto:

what does " You should write to @.*** to be properly onboarded for this functionality." mean? Is there anything to be activated in the account as well? I am having that issue on test- and real accounts

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/sumup/sumup-ecom-php-sdk/issues/19#issuecomment-834336209, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAPMUKIORU6CZ3LZPOANRUDTMPM4FANCNFSM4J3BAPMQ .

pratikdzignuts commented 2 years ago

try { $sumup = new \SumUp\SumUp([ 'app_id' => env('SUM_UP_APP_ID'), 'app_secret' => env('SUM_UP_APP_SECRET'), 'grant_type' => 'client_credentials', 'scopes' => ['payments', 'transactions.history', 'user.app-settings', 'user.profile_readonly'], ]); $checkoutService = $sumup->getCheckoutService(); // $checkoutResponse = $checkoutService->create($amount, $currency, $checkoutRef, $payToEmail); // $checkoutId = $checkoutResponse->getBody()->id; $success = [ 'message' => 'Get Sum Up Auth.', 'success' =>true, 'data' => $checkoutService ]; // pass the $chekoutId to the front-end to be processed } catch (\SumUp\Exceptions\SumUpAuthenticationException $e) { $success = [ 'message' => 'Authentication error: ' . $e->getMessage(), 'success' =>false, ]; } catch (\SumUp\Exceptions\SumUpResponseException $e) { $success = [ 'message' => 'Response error: ' . $e->getMessage(), 'success' =>false, ]; } catch(\SumUp\Exceptions\SumUpSDKException $e) { $success = [ 'message' => 'SumUp SDK error: ' . $e->getMessage(), 'success' =>false, ]; }

This is my Rest-api code, I'm try to integrate Sum-up Online payment Integration in my Laravel project, but I'm getting error like this { "message": "Response error: Client error", "success": false } So, Anyone can give me suggestion for how to fix this issue.

shahsagar1998 commented 2 years ago

Hello everyone,

I got the same issue, and i have added payments scope in my code. Please check and give me suggestion, how to fix this issue.

$sumup = new \SumUp\SumUp([ 'app_id' => 'SUM_UP_APP_ID', 'app_secret' => 'SUM_UP_APP_SECRET', 'grant_type' => 'client_credentials', 'scopes' => ['payments', 'transactions.history', 'user.app-settings', 'user.profile_readonly'], ]); $checkoutService = $sumup->getCheckoutService(); $checkoutResponse = $checkoutService->create($amount, $currency, $checkoutRef, $payToEmail); $checkoutId = $checkoutResponse->getBody()->id;

Thanks in Advance.

pratikdzignuts commented 2 years ago

you fill sumup contact form and enabling payment scope. then checkout API works.

On Tue, Jan 4, 2022 at 11:25 AM shahsagar1998 @.***> wrote:

Hello everyone,

I got the same issue, and i have added payments scope in my code. Please check and give me suggestion, how to fix this issue.

$sumup = new \SumUp\SumUp([ 'app_id' => 'SUM_UP_APP_ID', 'app_secret' => 'SUM_UP_APP_SECRET', 'grant_type' => 'client_credentials', 'scopes' => ['payments', 'transactions.history', 'user.app-settings', 'user.profile_readonly'], ]); $checkoutService = $sumup->getCheckoutService(); $checkoutResponse = $checkoutService->create($amount, $currency, $checkoutRef, $payToEmail); $checkoutId = $checkoutResponse->getBody()->id;

Thanks in Advance.

— Reply to this email directly, view it on GitHub https://github.com/sumup/sumup-ecom-php-sdk/issues/19#issuecomment-1004546526, or unsubscribe https://github.com/notifications/unsubscribe-auth/AWAIQYT6663TAUBTTROPCCDUUKDVVANCNFSM4J3BAPMQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you commented.Message ID: @.***>