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

getting 403 error in checkout api #24

Closed
waseemakhtarapp opened this issue Apr 28, 2021 · 4 comments
Closed

getting 403 error in checkout api #24

waseemakhtarapp opened this issue Apr 28, 2021 · 4 comments

Comments

@waseemakhtarapp
Copy link

i am getting [error_message] => request_not_allowed [error_code] => FORBIDDEN [status_code] => 403
Here is mycode
function getTokenU()
{
$headers = [
'Content-Type: application/json',
];
$packet = [
'grant_type' => 'client_credentials',
'client_id' => $client_id,
'client_secret' => $client_secret,
//'scope' => ['payments', 'transactions.history', 'user.app-settings', 'user.profile_readonly'],
];
$packet_json = json_encode($packet);
$ch = curl_init();
$ch = curl_init('https://api.sumup.com/token');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($ch, CURLOPT_POSTFIELDS, $packet_json);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$output = curl_exec($ch);
$output = json_decode($output, true);

    return $output['access_token'];

}

$token = getTokenU();

$amount = '100';
$currency = 'EUR';
$checkoutRef = '0'.uniqid();
$payToEmail = '[email protected]';
 $packet = [
        'checkout_reference' => 'O_'.uniqid(),
        'amount' => 2.00,
        'currency' => 'EUR',
        'pay_to_email' => $payToEmail,
        'return_url' => 'success.php',
        
    ];
    $headers = [
        'Content-Type: application/json',
        'Authorization: Bearer '.$token,
    ];
    $packet_json = json_encode($packet);
    $ch = curl_init();
    $ch = curl_init('https://api.sumup.com/v0.1/checkouts');
    curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
    curl_setopt($ch, CURLOPT_POSTFIELDS, $packet_json);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
    $output = curl_exec($ch);
    $output = json_decode($output, true);

    print_r($output);

// and i am getting
Array ( [error_message] => request_not_allowed [error_code] => FORBIDDEN [status_code] => 403 )

@chrisreiter
Copy link

chrisreiter commented May 7, 2021

I have the same issue. auth and refresh token requests work fine, but requesting a checkout leads to 403.

@chrisreiter
Copy link

chrisreiter commented May 7, 2021

additional hint: calling that (see curl below without any params) from command line with a valid token leads to 403 as well......so it seems the server does not care about the following parameters at all and blocks the request right after authentication curl -X POST https://api.sumup.com/v0.1/checkouts -H "Authorization: Bearer 35c6d6fea505842dc0bff2a326043efb329769ad565a1c36661..."

@chrisreiter
Copy link

i got feedback from the support team:) your account has to be enabled for checkouts.. So just write to the support team and you're helped :)

@ptrovatelli
Copy link

in my case I had to write to [email protected]

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

4 participants