<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" type="text/css" href="css/css.css">
<title>Flexi Calci</title>
</head>
<body>
</div>
<div id="paypal-button-container-P-30451526T9649281TMX"></div>
<script src="https://www.paypal.com/sdk/js?client-id=AQfUPqCKl3ThEvrldjThW9MTVGkLBJVAT89oen9Rtem9c0fuw8ul8FWaKriW4qSZ7rwlYdM6JUp&vault=true&intent=subscription"data-sdk-integration-source="button-factory"></script>
<script>
paypal.Buttons({
style: {
shape: 'pill',
color: 'gold',
layout: 'horizontal',
label: 'subscribe'
},
createSubscription: function(data, actions) {
return actions.subscription.create({
/* Creates the subscription */
plan_id: 'P-30451526T9649281TMX'
});
},
onApprove: function(data, actions) {
alert(data.subscriptionID); // You can add optional success message for the subscriber here
}
}).render('#paypal-button-container-P-30451526T9649281TMX'); // Renders the PayPal button
</script>
</div>
<script type="text/javascript" src="js/js.js"></script>
</body>
</html>
这是 PayPal 提供的用于创建捐赠按钮的代码。但是,当我尝试运行它时,chrome 扩展会给出不安全评估和内容安全策略的错误,而我对此非常不了解。
您能帮忙说明一下为什么不起作用以及如何纠正吗?
{
"manifest_version": 3,
"name": "FlexiCalci",
"description": "Get more done in less time with FlexiCalci, the calculator that lets you work smarter, not harder.",
"version": "1.0.2",
"action": {
"default_popup": "index.html"
},
"permissions": ["storage"],
"icons": {
"16": "img/logo16.png",
"32": "img/logo32.png",
"48": "img/logo48.png",
"128": "img/logo128.png"
}
}
这是我的manifest.json
PayPal JS SDK 集成加载外部资源; Chrome 扩展不支持此功能。
另一种方法是使用订阅链接而不是按钮代码。您可以从 PayPal 帐户的列表中“复制链接”,https://www.paypal.com/billing/plans
它将给出以下形式的链接:
https://www.paypal.com/webapps/billing/plans/subscribe?plan_id=P-30451526T9649281TMXXXXXX