PayPal PHP SDK 不适用于订阅,获取 RESOURCE_NOT_FOUND [英] PayPal PHP SDK not working for Subscriptions, get RESOURCE_NOT_FOUND

查看:79
本文介绍了PayPal PHP SDK 不适用于订阅,获取 RESOURCE_NOT_FOUND的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试使用 PayPal Smart Button 在网站上进行付款.

I try to use PayPal Smart Button to purpose payment on a website.

我首先创建了一个计划,获得了它的 ID,然后我通过 API 和 PHP 中的 PayPal SDK 命令激活了它.

I first created a plan, I got its ID, and I activated it, via commands with the API and the PayPal SDK in PHP.

该计划似乎有效.

<script src="https://www.paypal.com/sdk/js?client-id=sb-key&vault=true&disable-funding=card"></script>
<script>
    paypal.Buttons({
        env: 'sandbox',
        createSubscription: function(data, actions) {
            return actions.subscription.create({
                'plan_id': 'P-85G86700MN...223CGEJWTI'
            });
        },
        onApprove: function(data, actions) {
            alert('You have successfully created subscription ' + data.subscriptionID);
        }
    }).render('#paypal-button-container');
</script>

当我点击 PayPal 按钮进行支付时.我收到此错误:RESOURCE_NOT_FOUND

When I click on the PayPal button to pay. I get this error: RESOURCE_NOT_FOUND

我不知道这意味着什么,遇到同样问题的人没有得到支持.

I don't know what it all means, and people who have had the same problem have not received support.

推荐答案

旧的 PayPal-PHP-您正在使用的 SDK 不应再用于任何新的集成.它不支持新的 Subscriptions API,而是对较旧的内容使用计费计划,这与您尝试执行的操作不兼容(结果是 RESOURCE_NOT_FOUND 错误)

The old PayPal-PHP-SDK you are using should no longer be used for any new integration. It does not support the new Subscriptions API, and instead uses billing plans for something older, which is not compatible with what you are trying to do (RESOURCE_NOT_FOUND error is the result)

新的 paypal/Checkout-PHP-SDK 应该用于定期付款,但也不支持订阅 API.

The new paypal/Checkout-PHP-SDK is what should be used for regular payments, but also doesn't support Subscriptions API.

所以本质上,没有用于订阅的 SDK.要使用 订阅 API,您需要实现直接的 HTTPS REST API 调用以创建必要的产品、计划和协议.(或通过账户界面创建:沙盒登录,或直播)

So essentially, there is no SDK for subscriptions. To use the Subscriptions API, you'll need to implement direct HTTPS REST API calls to create the necessary products, plans, and agreements. (Or create via the account interface: sandbox login, or live)

您可以先使用命令行 curl 或邮递员调用进行测试,以确认您想要执行的工作,然后编写必要的 PHP 函数以使用 oauth 对 PayPal 进行您自己的 HTTPS 调用令牌.

You could test with command-line curl or postman calls first, to confirm what you want to do works, and then write the necessary PHP function to do your own HTTPS calls to PayPal with the oauth token.

这篇关于PayPal PHP SDK 不适用于订阅,获取 RESOURCE_NOT_FOUND的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆