如何创建加密PayNow按钮"飞"对于第三方客户使用支付宝NVP API?

问题描述:

我要飞一个网站创建加密PayNow贝宝的按钮。结果
我读了所有的文件,我可以找到PayPal网站上。结果
我明白,我需要使用BMCreateButton ButtonManager NVP API。结果
但我一直无法找到任何信息,也没有任何合理的简单记录样本code,有关如何我应该调用这些API。

I need to create Encrypted "PayNow" paypal buttons on the fly for a website.
I read all the documentation I can find on the paypal website.
I understood that I need to use the BMCreateButton ButtonManager NVP API.
But I've been unable to find any information, nor any reasonably simple and documented sample code, about HOW I'm supposed to call these API.

我需要把我的参数的形式,并张贴在某些类型的服务器?结果
我需要把所有的参数上的网址,称此网址,广告中使用的结果呢?结果
如何验证此服务?结果
我要为不同的PayPal企业账户加密paynow按钮。

Do I need to put my parameter in a form and post it on some kind of server?
Do I need to put all the parameter on an url, call this url, ad use the result?
How do I authenticate to this service?
I'm going to create encrypted paynow button for different paypal business account.

有人能告诉我一些VB.Net或C#code,实际上把这个BMCreateButton NVP API?结果
所以,我可以看到:

Can someone show me some VB.Net or C# code that actually call this BMCreateButton NVP API?
So that I can see:


  • 怎么办电话

  • 如何进行身份验证的服务

  • 如何格式化/使用API​​调用的参数

  • 如何得到的结果

各种链接,有用的资源的结果
  - 由于这个答案我已经能够找到一些有用的样本code的here 并的有了解如何调用API贝宝。结果
  - Here是关于如何贝宝API NVP作品更多有用的信息。结果
  - 这里的一个有趣的网站,生成API调用的网址为BMCreateButton API结果
  - Here你能获得第三方API证书找到指令。 (感谢这个答案)结果
  - 一些有用的信息,这里约贝宝API集成
  - Here你可以找到贝宝API的当前和最新版本号

Various link to useful resource
- Thanks to this answer I've been able to find some useful sample code here and there about how to call Paypal API.
- Here is more usefull information about how paypal NVP API works.
- Here an interesting website that generate API Call URL for the BMCreateButton API
- Here you can find instruction for obtaining "Third Party" API credentials. (thanks to this answer)
- Some more useful information here about Paypal API integration
- Here you can find the current and latest version number of the Paypal API

更新1 的结果
现在,我已经创造了一些code,实际上做一些事情,但它给我一个错误。
这code实际创建使用BMCreateButton API加密paynow按钮。
它似乎工作,但是当我点击paynow按钮时,它显示所有的支付参数,而且还显示错误
有您的安全秩序解密的问题,请联系您的商人。

Update 1
Now I've created some code that actually do something, but it give me an error. This code actually create an encrypted paynow button using the BMCreateButton API. It seem to works, but when I click the paynow button, it show all the payment parameters, but also show the error "There was a problem with the decryption of your secure order. Please contact your merchant."

这里是code

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-----MIIHwgYJKoZIhvcNAQcEoIIHszCCB68CAQExggE6MIIBNgIBADCBnjCBmDELMAkGA1UEBhMCVVMxEzARBgNVBAgTCkNhbGlmb3JuaWExETAPBgNVBAcTCFNhbiBKb3NlMRUwEwYDVQQKE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m94X2FwaTEcMBoGCSqGSIb3DQEJARYNcmVAcGF5cGFsLmNvbQIBADAJBgUrDgMCGgUAoF0wGAYJKoZIhvcNAQkDMQsGCSqGSIb3DQEHATAcBgkqhkiG9w0BCQUxDxcNMTIwNDAzMDcxMDA5WjAjBgkqhkiG9w0BCQQxFgQUl2SP4H6+jn0c8fejmdZ5IoeJcPMwDQYJKoZIhvcNAQEBBQAEgYCjmQurKhtDO2g9/qbrvaxXHVRMP54jncODgLAMbauYHALYJlk2r5k+Q3x/GAuuiaj47A0qGlPoyQ/WddHYF0R4Ffph0ocrAXLH9RC8jz2Cqx+rt/8FIa7h1OhDwIhJynJ6eIPMfzm3T0wytZa6x8GnZaOJ0MtKqOeojkZjL61feQ==-----END PKCS7-----
">
<input type="image" src="https://www.sandbox.paypal.com/en_US/i/btn/btn_buynow_LG.gif" border="0" name="submit" alt="PayPal - Il sistema di pagamento online più facile e sicuro!">
<img alt="" border="0" src="https://www.sandbox.paypal.com/it_IT/i/scr/pixel.gif" width="1" height="1">
</form>

这里是点击这个加密付费Now按钮

正如你所看到的,所有的参数(项目名称,价格,ITEM_ID ...)是正确的。
但我无法理解为什么我得到这个错误。

As you can see, all the parameters (item name, price, item_id...) are correct. But I'm unable to understand why I'm getting this error.

如果你想尝试这个code,你应该替换您的API用户名/密码/签字。生成的PayNow按钮只有当你在你的PayPal沙箱帐户登录工作。

If you want to try this code you should substitute your API user/password/signature. The generated PayNow button only works when you are logged in your paypal sandbox account.

你有关于如何解决这个错误的想法?

Do you have any idea about how to solve this error?

注意:解决这个问题后,我需要了解如何为第三贝宝企业账户创建加密按钮(我们将需要为我们的客户的贝宝账户创建加密按钮)。使用我们的API证书,客户商人code,并有我们的API证书在客户配置了PayPal账户是不是足够多的...它说,商人code是无效的。也许我失去了一些东西...

Note: after solving this issue, I'll need to understand how to create encrypted button for a third paypal business account (we will need to create encrypted button for paypal accounts of our customers). Using our API credentials, customer merchant code, and having our API credential configured up in our customers paypal account isn't enought... It say that merchant code is not valid. Probably I'm missing something...

更新2 的结果
这似乎是我找到了如何解决前面提到的错误:只要将CMD = _s-xclick / _xclick参数。如果没有指定CMD,则paynow按钮似乎不产生任何错误。更多的测试需要......反正我已经评论了code例如code线。

Update 2
It seem that I've found how to solve the aforementioned error: simply remove the "cmd=_s-xclick / _xclick" parameters. If the "cmd" is not specified, the paynow button doesn't seem to generate any error. More testing is needed... anyway I've commented the code line in the code example.

现在,还给企业。
让我们做一些测试,然后找到合适的方法来建立第三方的PayPal帐户paynow按钮。

Now, back to business. Let's do some testing, and then find the proper way to create paynow button for third party paypal accounts.

好吧,我终于得到了它! : - )

Ok, finally I got it! :-)

我的目标是创建的加密的PayNow按钮飞了一些客户。
这里是贝宝API如何与第三方接入的简要说明。

My objective is to create Encrypted PayNow buttons "on the fly" for some of our customers. Here is a brief explanation of how PayPal API works with Third-party access.


  • 创建一个PayPal帐户沙盒(这里

  • 在此沙箱帐户,创建2个新的商业帐户结果
    你应该勾这些业务账户信用卡。这标志着这些账号为验证,除非它不会工作

    • 第一个帐户(帐户A)将重新present公司

    • 第二个帐户(帐户B)将重新present我们的一个客户

    为什么这个简单和简洁的知识timewastingly分散在贝宝的帮助页面,贝宝PDF手册,以及第三方的博客文章了不知多少,超出了我的理解:-)
    反正...

    这是在VB.Net工作code

    Here is the working code in 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#

    And here is the same code in 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集成: - )

    I wish everyone a happy PayPal integration :-)

    更新(PHP codeR)的结果
    @style是要求工作PHP的例子......我不知道PHP,但我发现,可能包含有用信息的PHP codeR一些链接,:你可以看看这些源文件里面BMCreateButton API:

    Update (for PHP coder)
    @Style is asking for a working PHP example... I don't know PHP, but I've found some links that may contain useful information for PHP coder,: you can look for BMCreateButton api inside these source files:

    • 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