简体   繁体   English

PayPal文档(REST,Classic:SOAP和NVP)选择什么?

[英]PayPal documentation ( REST, Classic : SOAP & NVP ) What to choose ?

I need to develop a payment solution using PayPal APIs. 我需要使用PayPal API开发支付解决方案。 Actually I started the documentation phase ( on http://developers.paypal.com ) 实际上我开始了文档阶段(在http://developers.paypal.com上

I found the REST APIs understandable, I still don't have an idea how to implement them with SpringMVC so I'm just using cURL to test them. 我发现REST API可以理解,我仍然不知道如何使用SpringMVC实现它们,所以我只是使用cURL来测试它们。 ( any help on this ? ) (对此有何帮助?)

On the other hand, the Classic APIs are confusing. 另一方面,Classic API令人困惑。 ( for example what can we do with the Adaptive Accounts and what's the difference between Express Checkout and Adaptive Payments, etc.. ). (例如,我们可以使用自适应帐户做什么以及Express Checkout和自适应付款之间的区别等等。)。

Another thing, is that we need to choose between creating a hidden form ( html ) or using APIs. 另一件事是,我们需要在创建隐藏表单(html)或使用API​​之间进行选择。 ( I need explanation ) (我需要解释)

The documentation is very long and I'm really confused, I don't know what to choose ( obviously the REST APIs are better for simple payments, but I really want to know more about the SOAP & NVP .. ) 文档很长,我真的很困惑,我不知道该选择什么(很明显REST API更适合简单付款,但我真的想了解更多关于SOAPNVP ......)

I'm novice, s can someone be a volunteer and help me on this ? 我是新手,有人可以成为志愿者并帮助我吗?

Thank you ! 谢谢 !

Having done the PayPal-integration-dance a couple of times (albeit a few years ago now) let me summarize my thoughts (and bear in mind, things may have changed slightly) 几次完成PayPal-integration-dance舞蹈(虽然几年前)让我总结一下我的想法(并记住,事情可能略有改变)

The reason for PayPal's profusion of APIs/integration methods is due to the vast array of places they want to be able to sting you for support payment from: PayPal丰富的API /集成方法的原因是他们希望能够通过以下方式 激励您 支持支付的大量地方:

  • If all you have is a blog, static-HTML-hosting, off-the-shelf eCommerce site or some other "primitive" web technology, submitting hidden HTML forms is pretty-much your only option. 如果您拥有的只是博客,静态HTML托管,现成的电子商务网站或其他一些“原始”网络技术,那么提交隐藏的HTML表单几乎是您唯一的选择。 I suspect this is the original mechanism PayPal used, and while they have to keep supporting it forever , you wouldn't want to use this approach today from a modern web framework like SpringMVC. 怀疑这是PayPal使用的原始机制,虽然他们必须永远支持它,但你现在不希望从像SpringMVC这样的现代Web框架中使用这种方法。

  • The NVP API is another longstanding integration scheme which was appropriate at a time when effectively stitching together parameters into a URL was all your clients could do. NVP API是另一种长期的集成方案,适用于将参数有效拼接到URL中的所有客户端都可以执行的操作。 There's no great reason to use this API these days when the REST JSON API is available - most people find JSON much easier to read than URL-encoded parameters. 现在,当REST JSON API可用时,没有什么理由可以使用这个API - 大多数人发现JSON比URL编码参数更容易阅读。

  • Chronologically introduced next I suspect, the SOAP API reflects a time when XML was going to rule the world. 接下来我怀疑,按时间顺序介绍, SOAP API反映了XML统治世界的时间。 In some (very strict and/or traditional) places, it still does. 在一些(非常严格和/或传统)的地方,它仍然存在。 Again, these days, you probably wouldn't go down this path if you have a choice - usage with Java generally involves tight integration with a SOAP Framework like Apache CXF and mountains of machine-generated .java files. 现在,如果您有选择的话,您可能不会走这条路 - 使用Java通常需要与Apache CXF和大量机器生成的.java文件等SOAP框架紧密集成。

  • The REST API is the most modern and (IMHO) nicest to use from Java-land, and is the option I recommend. REST API是最现代化的(恕我直言)最好用的Java-land,是我推荐的选项。 It's looks like it's what PayPal would prefer you to use too, so it's what I will spend the rest of this answer talking about. 它看起来就像是PayPal更喜欢你使用的东西,所以我会用这个答案的其余部分来讨论。

As a Java developer, when you select the REST API you get a further choice of either using PayPal's SDK or rolling your own integration scheme. 作为Java开发人员,当您选择REST API时,您可以选择使用PayPal的SDK或滚动自己的集成方案。 Consider using the SDK if: 在以下情况下考虑使用SDK:

  • You can foresee your PayPal integration becoming very large and/or using advanced API features 您可以预见您的PayPal集成变得非常大和/或使用高级API功能

  • You don't have any other HTTP integration points and so don't already have infrastructure for calling HTTP methods from your code (eg Apache HttpClient or the RestTemplate functionality built into Spring 3 ) 您没有任何其他HTTP集成点,因此还没有用于从代码中调用HTTP方法的基础结构(例如Apache HttpClient或Spring 3中内置的RestTemplate功能)

  • You don't have (or don't want to have) a JSON parser available 您没有(或者不想拥有)可用的JSON解析器

As you've already been using the API via cURL and you understand the calls and their sequencing, you're probably undecided about this. 由于您已经通过cURL使用了API,并且您了解了调用及其顺序,因此您可能尚未对此做出决定。 If you're not under too much time pressure, I'd recommend going down the roll-your-own path using (and learning) Apache HttpClient together with a JSON library like Jackson - they are valuable tools in your arsenal and you'll almost certainly use them again in future integrations. 如果你没有太大的时间压力,我建议你使用(和学习) Apache HttpClient以及像杰克逊这样的JSON库来实现自己的路径 - 它们是你工具库中的宝贵工具,你会几乎可以肯定在未来的集成中再次使用它们。

One other development tip, which applies to either REST API option - if you use a "stub server" such as this one to simulate PayPal's end of the connection, it'll log the details of every request it receives and respond appropriately. 另外一个发展尖端,它适用于任何REST API选项-如果你使用一个“存根服务器”,比如这一个模拟连接的PayPal的结束,每一个请求它接收并做出适当的反应,它会记录详细信息。 This can be a godsend for debugging exactly what is going out "over the wire" and/or testing things repeatedly. 这可能是一个天赐,用于调试“通过电线”和/或反复测试的内容。

The REST API is fairly new and not as feature laden as Classic. REST API相当新,并不像Classic那样充满功能。 I still recommend Classic as there's nothing wrong or obsolete with it. 我仍然推荐Classic,因为它没有任何错误或过时。 PayPal wanted to run with the cool kids like Facebook and so they made an oauth API (I suspect it was easier for mobile but you can just as easily implement another API as well.). PayPal希望与像Facebook这样的酷孩子一起运行,因此他们制作了一个oauth API(我怀疑它对移动设备来说更容易,但你也可以轻松实现另一个API。)。

Classic NVP (Name Value Pairs) is easy to understand and one of the best documented I've worked with. 经典NVP(名称值对)很容易理解,也是我工作过的最好的文档之一。 Your calls are all query strings you POST to the API endpoint. 您的调用是您发布到API端点的所有查询字符串。

METHOD=DoDirectPayment&AMT=1.00&EXPDATE=012015

I would not go the SOAP route unless you sleep under a blanket with WSDL printed on it. 我不会去SOAP路线,除非你睡在毯子上,上面印有WSDL。 SOAP is just a pain to understand and work with. SOAP只是一种理解和使用的痛苦。

Classic supports several calls REST still does not (MassPay, Buttons API, most Adaptive calls, etc). Classic支持REST仍然没有的几个调用(MassPay,Buttons API,大多数自适应调用等)。 I expect PayPal will catch up eventually but, for now, Classic is the only option there for some features. 我预计PayPal最终会迎头赶上,但就目前来说,Classic是一些功能的唯一选择。

As to all the calls out there 至于那里的所有电话

  • DoDirectPayment - Directly process a credit card. DoDirectPayment - 直接处理信用卡。 Requires a subscription to Payments Pro to use but is a full featured card processing system 需要订阅Payments Pro才能使用,但它是一个全功能的卡处理系统
  • Express Checkout - Free to use. 快速结账 - 免费使用。 Allows you to accept PayPal accounts as a form of payment. 允许您接受PayPal帐户作为付款方式。 Basically you call the API, get a token, redirect the user, they log in, PayPal redirects to you and then you use the token to get paid. 基本上你调用API,获取令牌,重定向用户,他们登录,PayPal重定向到你,然后你使用令牌来获得报酬。
  • Adaptive Payments - This is where you can do some interesting things to make creative payment systems. 自适应付款 - 您可以在这里制作一些有趣的东西来制作创意付款系统。 Say you have a third party you run cards for but you want a cut of their sales. 假设您有第三方为您开卡,但您希望减少销售额。 Chained Payments do that. 链式支付就是这样做的。

The largest difference in the HTML Payments Standard solution and the API is that with the API you have to be PCI compliant. HTML Payments标准解决方案和API的最大区别在于,使用API​​时,您必须符合PCI标准。 Mostly that means you don't log sensitive data (like CVV2), have security on your site and you have an SSL certificate but there could be other requirements placed on you down the road. 大多数情况下,这意味着您不会记录敏感数据(如CVV2),在您的网站上拥有安全性,并且您拥有SSL证书,但可能会有其他要求。 The upside is you have complete control over the process. 好处是你可以完全控制这个过程。 Payments Standard affords you no control but you have no PCI compliance either. 付款标准为您提供无法控制,但您也没有PCI合规性。

Well I have been reading most of the PayPal Classic APIs 好吧,我一直在阅读大部分PayPal Classic API

In my humble undestanding : I can say that Express Checkout is a part of Adaptive Payments ( in Adaptive Payments, customers have the possibility to log in with PayPal and pay an item so they don't need to put their shipping address, credit card details, etc because they are already recorded on their PayPal account ) Actually, I have some notes to tell : 在我的谦逊未成年人中:我可以说Express Checkout是自适应支付的一部分(在自适应支付中,客户可以使用PayPal登录并支付项目,因此他们无需提供他们的送货地址,信用卡详细信息等,因为它们已经记录在他们的PayPal账户上)实际上,我有一些注意事项:

  • Mass Payments allows you to send money to multiple accounts & Adaptive Payments does the same, so what is the difference between them ? 批量付款允许您向多个帐户汇款,而自适应付款也是如此,那么它们之间的区别是什么? ( the chained feature maybe ? ) (链接的功能可能吗?)
  • About the Invocing API : at what moment of the payment process customers can see it ? 关于Invocing API:客户可以在付款流程的哪一刻看到它? ( before payment confirmtion ? ), I still don't know its usefulness.. (在付款确认之前?),我仍然不知道它的用处..

Finally, I have to tell you that my boss wants to develop a payment solution without the log in with PayPal feature ( in other words, he wants customers fill out directly their bank/credit cards details, we won't need shipping information since we are selling digitals goods ) so I think the best solution to choose will be the Adaptive Payments API ( We have to consider the fact that we are a non US developers ) 最后,我必须告诉你,我的老板想要开发一个付款解决方案,而无需登录PayPal功能(换句话说,他希望客户直接填写他们的银行/信用卡详细信息,我们不需要发货信息,因为我们正在销售数字商品)所以我认为最好的解决方案是自适应支付API(我们必须考虑到我们是非美国开发商的事实)

What do you think ? 你怎么看 ?

自2017年1月起,NVP和S​​OAP方法现已弃用.https://developer.paypal.com/docs/classic/express-checkout/

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

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