Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

403 error posting a checkout request #19

Closed
rleo79 opened this issue Dec 15, 2019 · 6 comments
Closed

403 error posting a checkout request #19

rleo79 opened this issue Dec 15, 2019 · 6 comments

Comments

@rleo79
Copy link

rleo79 commented Dec 15, 2019

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', '[email protected]', '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
Copy link
Contributor

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 [email protected] to be properly onboarded for this functionality.

@chrisreiter
Copy link

what does " You should write to [email protected] 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
Copy link
Author

rleo79 commented May 7, 2021 via email

@pratikdzignuts
Copy link

pratikdzignuts commented Oct 11, 2021

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
Copy link

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
Copy link

pratikdzignuts commented Jan 4, 2022 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants