如何使用 Paypal NVP API 为第三方客户“即时”创建加密的 PayNow 按钮?

Posted

技术标签:

【中文标题】如何使用 Paypal NVP API 为第三方客户“即时”创建加密的 PayNow 按钮?【英文标题】:How to create Encrypted PayNow button "on the fly" for Third-party customers, using Paypal NVP API? 【发布时间】:2012-04-13 23:03:24 【问题描述】:

我需要为网站即时创建加密的“PayNow”贝宝按钮。 我阅读了我可以在 paypal 网站上找到的所有文档。 我知道我需要使用 BMCreateButton ButtonManager NVP API。 但是我一直找不到任何信息,也找不到任何相当简单和记录在案的示例代码,关于我应该如何调用这些 API。

我是否需要将我的参数放入表单中并将其发布到某种服务器上? 我是否需要将所有参数放在一个 url 上,调用这个 url,广告使用结果? 如何对此服务进行身份验证? 我将为不同的 paypal 企业帐户创建加密的 paynow 按钮。

谁能告诉我一些实际调用此 BMCreateButton NVP API 的 VB.Net 或 C# 代码? 这样我就可以看到:

如何拨打电话 如何对服务进行身份验证 如何格式化/使用 API 调用的参数 如何获得结果

各种有用资源的链接 - 感谢this answer,我找到了一些有用的示例代码here 和there,了解如何调用Paypal API。 - Here 是有关 paypal NVP API 工作原理的更有用信息。 - Here 一个为 BMCreateButton API 生成 API 调用 URL 的有趣网站 - Here 您可以找到获取“第三方”API 凭证的说明。 (感谢this answer) - 关于 Paypal API 集成的更多有用信息here - Here你可以找到Paypal API的当前和最新版本号

更新 1 现在我已经创建了一些实际做某事的代码,但它给了我一个错误。 此代码实际上使用 BMCreateButton API 创建了一个加密的 paynow 按钮。 它似乎有效,但是当我单击 paynow 按钮时,它会显示所有付款参数,但也会显示错误 “您的安全订单的解密出现问题。请联系您的商家。”

代码如下

Public Shared Sub PaypalTest3web()

    Dim NVP As New Dictionary(Of String, String)

    Dim strUsername As String = "aso_1273063882_biz_api3.megatesto.it"
    Dim strPassword As String = "1273063582"
    Dim strSignature As String = "A22sd7623RGUsduDHDSFU57N7dfhfS23DUYVhdf85du8S6FJ6D5bfoh5"

    Dim strNVPSandboxServer As String = "https://api-3t.sandbox.paypal.com/nvp"


    NVP.Add("USER", strUsername)
    NVP.Add("PWD", strPassword)
    NVP.Add("SIGNATURE", strSignature)


    Dim bvCount As Integer
    bvCount = 0

    NVP.Add("METHOD", "BMCreateButton")
    NVP.Add("VERSION", "85.0")

    NVP.Add("BUTTONCODE", "ENCRYPTED")    ''CLEARTEXT / ENCRYPTED
    NVP.Add("BUTTONTYPE", "BUYNOW")
    NVP.Add("BUTTONSUBTYPE", "PRODUCTS")  ''Optional: PRODUCTS / SERVICES

    bvCount = bvCount + 1 : NVP.Add("L_BUTTONVAR" & bvCount, "business=D64TG758HIWj2") ''Merchant ID

    'bvCount = bvCount + 1 : NVP.Add("L_BUTTONVAR" & bvCount, "cmd=_s-xclick")  ''DONT SPECIFY the cmd parameter, if specifien it will generate an error on the decription of the "secure order", I don't know why...
    bvCount = bvCount + 1 : NVP.Add("L_BUTTONVAR" & bvCount, "lc=IT")
    bvCount = bvCount + 1 : NVP.Add("L_BUTTONVAR" & bvCount, "button_subtype=PRODUCTS")
    bvCount = bvCount + 1 : NVP.Add("L_BUTTONVAR" & bvCount, "item_name=Test_product")
    bvCount = bvCount + 1 : NVP.Add("L_BUTTONVAR" & bvCount, "item_number=123456")
    bvCount = bvCount + 1 : NVP.Add("L_BUTTONVAR" & bvCount, "amount=12.00")
    bvCount = bvCount + 1 : NVP.Add("L_BUTTONVAR" & bvCount, "currency_code=EUR")
    bvCount = bvCount + 1 : NVP.Add("L_BUTTONVAR" & bvCount, "quantity=1")

    ''build the parameter string
    Dim paramBuilder As New StringBuilder
    For Each kv As KeyValuePair(Of String, String) In NVP
        Dim st As String
        st = kv.Key & "=" & HttpUtility.UrlEncode(kv.Value) & "&"
        paramBuilder.Append(st)
    Next

    Dim param As String
    param = paramBuilder.ToString
    param = param.Substring(0, param.Length - 1) 'remove the last '&'

    'Create web request and web response objects, make sure you using the correct server (sandbox/live)
    Dim wrWebRequest As HttpWebRequest = DirectCast(WebRequest.Create(strNVPSandboxServer), HttpWebRequest)
    wrWebRequest.Method = "POST"

    Dim requestWriter As New StreamWriter(wrWebRequest.GetRequestStream())
    requestWriter.Write(param)
    requestWriter.Close()

    '' Get the response.
    Dim responseReader As StreamReader
    responseReader = New StreamReader(wrWebRequest.GetResponse().GetResponseStream())

    ''and read the response
    Dim responseData As String
    responseData = responseReader.ReadToEnd()
    responseReader.Close()

    ''url-decode the results
    Dim result As String
    result = HttpUtility.UrlDecode(responseData)

    Dim formattedResult As String

    formattedResult = "Request on " & strNVPSandboxServer & vbCrLf &
                     HttpUtility.UrlDecode(param.Replace("&", vbCrLf & "  ")) & vbCrLf & vbCrLf &
                     "Result:" & vbCrLf & result & vbCrLf & vbCrLf &
                     "--------------------------------------" & vbCrLf



    ''show the results
    Trace.WriteLine(result)
    MessageBox.Show(result)
End Sub

这是 HTML 响应

<form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_s-xclick">
<input type="hidden" name="encrypted" value="-----BEGIN PKCS7-----MIIHwgYJKoZIhvcNAQcEoIIHszCCB68CAQExggE6MIIBNgIBADCBnjCBmDELMAkGA1UEBhMCVVMxEzARBgNVBAgTCkNhbGlmb3JuaWExETAPBgNVBAcTCFNhbiBKb3NlMRUwEwYDVQQKEwxQYXlQYWwsIEluYy4xFjAUBgNVBAsUDXNhbmRib3hfY2VydHMxFDASBgNVBAMUC3NhbmRib3hfYXBpMRwwGgYJKoZIhvcNAQkBFg1yZUBwYXlwYWwuY29tAgEAMA0GCSqGSIb3DQEBAQUABIGAi72cfj/XbJRIGhu2IL7LzSoXP4TBUezxk5jDGfTpab9ygOQSeW4GeuHE7VpM33Tc+jyJHg7kyusn8PUeA6ZNquFwqMA0i3wVBWPhlEFPn15Xwn3SglgWP4yAXxHmXnid5hy9rQXJbqQvO9OQbapja2L5V8eIEfLhjP+Iaq+nrn4xCzAJBgUrDgMCGgUAMIIBDAYJKoZIhvcNAQcBMBQGCCqGSIb3DQMHBAgpl56+2FJbVYCB6A+/oYjbTs5Q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S7-----
">
<input type="image" src="https://www.sandbox.paypal.com/en_US/i/btn/btn_buynow_LG.gif" border="0" name="submit" >
<img  border="0" src="https://www.sandbox.paypal.com/it_IT/i/scr/pixel.gif"  >
</form>

这是我点击这个加密的立即付款按钮后出现的错误

如您所见,所有参数(商品名称、价格、商品 ID...)都是正确的。 但我无法理解为什么会出现此错误。

如果您想尝试此代码,您应该替换您的 API 用户/密码/签名。生成的 PayNow 按钮仅在您登录到您的 paypal 沙盒帐户时才有效。

你知道如何解决这个错误吗?

注意:解决了这个问题后,我需要了解如何为第三个 paypal 企业帐户创建加密按钮(我们需要为客户的 paypal 帐户创建加密按钮)。使用我们的 API 凭证、客户商家代码并在我们的客户 paypal 帐户中配置我们的 API 凭证是不够的……它说商家代码无效。可能我错过了什么......

更新 2 看来我已经找到了解决上述错误的方法:只需删除“cmd=_s-xclick / _xclick”参数即可。如果未指定“cmd”,则 paynow 按钮似乎不会产生任何错误。需要更多的测试......无论如何我已经在代码示例中注释了代码行。

现在,回到正题。 让我们做一些测试,然后找到为第三方贝宝帐户创建 paynow 按钮的正确方法。

【问题讨论】:

嗨,Max,在另一个 SO 问题之后,如果没有其他人的话,我会在今天晚些时候为您研究这个问题。 @lethalMango:非常感谢,非常感谢您的帮助 @lethalMango 终于找到了解决方案 :-) 很抱歉没有机会回复您,这几天工作很忙。很高兴你把它整理好了:) @lethalMango 没问题 :) 感谢您的关注 【参考方案1】:

好的,我终于明白了! :-)

我的目标是为我们的一些客户“即时”创建加密 PayNow 按钮。 以下是 PayPal API 如何与第三方访问一起工作的简要说明。

创建一个 Paypal 沙盒帐户 (here) 在此沙盒帐户中,创建 2 个新的企业帐户您应该将这些企业帐户与信用卡挂钩。这会将这些帐户标记为“已验证”,除非它不起作用 第一个帐户(帐户 A)将代表我们公司 第二个帐户(帐户 B)将代表我们的一位客户 登录账户 A,并请求 API 凭据 (instructions here) 登录账户 B,并授予账户 A API 权限(instruction here 检查段落“第三方身份验证:授予您的购物车相应的 API 身份验证权限”) 获取账户 A 的 Api 凭据,并将其放入您的源代码中 获取账户 B 的商户 ID 和商户邮箱并将其放入您的源代码中 运行代码 获取返回的 html,将其放在网页上,并对其进行测试,它应该可以工作(您需要登录您的 paypal 沙盒帐户,否则生成的按钮将不起作用)

为什么这些简单明了的知识会浪费时间分散在无数的 PayPal 帮助页面、PayPal PDF 手册和第三方博客文章中,这超出了我的理解 :-) 总之……

这是 VB.Net 中的工作代码

Public Shared Sub PaypalThirdPartyPayNowButtonTest()
    Dim bvCount As Integer = 0  ''L_BUTTONVAR counter
    Dim NVP As New Dictionary(Of String, String)  ''Api Name-Value-Pair parameters

    ''define paypal SANDBOX server
    Dim paypalApiServerUrl As String = "https://api-3t.sandbox.paypal.com/nvp"

    ''define Api credentials of YOUR business paypal account 
    Dim yourApiUsername As String = "aso_1273063882_biz_api3.megatesto.it"
    Dim yourApiPassword As String = "1273063582"
    Dim yourApiSignature As String = "A22sd7623RGUsduDHDSFU57N7dfhfS23DUYVhdf85du8S6FJ6D5bfoh5"

    ''define Your CUSTOMER identification data
    Dim customerEmailID As String = "MyCustomer_143363961_biz@megatesto.it"
    Dim customerMerchantID As String = "3S4EF7BI96YHS"


    ''use YOUR identification data
    NVP.Add("USER", yourApiUsername)
    NVP.Add("PWD", yourApiPassword)
    NVP.Add("SIGNATURE", yourApiSignature)

    ''use your CUSTOMER identification data
    NVP.Add("SUBJECT", customerEmailID)
    bvCount = bvCount + 1 : NVP.Add("L_BUTTONVAR" & bvCount, "business=" & customerMerchantID) ''Merchant ID


    ''Api method name and version
    NVP.Add("METHOD", "BMCreateButton")
    NVP.Add("VERSION", "85.0")

    ''method specific parameters
    NVP.Add("BUTTONCODE", "ENCRYPTED")
    NVP.Add("BUTTONTYPE", "BUYNOW")
    NVP.Add("BUTTONSUBTYPE", "PRODUCTS")

    ''Buynow button specific parameters
    bvCount = bvCount + 1 : NVP.Add("L_BUTTONVAR" & bvCount, "lc=IT")
    bvCount = bvCount + 1 : NVP.Add("L_BUTTONVAR" & bvCount, "button_subtype=PRODUCTS")
    bvCount = bvCount + 1 : NVP.Add("L_BUTTONVAR" & bvCount, "item_name=Test_product")
    bvCount = bvCount + 1 : NVP.Add("L_BUTTONVAR" & bvCount, "item_number=123456")
    bvCount = bvCount + 1 : NVP.Add("L_BUTTONVAR" & bvCount, "amount=12.00")
    bvCount = bvCount + 1 : NVP.Add("L_BUTTONVAR" & bvCount, "currency_code=EUR")
    bvCount = bvCount + 1 : NVP.Add("L_BUTTONVAR" & bvCount, "quantity=1")
    ''bvCount = bvCount + 1 : NVP.Add("L_BUTTONVAR" & bvCount, "cmd=_s-xclick")  'DONT' specify the cmd parameter, if you specify it, it wont work, paypal will give you an error

    ''build the parameter string
    Dim paramBuilder As New StringBuilder
    For Each kv As KeyValuePair(Of String, String) In NVP
        Dim st As String
        st = kv.Key & "=" & HttpUtility.UrlEncode(kv.Value) & "&"
        paramBuilder.Append(st)
    Next

    Dim param As String
    param = paramBuilder.ToString
    param = param.Substring(0, param.Length - 1) ''remove the last '&'


    ''Create web request and web response objects, make sure you using the correct server (sandbox/live)
    Dim wrWebRequest As HttpWebRequest = DirectCast(WebRequest.Create(paypalApiServerUrl), HttpWebRequest)
    wrWebRequest.Method = "POST"


    Dim requestWriter As New StreamWriter(wrWebRequest.GetRequestStream())
    requestWriter.Write(param)
    requestWriter.Close()

    '' Get the responseReader
    Dim responseReader As StreamReader
    responseReader = New StreamReader(wrWebRequest.GetResponse().GetResponseStream())

    ''read the response
    Dim responseData As String
    responseData = responseReader.ReadToEnd()
    responseReader.Close()


    ''url-decode the results
    Dim result As String
    result = HttpUtility.UrlDecode(responseData)

    Dim formattedResult As String

    formattedResult = "Request on " & paypalApiServerUrl & vbCrLf &
                     HttpUtility.UrlDecode(param.Replace("&", vbCrLf & "  ")) & vbCrLf & vbCrLf &
                     "Result:" & vbCrLf & HttpUtility.UrlDecode(responseData.Replace("&", vbCrLf & "  ")) & vbCrLf & vbCrLf &
                     "--------------------------------------" & vbCrLf

    ''show the results
    Trace.WriteLine(formattedResult)
    MessageBox.Show(formattedResult)
End Sub

这是 C# 中的相同代码

public static void PaypalThirdPartyPayNowButtonTest()

    int bvCount = 0; //L_BUTTONVAR counter
    Dictionary<string, string> NVP = new Dictionary<string, string>(); //Api Name-Value-Pair parameters

    //paypal SANDBOX server
    string paypalApiServerUrl = "https://api-3t.sandbox.paypal.com/nvp";

    //Api credentials of YOUR business paypal account 
    string yourApiUsername = "aso_1273063882_biz_api3.megatesto.it";
    string yourApiPassword = "1273063582";
    string yourApiSignature = "A22sd7623RGUsduDHDSFU57N7dfhfS23DUYVhdf85du8S6FJ6D5bfoh5";

    //Your CUSTOMER identification data
    string customerEmailID = "MyCustomer_143363961_biz@megatesto.it";
    string customerMerchantID = "3S4EF7BI96YHS";

    //use YOUR identification data
    NVP.Add("USER", yourApiUsername);
    NVP.Add("PWD", yourApiPassword);
    NVP.Add("SIGNATURE", yourApiSignature);

    //use your CUSTOMER identification data
    NVP.Add("SUBJECT", customerEmailID);
    bvCount++; NVP.Add("L_BUTTONVAR" + bvCount.ToString() , "business=" + customerMerchantID);

    //Api method name and version
    NVP.Add("METHOD", "BMCreateButton");
    NVP.Add("VERSION", "85.0");

    //method specific parameters
    NVP.Add("BUTTONCODE", "ENCRYPTED");
    NVP.Add("BUTTONTYPE", "BUYNOW");
    NVP.Add("BUTTONSUBTYPE", "PRODUCTS");

    //Buynow button specific parameters
    bvCount++; NVP.Add("L_BUTTONVAR" + bvCount.ToString() , "lc=IT");
    bvCount++; NVP.Add("L_BUTTONVAR" + bvCount.ToString() , "button_subtype=PRODUCTS");
    bvCount++; NVP.Add("L_BUTTONVAR" + bvCount.ToString() , "item_name=Test_product");
    bvCount++; NVP.Add("L_BUTTONVAR" + bvCount.ToString() , "item_number=123456");
    bvCount++; NVP.Add("L_BUTTONVAR" + bvCount.ToString() , "amount=12.00");
    bvCount++; NVP.Add("L_BUTTONVAR" + bvCount.ToString() , "currency_code=EUR");
    bvCount++; NVP.Add("L_BUTTONVAR" + bvCount.ToString() , "quantity=1");
    //bvCount = bvCount + 1 : NVP.Add("L_BUTTONVAR" & bvCount, "cmd=_s-xclick")  //DON'T specify the cmd parameter, if you specify it, it wont work, paypal will give you an error


    //build the parameter string
    StringBuilder paramBuilder = new StringBuilder();
    foreach (KeyValuePair<string, string> kv in NVP)
    
        string st = kv.Key + "=" + System.Web.HttpUtility.UrlEncode(kv.Value) + "&";
        paramBuilder.Append(st);
    

    string param = paramBuilder.ToString();
    param = param.Substring(0, param.Length - 1); //remove the last '&'


    //Create web request and web response objects, make sure you using the correct server (sandbox/live)
    System.Net.HttpWebRequest wrWebRequest = (System.Net.HttpWebRequest)System.Net.WebRequest.Create(paypalApiServerUrl);
    wrWebRequest.Method = "POST";

    System.IO.StreamWriter requestWriter = new System.IO.StreamWriter(wrWebRequest.GetRequestStream());
    requestWriter.Write(param);
    requestWriter.Close();


    //Get the responseReader
    System.IO.StreamReader responseReader = new System.IO.StreamReader(wrWebRequest.GetResponse().GetResponseStream());
    string responseData = responseReader.ReadToEnd();
    responseReader.Close();

    //url-decode the results
    string result = System.Web.HttpUtility.UrlDecode(responseData);

    string formattedResult = "Request on " + paypalApiServerUrl + "\r\n" + System.Web.HttpUtility.UrlDecode(param.Replace("&", "\r\n  ")) + "\r\n\r\nResult:\r\n" + System.Web.HttpUtility.UrlDecode(responseData.Replace("&", "\r\n  ")) + "\r\n\r\n--------------------------------------\r\n";

    //show the results
    System.Diagnostics.Trace.WriteLine(formattedResult);
    System.Windows.Forms.MessageBox.Show(formattedResult);

祝大家 PayPal 集成愉快 :-)

更新(针对 php 编码器) @Style 要求提供一个有效的 PHP 示例...我不了解 PHP,但我发现了一些可能包含对 PHP 编码器有用信息的链接:您可以在这些源文件中查找 BMCreateButton api:

PayPal "Authorization Failed" Working example of paypal Website Payments Pro Hosted Solution Iframe? http://code.google.com/p/my-project-phi/source/browse/trunk/Application/Services/PayPalService.php?r=61 http://plugins.svn.wordpress.org/stageshow/tags/1.1.4/include/mjslib_paypal_api.php http://plugins.svn.wordpress.org/stageshow/trunk/include/mjslib_paypal_api.php http://my-project-phi.googlecode.com/svn-history/r61/trunk/Application/Services/PayPalService.php

【讨论】:

您提供的代码示例几乎对我有用 - 我已将版本从 85 更改为 65.2 以使其正常工作。 @Max 从哪里可以找到我的 ApiSignature @79IT 看看这里bryan.it/2011/07/guida-api-signature-paypal 是意大利语,但截图看起来很清楚 @79IT 这是英文版developer.paypal.com/docs/classic/api/apiCredentials 也在这里streamingvideoprovider.co.uk/kb/index.php/article/… @Max 我在询问沙盒,但我读到 sandbox.paypal.com 不需要签名

以上是关于如何使用 Paypal NVP API 为第三方客户“即时”创建加密的 PayNow 按钮?的主要内容,如果未能解决你的问题,请参考以下文章

PayPal NVP API SetExpressCheckout ALLOWNOTE 不起作用

PayPal NVP API:创建定期付款

Paypal Refund NVP API : 您无权退款此交易

Paypal API NVP 将运费添加到每月付款计划

是否有一个等效的 REST API 函数来获取 Paypal 帐户的余额,类似于 NVP 获取余额 API? [关闭]

经典 API NVP 交易详情调用中未抓取来自 PayPal 按钮支付的文本字段数据