this is my current html code its very basic i just copied the one in the documentation and had chatgpt change up the style a bit . when i press the button and try to login with the sandbox account info in the popup window it just makes me sign in as a new account but when i go to sandbox.paypal.com it logs me in normally , and i cant seem to figure out why and no errors are being shown on my server log or the paypal event log thing .
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>PayPal Subscription</title>
<script src="https://www.paypal.com/sdk/js?client-id=my_client_id&vault=true&intent=subscription" data-sdk-integration-source="button-factory"></script>
<link rel="stylesheet" type="text/css" href="/static/styles.css">
<style>
body {
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
margin: 0;
font-family: Arial, sans-serif;
background-color: #121212;
color: #ffffff;
}
.container {
text-align: center;
}
#paypal-button-container {
margin-top: 20px;
}
.paypal-button-container .paypal-button {
width: 200px;
height: 35px;
}
</style>
</head>
<body>
<div class="container">
<h2>Subscribe to test discord bot</h2>
<p>Placeholder description for now developed by jentcold.</p>
<div id="paypal-button-container"></div>
</div>
<script>
paypal.Buttons({
style: {
shape: 'pill',
color: 'gold',
layout: 'vertical',
label: 'paypal'
},
createSubscription: function(data, actions) {
return actions.subscription.create({
plan_id: 'my_plan_id',
custom_id: '{{guild_id}}'
});
},
onApprove: function(data, actions) {
window.location.href = '/subscription_success';
},
onError: function(err) {
console.error('Error:', err);
window.location.href = '/cancel';
}
}).render('#paypal-button-container');
</script>
</body>
</html>
Some related info:
- where i am currently residing all outside payments with non international visas are disabled idk if that could affect it.
- the plan id im using is the one made in my real buisness account which is also the same developer account and not the one made in the sandbox buisness account provided
- when i tried using the one provided in the sandbox buisness account it wouldnt even let me log in the popup would show then close immediately and redirect me to my failure screen
- my back end server is running on python fast api
- no errors or logs show up in the paypal or server logs when i press the button and try to login
ive been struggling with this for 2 days now and id appreciate any help i can get ive tried online forums and the paypal forum but it seems like my issue is either rare or my understadning of the issue itself is lacking so i cannot figure it out , or any similar situations in the forums i read .
i wish i could use stripe but apperantly its unavailable in my country