简体   繁体   English

RESOURCE_NOT_FOUND 在 JavaScript 中的 PayPal 中创建订阅 Api 响应时

[英]RESOURCE_NOT_FOUND while creating Subscription Api response in PayPal in JavaScript

I am using PayPal payment integration in my code.我在我的代码中使用 PayPal 支付集成。

I have created a product and plan in PayPal account and I want to use PayPal monthly/yearly subscription buttons.我在 PayPal 帐户中创建了一个产品和计划,我想使用 PayPal 每月/每年订阅按钮。

I copied code from PayPal developer site and put in my code but it is not working.我从 PayPal 开发者网站复制了代码并输入了我的代码,但它不起作用。

error错误

Below is my code下面是我的代码

    <script>
  paypal.Buttons({
      style: {
          shape: 'rect',
          color: 'gold',
          layout: 'vertical',
          label: 'subscribe'
      },
      createSubscription: function(data, actions) {
        return actions.subscription.create({
          /* Creates the subscription */
          plan_id: 'P-XXXX7066V2124102XXXXXX'
        });
      },
      onApprove: function(data, actions) {
        alert(data.subscriptionID); // You can add optional success message for the subscriber here
      }
  }).render('#paypal-button-container-P-7L763248U6625362UMLLHPYQ'); // Renders the PayPal button
</script>

Thanks in advance.提前致谢。

The most likely explanation for a RESOURCE_NOT_FOUND error is if your plan_id does not correspond to (was not created under/using) the client id the SDK is loaded with. RESOURCE_NOT_FOUND 错误的最可能解释是,如果您的 plan_id 不对应(不是在/使用下创建)SDK 加载的客户端 ID。

In particular, from the error it's evident you're using a client id from the sandbox environment.特别是,从错误中可以明显看出您正在使用沙盒环境中的客户端 ID。 This means that you need to be able to find that plan id by logging into the sandbox environment using the sandbox business account that corresponds to the sandbox mode app with the client_id you are using .这意味着您需要能够通过使用与您正在使用的 client_id 的沙盒模式应用程序对应的沙盒业务帐户登录到沙盒环境来找到该计划 ID。

If the plan_id cannot be found within that client_id's sandbox account, and especially if you are mixing a plan_id from the live environment with a sandbox client_id (the two environments are completely separate), RESOURCE_NOT_FOUND is the expected error.如果在该 client_id 的沙箱帐户中找不到 plan_id,特别是如果您将实时环境中的 plan_id 与沙箱 client_id 混合(这两个环境完全分开),则 RESOURCE_NOT_FOUND 是预期的错误。


If that isn't enough to resolve your issue, your question needs to be specific about which exact plan_id and client id you are using, to test their correspondence.如果这还不足以解决您的问题,您的问题需要具体说明您正在使用哪个确切的 plan_id 和客户端 ID,以测试它们的对应关系。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM