• PP--paypal登录器全自动版本PP--paypal登录器全自动版本
  • 通过PayPal登录

    2012-12-05 11:00:34
    <p>I have found this example : <p><a href=...I can't find such information how to integrate Login-via-paypal on any paypal pages. </div>
  • paypal 登录 api

    2015-04-19 18:30:37
    资料: http://www.sitepoint.com/implement-user-log-paypal/ http://stackoverflow.com/questions/21968913/successful-paypal-login-using-paypal-login-api-integration-returns-the-expected





  • I'm trying to create an application on wordpress wherein when a user visits a page it will automatically ask the user to login and authenticate using a paypal account. When successfully log-in, I ...
  • <p>Well, I was wondering if it is possible to automatically logins the user in paypal everytime they checks out? <p>Given the scenario a new user registers in my site. <pre><code>New User->Logins...
  • <p>When i try to login with Paypal. it rerun this. <pre><code>401 Response: {"error":"invalid_authz_code","error_description":"Authorization Code is invalid"} </code></pre> <p>I am using sandbox api...
  • class User extends Controller{ public function paypal(){ $_SESSION['state'] = md5(uniqid(rand(), TRUE)); $client_id = '你的client_id'; $client_secret = '你的client_secret'; $nonce = ...

    namespace Home\Controller;

    use Think\Controller;

    class User extends Controller{

    public function paypal(){

    $_SESSION['state'] = md5(uniqid(rand(), TRUE));

    $client_id = '你的client_id';

    $client_secret = '你的client_secret';

    $nonce = time() . rand();

    $app_return_url = 'http://yourdomain/user/paypal_return';  //这里的返回地址必须要与你在paypal上创建client_id时填写的返回地址一致

    $scopes = 'profile+email+address+phone';

    $paypal_auth_url = "https://www.paypal.com/webapps/auth/protocol/openidconnect/v1/authorize?"







    //echo $paypal_auth_url;exit;

    header("Location: $paypal_auth_url");



    * Paypal返回地址

    * @return void


    public function paypal_return(){

    $code = trim($_GET['code']);

    $client_id = '你的client_id';

    $client_secret = '你的client_secret';



    $token_url = "https://www.paypal.com/webapps/auth/protocol/openidconnect/v1/tokenservice";

    $postvals = "client_id=".$client_id




    $response = Http::fsockopenDownload($token_url,array(

    'post' => $postvals,


    $atoken = json_decode($response);

    $access_token = $atoken->access_token;

    $_SESSION['access_token'] = $access_token;  //token可以保存起来使用,貌似15分钟后才会失效



    $profile_url = "https://www.paypal.com/webapps/auth/protocol/openidconnect/v1/userinfo?"



    $profile = file_get_contents($profile_url);

    $profile = json_decode($profile);





    $email = $profile->email;

    $name = $profile->name;

    $first_name = $profile->family_name;

    $last_name = $profile->given_name;

    $phone = $profile->phone_number;

    $locale = $profile->locale;

    $address = $profile->address;




  • <p>I want to implement a 'Login with PayPal' button into my page and everything works fine, except that I can't receive the information from the user because I always get an <code>'Notice: Trying to ...
  • php实现paypal 授权登录

    2020-10-24 04:38:28
  • I tried to login with another paypal account, because the money should come to my paypal account, but every time it shows me a error message "Check your email address and password and try again", ...
  • Paypal购物车需要登录

    2013-06-12 20:40:50
    <p>However, the PayPal cart, as I can see, has no way of supporting "needs to be logged in" to make a purchase, as the actual cart itself is stored on PayPal's servers. It's a very easy method of ...
  • paypal沙盒用户Curiosity is one of the most important traits in our job. The other day, I found myself exploring PayPal documentation to find something interesting to learn (and share). After a while I...


    Curiosity is one of the most important traits in our job. The other day, I found myself exploring PayPal documentation to find something interesting to learn (and share). After a while I stumbled upon the Log In with PayPal tool.

    好奇心是我们工作中最重要的特征之一。 前几天,我发现自己正在探索PayPal文档,以查找一些有趣的知识(并分享)。 一段时间后,我偶然发现了使用PayPal登录工具

    With the “Log In with PayPal” tool, your users can authenticate into your application using PayPal. It’s the same procedure we already know for Facebook, or maybe Twitter and GitHub.

    使用“使用PayPal登录”工具,您的用户可以使用PayPal对您的应用程序进行身份验证。 这是我们对于Facebook或Twitter和GitHub已经知道的相同过程。

    Using this type of authentication is recommended if you want to integrate it with an e-commerce website, but you can use it in every situation and application that requires a user account or membership.


    为什么要使用“使用PayPal登录”? (Why use ‘Log In with PayPal’?)

    One of the most important reasons to use it is simplicity. Your user will not need to remember another set of credentials – the same advantage OAuth via FB, Twitter, etc have. Also, the login procedure is absolutely secured: fewer concerns for you. However, it’s not just an email and a password.

    使用它的最重要原因之一是简单性 。 您的用户将无需记住另一组凭据-通过FB,Twitter等获得OAuth的相同优势。 此外,登录过程绝对安全:您的顾虑更少。 但是,不仅是电子邮件和密码。

    When you create a PayPal account there is a lot of information that you specify. This info, using the APIs, can also be used in your application in many useful ways. One of the best examples I can give is the e-commerce one: why bother your user with asking him for a shipping address if you already know it? He already told PayPal where he lives! In terms of user experience, a simple button is way better than filling a form with many fields… and when it comes to shipping there are at least three or four of them.

    创建贝宝帐户时,需要指定许多信息。 使用API​​的此信息也可以通过许多有用的方式在您的应用程序中使用。 我可以举的最好的例子之一就是电子商务:为什么您已经知道了送货地址,就打扰您的用户呢? 他已经告诉贝宝他住的地方! 就用户体验而言,简单的按钮比在多个字段中填写表格要好得多……而在运输方面,至少有三个或四个。

    Another great feature is that we are talking about a standard, because the Log In with PayPal tool is based on OpenID Connect which uses OpenID 2.0 and OAuth 2.0 open standards.

    另一个很棒的功能是我们正在谈论一种标准,因为“使用PayPal登录”工具基于使用OpenID 2.0和OAuth 2.0开放标准的OpenID Connect。

    Using the PayPal tool also opens many new points of view for the merchant/applications. If you think about it, PayPal actually has more than 100 milions users. You are potentially expanding your user base. Everything also comes with a real time update of user data: if your user changes something about himself on PayPal, your application will “know it” immediately.

    使用PayPal工具还为商家/应用程序打开了许多新的视角。 如果您考虑一下,PayPal实际上拥有超过1亿用户。 您可能正在扩展用户群。 一切还附带了用户数据的实时更新:如果您的用户在PayPal上更改了有关他自己的某些内容,您的应用程序将立即“知道”。

    I presume that you now have really good reasons to start thinking about it. Let’s see how to implement this solution in a sample application.

    我认为您现在有充分的理由开始考虑它。 让我们看看如何在示例应用程序中实现此解决方案。

    它是如何工作的? (How does it work?)

    Before diving into the implementation procedure, it’s going to be a good thing if you can understand the mechanism under the hood. Like we mentioned before, the Log In with PayPal tool is based on Open ID Connect. In the picture below, you can find all the information about the entire procedure in every single moment.

    在深入了解实现过程之前,如果您可以了解其内在机制,那将是一件好事。 就像我们之前提到的,使用PayPal登录工具基于Open ID Connect。 在下面的图片中,您可以随时找到有关整个过程的所有信息。

    Login with PayPal Flowchart

    Everything starts with the application that we are developing: it could be the e-commerce we used before as an example. The Log In with PayPal button redirects the user to the PayPal Authentication and Authorization Service. After giving credentials, the user has to agree to share his data with our application. He will be informed of every single datum that he’s going to share with us. If everything goes fine, PayPal gives to the application an authorization code.

    一切都始于我们正在开发的应用程序:这可能是我们之前作为示例使用的电子商务。 使用PayPal登录按钮将用户重定向到PayPal身份验证和授权服务。 提供凭据后,用户必须同意与我们的应用程序共享其数据。 他将被告知将要与我们共享的每个数据。 如果一切顺利,贝宝(PayPal)向应用程序提供授权码。

    The next step is a communication between the merchant (the application) and the PayPal token service endpoint. The first gives to the second the authorization code, in order to receive the access token and the refresh token.

    下一步是商家(应用程序)和PayPal令牌服务端点之间的通信。 第一个给第二个授权码,以便接收访问令牌刷新令牌

    Using the access token the application can query the PayPal User Profile Service, getting everything it needs about user data. The signup (or login) procedure can be finished in a matter of seconds.

    应用程序可以使用访问令牌查询PayPal用户配置文件服务,获取有关用户数据的所有信息。 注册(或登录)过程可以在几秒钟内完成。

    Now that things are more clear than before, we can proceed with the real implementation. Let’s get our hands dirty!

    现在,事情已经比以前更清楚了,我们可以继续进行实际的实现了。 让我们弄脏双手吧!

    创建贝宝应用程序 (Creating a PayPal application)

    First of all, we have to create a PayPal application in order to obtain the Client ID and the Client Secret. We will use them for every single call to the API methods. They will be our credentials for the API services.

    首先,我们必须创建一个PayPal应用程序以获得客户ID客户密钥 。 我们将在每次调用API方法时使用它们。 它们将成为我们提供API服务的凭据。

    Go to the developer dashboard at https://developer.paypal.com/. From there, click on “Dashboard”, then on “Applications”. Click on “My apps” to access the list of the PayPal applications.

    转到位于https://developer.paypal.com/的开发人员仪表板。 从那里,单击“仪表板”,然后单击“应用程序”。 单击“我的应用程序”以访问PayPal应用程序列表。

    If it’s your first time here, you will probably see something like this.



    Select “Create App”. You will be asked for a name for the application and a sandbox user as a reference.

    选择“创建应用”。 系统将要求您提供应用程序的名称和沙箱用户作为参考。

    Note: if this is your first time working with PayPal, you are probably curious about the Sandbox. As the name suggests, the Sandbox is a testing service that PayPal gives you to try your code without any consequences in the real world. It gives you the possibility to create fake users (both merchants and customers) to recreate entire workflows with fake users, to ensure that your code will work as you expect it to. The only difference between the Sandbox and the real life production code will be the endpoint that you will use. However, it will not be something difficult to change: just remove the sandbox prefix from the endpoint. If you need more information take a look at the docs: https://developer.paypal.com/docs/classic/lifecycle/sb_overview/.

    注意:如果这是您第一次使用PayPal,则可能对Sandbox感到好奇。 顾名思义,Sandbox是一项测试服务,PayPal为您提供了在不影响现实世界的情况下尝试代码的功能。 它使您可以创建伪造的用户(包括商家和客户),用伪造的用户重新创建整个工作流程,以确保您的代码能够按预期工作。 沙盒和实际生产代码之间的唯一区别是您将使用的端点。 但是,更改并不难:只需从端点中删除沙箱前缀即可。 如果您需要更多信息,请查看以下文档: https : //developer.paypal.com/docs/classic/lifecycle/sb_overview/

    After giving the OK for the application creation, you will immediately see the Client ID and the Client Secret.


    Note: don’t forget to set the return page URL here. It is the page where PayPal will redirect the user after the authentication step and it’s where you will have to deal with tokens and data. Click on “Edit” near “App redirect URLs”. You will be able to specify two different URLs: one for testing, one for production. In my case it is going to be something like http://myapp.ext/return.php.

    注意:不要忘记在此处设置返回页面URL。 在此页面上,贝宝(PayPal)将在身份验证步骤之后重定向用户,并且您必须在该页面上处理令牌和数据。 点击“应用重定向网址”附近的“编辑”。 您将能够指定两个不同的URL:一个用于测试,一个用于生产。 就我而言,它将类似于http://myapp.ext/return.php


    Let’s scroll down the page and search for the “App Capabilities” section. This is where we will find the “Log In with PayPal” subsection. Click on “Advanced Options” to customize what data you will really need from your customer and other little things.

    让我们向下滚动页面并搜索“ App Capabilities”部分。 在这里,我们将找到“使用PayPal登录”小节。 单击“高级选项”以自定义客户和其他一些小东西您真正需要的数据。

    Here’s a complete overview of what you are going to find there:


    • Choose what information we will need from the user: personal data, address data (physical one) and other data, related to the account type;

    • Specify links to the privacy policy and the user agreement: in every real world situation we will need them;

    • Additional permissions: other choices about many aspects of the integration. However, nothing that we need now;

      附加权限:关于集成许多方面的其他选择。 但是,我们现在不需要任何东西。

    Let’s click on “Save” to confirm our choices.


    Our job is done here. Now we have our first PayPal application and we can use it to create our first example project.

    我们的工作在这里完成。 现在,我们有了第一个PayPal应用程序,我们可以使用它来创建第一个示例项目。

    测试项目:简单集成 (The test project: a simple integration)

    In order to stay focused on the integration workflow I decided to make a little test application. Nothing complex: we will just simulate the login procedure on a site that requires authentication. That access will be made by logging in with PayPal. To be more accurate, here’s the complete flow that we are going to follow.

    为了专注于集成工作流程,我决定制作一些测试应用程序。 没什么复杂的:我们将只在需要身份验证的站点上模拟登录过程。 该访问将通过使用PayPal登录进行。 为了更准确,这是我们要遵循的完整流程。

    • The user arrives on the application page;

    • I’m requesting access via PayPal to the user (with the button);

    • The application opens a window with the guided PayPal procedure;

    • The user inserts his credentials and gives the requested permissions;

    • The user is redirected to a “result page” where he will be able to see his PayPal account data. It is going to be our “confirmation” to understand that our integration worked well;

      用户将被重定向到“结果页面”,在那里他将能够看到他的PayPal帐户数据。 了解我们的整合运作良好将是我们的“确认”。

    So, this is going to be our final confirmation screen.



    Are you ready? Let’s do it.

    你准备好了吗? 我们开始做吧。

    配置和安装 (Configuration and Installation)

    Even if it is a very small application, I will use the Httpful library in order to make calls to the PayPal API. I like it because it is:

    即使它是一个很小的应用程序,我也将使用Httpful库来调用PayPal API。 我喜欢它,因为它是:

    • light;

    • easy to install (via Composer);

    • easy to understand (thanks to an intuitive syntax);


    So, let’s create a folder for our project, and save a new composer.json file in it, in which we will write:


    "require": {
    "nategood/httpful": "*"

    Just a composer update and we’re done.

    只是composer update ,我们就完成了。

    After that, create two files: the first one, index.php, will work as a landing page for our example. The second one, result.php is going to receive the authorization code from PayPal and will work with API calls and the resulting data.

    之后,创建两个文件:第一个文件index.php将作为示例的登录页面。 第二个result.phpresult.php将从PayPal接收授权代码,并将与API调用和结果数据一起使用。

    Open the index.php file and, at the same time, go with your browser at https://developer.paypal.com/webapps/developer/docs/integration/direct/identity/button-js-builder/. From here, you will be able to generate dynamically the code for our “Log In with PayPal” button. After generating it, just copy the code and paste it on the index.php page.

    打开index.php文件,同时使用浏览器访问https://developer.paypal.com/webapps/developer/docs/integration/direct/identity/button-js-builder/ 。 从这里,您将能够为我们的“使用PayPal登录”按钮动态生成代码。 生成代码后,只需复制代码并将其粘贴到index.php页面上。

    Here’s the generator page:



    There are not many things to decide about. The first thing that we have to specify is going to be the Client ID that we want to use. Right after you can specify the endpoint you want to use: live production or sandbox (for testing)? Then, you can choose other little things about localization and customization in terms of “aesthetics”.

    没有太多要决定的事情。 我们必须指定的第一件事是要使用的客户端ID。 在您可以立即指定要使用的端点之后:实时生产或沙箱(用于测试)? 然后,您可以根据“美学”选择其他有关本地化和自定义的小知识。

    You will also have to fill the “return URL” again. Yes, use the same URL as before.

    您还必须再次填写“返回URL”。 是的,使用与以前相同的URL。

    When you’re done, getting the generated code is really easy: just scroll down the page, you will find it there.


    index.php文件 (The index.php file)

    The index file now looks like this:


    <!DOCTYPE html>
    <!-- Latest compiled and minified CSS -->
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
    <!-- Optional theme -->
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap-theme.min.css">
    <!-- Latest compiled and minified JavaScript -->
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>
    <title>Login with PayPal - Demo App</title>
    <style type="text/css">
    body {
    text-align: center;
    <h1>Login with PayPal - Demo App</h1>
    <p>Welcome! No boring signup here. Just use the following button to login.</p>
    <p><span id="myContainer"></span></p>
    <script src="https://www.paypalobjects.com/js/external/api.js"></script>
    paypal.use( ["login"], function(login) {
    login.render ({
    "appid": "my-application-client-id",
    "authend": "sandbox",
    "scopes": "profile email address phone https://uri.paypal.com/services/paypalattributes",
    "containerid": "myContainer",
    "locale": "en-us",
    "returnurl": "http://sandbox.hellofrancesco.com/paypal_test/return.php"

    In this specific case, as you can see from the code, I created a button for the sandbox. However, there is nothing else you can’t understand: as I often do, I used Bootstrap via CDN to give a basic style to the page. Now, save and run the page: we can already verify that the button works great! Here’s what we will find clicking on it.

    在这种特定情况下,如您从代码中看到的,我为沙箱创建了一个按钮。 但是,您没有什么其他您无法理解的:我经常通过CDN使用Bootstrap为页面提供基本样式。 现在,保存并运行页面:我们已经可以验证该按钮是否正常工作! 这是我们将其单击的内容。


    Note: don’t worry if you don’t understand what you read. I’m italian and I use PayPal in my language, actually.

    注意:如果您不了解所读内容,请不要担心。 我是意大利人,实际上我使用的是PayPal。

    We have to implement the login after the access in the result.php file, now.


    result.php文件 (The result.php file)

    Open result.php and give it this content:


    <?php require('paypal_login.inc.php') ?>
    <!DOCTYPE html>
    <!-- Latest compiled and minified CSS -->
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
    <!-- Optional theme -->
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap-theme.min.css">
    <!-- Latest compiled and minified JavaScript -->
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>
    <title>Login with PayPal - Demo App</title>
    <style type="text/css">
    body {
    text-align: center;
    <h1>Login with PayPal - Demo App</h1>
    <p>Great! Now you are a member of our site.</p>
    <h2>Your Data</h2>
    <p><b>Name:</b> <?php echo htmlspecialchars_decode($user->given_name . ' ' . $user->family_name); ?></p>
    <p><b>Address:</b> <?php echo htmlspecialchars_decode($user->address->street_address . ', ' . $user->address->locality); ?></p>
    <p><button class="btn btn-success form-control" type="button" onclick="window.close()">Ok, done.</button></p>

    It is a simple screen with user data. We are using the $user object where all user information is stored. You will also notice that at the beginning of the file there is the inclusion of a paypal_login.inc.php file.

    这是一个包含用户数据的简单屏幕。 我们正在使用$user对象存储所有用户信息。 您还将注意到,在文件的开头,包含了paypal_login.inc.php文件。

    Create this new file now:


    // helper package autoload.
    // setting some variables here.
    $clientId = 'your-client-id';
    $clientSecret = 'your-client-secret';
    $requestData = '?grant_type=authorization_code&code='.$_GET['code'].'&return_url=http://sandbox.hellofrancesco.com/paypal_test/return.php';
    // here we exchange the authorization code with access and refresh tokens.
    $response = \Httpful\Request::get('https://api.sandbox.paypal.com/v1/identity/openidconnect/tokenservice' . $requestData)
    ->authenticateWith($clientId, $clientSecret)
    $jsonResponse = json_decode($response->raw_body);
    // checking out for errors.
    die('Error: just got some problems during operations. Try again.');
    // getting user data, using the Identity APIs.
    $response = \Httpful\Request::get('https://api.sandbox.paypal.com/v1/identity/openidconnect/userinfo/?schema=openid')
    ->authenticateWith($clientId, $clientSecret)
    // user data is here!
    $user = json_decode($response->raw_body);

    In the first section you can see the Composer autoload.php and some variable settings:

    在第一部分中,您可以看到Composer autoload.php和一些变量设置:

    • the Client ID that we received right after the application’s creation;

    • the Client Secret, obtained the same way;

    • the variable $requestData with all the information that we are going to pass to the token exchange endpoint;


    Note: in $_GET['code'] you will find the authorization code that PayPal passes to our result.php page. As this is a test application, I used the value as it is. In a real world situation don’t forget to keep everything safe at the best you can by filtering this input.

    注意:$_GET['code']您会找到PayPal传递到我们的result.php页面的授权代码。 由于这是一个测试应用程序,因此按原样使用该值。 在现实世界中,不要忘了通过过滤此输入来使一切保持最佳安全。

    Right after that you can find our first API call to the token dedicated service. As the comment also suggests, the get() method of the \Httpful\Request prepares the API call specifying what verb must be used. The syntax is really easy to understand – the chained method authenticateWith() sets up the authentication data using the Client ID and the Client Secret.

    之后,您可以找到我们对令牌专用服务的第一个API调用。 就像注释还暗示的那样, \Httpful\Requestget()方法准备API调用,指定必须使用的动词。 语法非常容易理解–链接方法authenticateWith()使用客户端ID和客户端密钥来设置身份验证数据。

    At that point, the send() method starts the call. The results are stored into the $response variable, instance of the Response class. Right after that, we take and decode the raw_body attribute. After a generic check to find possible errors, if everything is alright we can make the second API call, this time directly to the Identity API that handles the user data.

    那时, send()方法开始调用。 结果存储在$response变量中,该变量是Response类的实例。 之后,我们获取并解码raw_body属性。 经过通用检查以查找可能的错误后,如果一切正常,我们可以进行第二次API调用,这一次直接调用处理用户数据的Identity API。

    The returned object is another one of the same type as before, Response. This time, the request results are stored into a $user variable, the same that is going to be used in the result.php file that we saw before.

    返回的对象是与前面相同类型的另一个对象Response 。 这次,请求结果存储在$user变量中,该变量将在我们之前看到的result.php文件中使用。

    Our first example application is complete. We respected and implmented the entire workflow as we saw before, in the picture at the beginning of this article.

    我们的第一个示例应用程序已完成。 在本文开头的图片中,我们尊重并实现了之前所看到的整个工作流程。

    结论与考虑 (Conclusions and considerations)

    This application we just made is an extremely basic example. In a real world case, of course, you will have to implement many other things: first of all, a mechanism to store tokens in order to keep your user logged in. Also, you will have to consider making some calls to the token renewal service when it expires. You will have to use the refresh token to do it, with with this method.

    我们刚刚制作的这个应用程序是一个非常基本的示例。 当然,在实际情况下,您将必须实现许多其他事情:首先,一种存储令牌的机制以使用户保持登录状态。此外,您还必须考虑对令牌更新进行一些调用。服务到期时。 您必须使用带刷新令牌的方法来执行此操作

    We already talked about the reasons about why you should implement a similar solution on your application.


    However, one of the best tools you can use with the Log In with PayPal is the Seamless Checkout. Used togheter, those two tools will let your customer complete an order and pay for it without leaving the website.

    但是,可以与“使用PayPal登录”一起使用的最佳工具之一是Seamless Checkout 。 使用过的togheter,这两个工具将使您的客户无需离开网站即可完成订单并付款。

    The “Log In with PayPal” feature is something that you can try and evaluate, in particular if you want to give your user an experience of a deeper integration of your application with one of the best (and most used) online payment services in the world.


    Have you already tried it? What do you think? Let us know.

    你已经尝试过了吗? 你怎么看? 让我们知道

    翻译自: https://www.sitepoint.com/implement-user-log-paypal/


  • <p>I'm using PayPal sandbox for the payment gateway, this is first time I'm trying to inbuild payment gateway to my site. <p>I simply used the form tag as follows <pre><code><form target="paypal...
  • At my PayPal payment page there contain form for buyers to make payment without PayPal account. During the sandbox development, everything works fine. Now, I am using real account. The problem is, ...
  • paypal

    千次阅读 2011-10-12 18:09:08
    去年集成过paypal到网站,好多东西时间久了就会忘记的,所以我在这里转过来一篇集成paypal的文章,加在上自己做过,以后如果要用,也应该不成什么问题。 Paypal国际版网站集成简易教程(一):序言  前段时间接到...

          这里插进来介绍一下paypal sandbox,也就是沙盒,是paypal提供给开发者的一个工具,非常好用,你可以在upload/2010/6/201006111628405730.gif"
       width="1" height="1">
    asp.net 版本:
    aspx: <asp:ImageButton ID="submit" runat="server" OnClick="submit_onclick" ImageUrl="~/Flow/images/paypal.jpg" />
    protected void submit_onclick (){
    // 存储购物车的总额
    decimal amount = Convert.ToDecimal(“280.00”);
    // 存储订单ID
    string orderId = “200810240101”;
    // 获取网站的名称
    string siteName = BalloonShopConfiguration.SiteName;
    // 创建贝宝重定向的位置
    string redirect = "";
    redirect += "https://www.paypal.com/xclick/business=zmm12@126.com";
    redirect += "&item_name=" + siteName + " Order " + orderId;
    redirect += "&item_number=" + orderId;
    redirect += "&amount=" + String.Format("{0:0.00} ", amount);
    redirect += "&currency=USD";
    redirect += "&return=http://www." + siteName + ".com/这里是成功后返回的aspx页面";
    redirect += "&cancel_return=http://www." + siteName + ".com/Error.aspx";

    // 重定向到付款页面

          本文内容采用知识共享署名-非商业性使用-禁止演绎 2.5 中国大陆许可协议进行许可。
    当您收到新的付款交易或者已发生的付款交易的状态发生变化时,PayPal都将异步(即不作为网站付款流程的一部分)发送付款详细数据到您所指定的URL,以便您了解买家付款的具体情况并做出相应的响应。这个过程我们称作即时付款通知(简称 IPN)。

               新建买家帐号的时候记得在Account Balance中加上金额,不然你就没钱买东西了,如果paypal.com的帐号也能这样加钱多好。
               卖家帐号的test mode要设为enabled。
          选中business帐号,点击下面的Enter Sandbox Test Site进入sandbox Test Site,登录,就像普通Paypal帐号的管理页面一样。
               点击Profile,在Selling Preferences中选择Instant Payment Notification Preferences,点击edit加入IPN信息返回的地址,记得勾上前面那个选项,我是用.net写的接受文件,所以我的IPN地址是http://www.chenchen.org/ipn.aspx,地址只要能在互联网上访问到就可以了。
               在Profile -> Selling Preferences ->Website Payment Preferences选项中,有一个Auto Return的选项,将它设为on,并且在下面的return地址中填入你希望的客户支付完成后返回的地址:
          文件环境,.net 2.0,语言C#。
    bool VerifyIPN()
            string strFormValues = Request.Form.ToString();
            string strNewValue;
            string strResponse;
            string serverURL = "https://www.sandbox.paypal.com/cgi-bin/webscr";
            HttpWebRequest req = (HttpWebRequest)WebRequest.Create(serverURL);
            req.Method = "POST";
            req.ContentType = "application/x-www-form-urlencoded";
            strNewValue = strFormValues + "&cmd=_notify-validate";
            req.ContentLength = strNewValue.Length;
            StreamWriter stOut = new StreamWriter(req.GetRequestStream(), System.Text.Encoding.ASCII);
            StreamReader stIn = new StreamReader(req.GetResponse().GetResponseStream());
            strResponse = stIn.ReadToEnd();
            return strResponse == "VERIFIED";
    string ppTx = Request.Form["txn_id"].ToString();
    string ppStatus = Request.Form["payment_status"].ToString();
    string ppDate = Request.Form["payment_date"].ToString();
    string ppItem = Request.Form["item_name"].ToString();
    string ppPrice = Request.Form["mc_gross"].ToString();
    public partial class paypal_ipn : System.Web.UI.Page
        protected void Page_Load(object sender, EventArgs e)
            if (VerifyIPN())//验证成功
                string ppTx = Request.Form["txn_id"].ToString();//获取post中的各项变量值
        bool VerifyIPN()

          选择Test Tools -> Instant Payment Notification (IPN) Simulator:
          输入你的ipn接受文件地址,选择ipn信息的方式,然后会让你填具体信息内容,再点击Send IPN,就能模拟一个ipn到你网站的页面,可以用来测试IPN是否正常工作。
          注:可以在商家帐号的Profile -> Selling Preferences ->Website Payment Preferences中,选择Contact Telephone Number这一栏,来确定是否需要发送买家联系电话。
          这篇文章写得有些仓促,如有疑问可以发送邮件到:chenchen[at]ndwork.com  用@替换[at]。

  • PayPal支付

    2019-01-14 20:00:51
    Paypal IPN接口开发小结最近终于搞定了该死的Paypal ipn,特地在此留下点东西备忘。所以paypal ipn(Instant Payment Notification),就是Paypal开发的一种能主动通知第三方卖家系统交易状态的一种机制。IPN的原理...
  • <p>I have integrated <a href="https://github.com/srmklive/laravel-paypal" rel="nofollow noreferrer">Laravel Paypal Integration</a> and followed all the steps to integrate <code>express checkout</code>...
  • paypal支付

    2017-11-17 06:35:01
    paypal的沙箱:https://developer.paypal.com/...商家沙箱登录:https://www.sandbox.paypal.co...paypal的PHP SDK地址:http://paypal.github.io/PayPa...paypal的demo网址:https://demo.paypal.com/us...
  • 您好: 我是刚刚对接paypal支付的一名开发人员,我现在对接到paypal的自动续费,创建Agreement到跳转paypal登录页面,并且点击同意之后执行execute方法没有问题。 现在的问题是,我在创建Agreement对象的时候,我...
  • On PayPal the transactions is ok but when I try to log in with cURL to check the transaction the inital merchant/client login fails but cURL shows no error. I know that PayPal is upgrading to TLS 1.2 ...
  • paypal对接

    2018-02-09 17:10:00
    申请完毕并登录,进入https://developer.paypal.com/developer/accounts/。即可看到你申请账号自动配属的两个测试账号,账号类别分别是:BUSINESS和PERSONAL,PERSONAL的账号里面有$9999,测试费用,表激动。 下面...
  • paypal记录

    2013-11-19 14:46:57
  • 成功的在 App 中集成了 PayPal,在测试环境中,能够使用测试帐号成功登录并支付,当切换到 live 环境下时,发现无法登录,收到类似下面的信息: ————————————————————————————————...
  • Paypal支付

    千次阅读 2016-11-14 18:08:35
    立即支付 1.用户使用PayPal账户或信用卡支付,支付完成接收返回一个支付ID。 ...2.在你的服务器端,使用PayPal的...3. 登录https://developer.paypal.com,注册Sandbox测试账号(买家卖家)。 2. 集成到你的应用中,
  • Paypal测试

    千次阅读 2015-11-12 11:03:05
    PayPal测试流程 1. 下载API demo 2. 注册PayPal帐号,并认证 ...3. 登录(2.)注册的payPal帐号,在    Sandbox accounts -> Create Account  分别创建1个人付款帐号,和1个商家收款帐号
  • 又到了VPS续费的时候了,应该有不少朋友和VPS小学生一样收到IDC发来的续费邮件,在点击邮件中的续费链接后,右上角的paypal有两个选项PayPal Subscribe和PayPal Check Out,虽然都是用paypal付款,但是这其中还是有...
  • 登录/注册 管理员用户-添加/删除/修改产品 后端: 节点JS 表示 MongoDB的 JWT AccessToken && RefreshToken +仅HTTP cookie 开始 正面: cd app npm install npm start 后退: cd app/backend npm install npm run...



1 2 3 4 5 ... 20
收藏数 3,453
精华内容 1,381