首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >捕获沙箱贝宝智能按钮COMPLIANCE_VIOLATION错误

捕获沙箱贝宝智能按钮COMPLIANCE_VIOLATION错误
EN

Stack Overflow用户
提问于 2021-05-23 14:08:13
回答 1查看 712关注 0票数 0

我试图在客户端集成一个非常基本的Paypal智能按钮,就像在文档页面上一样,下面是我的代码片段:

代码语言:javascript
复制
<div id="smart-button-container">
    <div style="text-align: center;">
        <div id="paypal-button-container"></div>
    </div>
</div>
<script src="https://www.paypal.com/sdk/js?client-id=[my_sandbox_app_id]&currency=USD" data-sdk-integration-source="button-factory"></script>
<script>
    function initPayPalButton() {
        paypal.Buttons({
            style: {
                shape: 'rect',
                color: 'gold',
                layout: 'vertical',
                label: 'paypal',
            },
            createOrder: function (data, actions) {
                return actions.order.create({
                    purchase_units: [{ "description": "first product", "amount": { "currency_code": "USD", "value": 5 } }]
                });
            },
            onApprove: function (data, actions) {
                return actions.order.capture().then(function (details) {
                    alert('Transaction completed by ' + details.payer.name.given_name + '!');
                });
            },
            onError: function (err) {
                console.log(err);
            }
        }).render('#paypal-button-container');
    }
    initPayPalButton();
</script>

但我得到的错误是422 500,而不是批准:

通过检查“网络”选项卡,我找到了有关错误422的详细信息

如何克服这些错误?

代码语言:javascript
复制
{
    "name": "UNPROCESSABLE_ENTITY",
    "details": [
        {
            "issue": "COMPLIANCE_VIOLATION",
            "description": "Transaction cannot be processed due to a possible compliance violation. To get more information about the transaction, call Customer Support."
        }
    ],
    "message": "The requested action could not be performed, semantically incorrect, or failed business validation.",
    "debug_id": "19961f1d1be55",
    "links": [
        {
            "href": "https://developer.paypal.com/docs/api/orders/v2/#error-COMPLIANCE_VIOLATION",
            "rel": "information_link",
            "method": "GET"
        }
    ]
}
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2021-05-23 21:30:46

对于Sandbox测试,为另一个国家创建一个Sandbox帐户和相关的REST应用程序--例如美国。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/67660641

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档