简体   繁体   English

Paypal:从沙盒上线

[英]Paypal: going Live from sandbox

I have been brainstorming for a while now on this and finally i decided to put a question here. 我已经为此进行了一段时间的集思广益,最后我决定在这里提出一个问题。

I am using PayPal-PHP-SDK (restAPI) for processing payments. 我正在使用PayPal-PHP-SDK(restAPI)处理付款。 And i cannot make it go to the live endpoint ( api.paypal.com ) and always goes to sandbox ( api.sandbox.paypal.com ) 而且我无法使其进入实时端点( api.paypal.com ),而始终进入沙箱( api.sandbox.paypal.com

Progress : Using the sandbox credentials ( clientId and clientSecret ) in 'bootstarp.php' and 'mode' set to 'sandbox' in 'sdk_config.ini' i have successfully completed multiple sandbox transactions and completed all other parts of the project. 进度 :使用“ bootstarp.php”中的沙箱凭据( clientIdclientSecret )并将“ sdk_config.ini”中的“ mode”设置为“ sandbox” ,我已经成功完成了多个沙箱事务并完成了项目的所有其他部分。 Now the only part is making it live, which is in fact turning out to be the Achilles heel of the project. 现在唯一的一部分就是使它变得生动起来,实际上这已成为该项目的致命弱点。

What i have tried : I have replaced the sandbox credentials with the live ones from the client. 我所尝试的是 :我已用来自客户端的实时凭据替换了沙箱凭据。 Which he got from https://developer.paypal.com/webapps/developer/applications/myapps then under the app clicking 'show' Live Credentials . 他从https://developer.paypal.com/webapps/developer/applications/myapps获得,然后在应用程序下单击“显示” Live Credentials I also changed the mode to live in 'sdk_config.ini'. 我也改 “sdk_config.ini”的模式 But still it takes me to the sandbox endpoint. 但是仍然需要我进入沙箱端点。

EDIT : while creating the api context in bootstarp.php there is a mode i have also set that to live, code below. 编辑 :在bootstarp.php中创建api上下文时,有一种模式我也将其设置为活动,下面的代码。

$apiContext->setConfig(
    array(
        'mode' => 'live',
        'http.ConnectionTimeOut' => 30,
        'log.LogEnabled' => true,
        'log.FileName' => '../PayPal.log',
        'log.LogLevel' => 'FINE',
        'validation.level' => 'log'
    )
);

Can anyone suggest me what i am missing here as i get no error to debug and look further. 谁能建议我在这里我所缺少的,因为我没有错误进行调试并进一步查找。 For any help or advice, thanks in advance. 对于任何帮助或建议,请先感谢。

Have you changed the mode in bootstrap.php? 您是否更改了bootstrap.php中的模式? It seems you can use either the configuration in bootstrap.php or in the sdk_config.ini file but not both. 看来您可以在bootstrap.php中使用配置,也可以在sdk_config.ini文件中使用配置,但不能同时使用。 Make sure mode is set to live in the bootstrap.php file if you have the sdk_config.ini path commented out as below (from the bootstrap.php file) 如果您将sdk_config.ini路径注释如下(从bootstrap.php文件中),请确保将模式设置为存在于bootstrap.php文件中。

// Register the sdk_config.ini file in current directory
// as the configuration source.
/*
if(!defined("PP_CONFIG_PATH")) {
    define("PP_CONFIG_PATH", __DIR__);
}
*/

This is probably more appropriate as a comment on Mike Miller's solution but I don't have enough rep, sorry. 对于Mike Miller的解决方案,此评论可能更合适,但对不起,我没有足够的代表。

I moved from the Paypal API sandbox to live literally five minutes ago, using your question and Mike's answer for information on how to do so. 我实际上是从Paypal API沙箱迁移到5分钟前的,使用您的问题和Mike的答案获取有关操作方法的信息。

The only things I changed were the values of clientId and clientSecret in bootstrap.php, and the mode (from 'sandbox' to 'live'), just like you set out in the question. 我唯一更改的是bootstrap.php中的clientIdclientSecret的值,以及模式 (从“ sandbox”到“ live”),就像您在问题中提出的一样。 I didn't edit the 'sdk_config.ini' file at all, and the path is commented out anyway, as per Mike's answer. 根据Mike的回答,我根本没有编辑'sdk_config.ini'文件,并且无论如何该路径都被注释掉了。

I note you're referring to the 'bootstrap.php' file as 'bootstarp.php' - this doesn't have anything to do with it, does it? 我注意到您将'bootstrap.php'文件称为'bootstarp.php'-这与它没有任何关系,不是吗?

I had the same problem that I couldn't fix. 我遇到了无法解决的问题。

I'm not proud of my solution because it's not elegant at all, but it worked to start selling. 我不为自己的解决方案感到骄傲,因为它虽然一点也不优雅,但是它开始销售就起作用了。

I modified the file PayPalConstants.php (located in ...\\PayPal-PHP-SDK\\paypal\\rest-api-sdk-php\\lib\\PayPal\\Core\\PayPalConstants.php ) 我修改了文件PayPalConstants.php (位于...\\PayPal-PHP-SDK\\paypal\\rest-api-sdk-php\\lib\\PayPal\\Core\\PayPalConstants.php

I just changed sandbox routes for live routes: 我只是将沙箱路线更改为实时路线:

const REST_SANDBOX_ENDPOINT = "https://api.paypal.com/";

const OPENID_REDIRECT_SANDBOX_URL = "https://www.paypal.com/webapps/auth/protocol/openidconnect";

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

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