使用SOAP实现快速结账(PayPal)

时间:2022-10-14 15:10:46

So, here's my challenge: I have to build a webservice which handles payments using PayPal... The SOAP way! Since I'm a Node developer I'm very familiar with REST but the challenge is that I have to build it with Java, XML-schemas and SOAP using the Spring-framework. Now I found this workflow when using REST: https://devtools-paypal.com/guide/pay_paypal/java?interactive=ON&env=sandbox. That looks easy as pie to me! But what would this workflow look like when using SOAP and how would you implement this. As in: How do you handle redirects and responseURLs? Or is the workflow different?

所以,这是我的挑战:我必须构建一个使用PayPal处理付款的Web服务...... SOAP方式!由于我是Node开发人员,我对REST非常熟悉,但挑战在于我必须使用Spring-framework使用Java,XML-schemas和SOAP构建它。现在我在使用REST时找到了这个工作流程:https://devtools-paypal.com/guide/pay_paypal/java?interactive = ON&env = andbox。对我来说这看起来很简单!但是这个工作流程在使用SOAP时会是什么样子,你会如何实现呢?如:你如何处理重定向和responseURL?或者工作流程有何不同?

P.S. I know PayPal has lots and lots of documentation but when it comes to SOAP, I just can't figure out the workflow or how to handle responseURLs..

附:我知道PayPal有很多很多文档,但是当涉及到SOAP时,我无法弄清楚工作流程或如何处理responseURLs。

Thnx in advance!

Thnx提前!

1 个解决方案

#1


1  

I'm going to assume you want to implement Express Checkout.

我假设您要实施Express Checkout。

The flow is basically the same, different endpoints, but same steps. You can see the workflow here: https://developer.paypal.com/docs/classic/express-checkout/ht_ec-singleItemPayment-curl-etc/

流程基本相同,端点不同,但步骤相同。您可以在此处查看工作流程:https://developer.paypal.com/docs/classic/express-checkout/ht_ec-singleItemPayment-curl-etc/

Just reference the diagram. Everything below isn't specific to SOAP.

只需参考图表。以下所有内容并非特定于SOAP。

In brief, the flow looks like this:

简而言之,流程如下所示:

1: Call SetExpressCheckout to get back a token.

2: Redirect to PayPal using token obtained in step 1.

3. If user accepts checkout then call GetExpressCheckoutDetails to get transaction details.

4. Use Token and PayerID (obtained in step 3) in call to DoExpressCheckoutPayment to capture payment.

Here's a good place to start: https://developer.paypal.com/docs/classic/api/#ec

这是一个很好的起点:https://developer.paypal.com/docs/classic/api/#ec

The first snag I ran into when implementing the SOAP API versus the REST API was that I couldn't find anywhere in the documentation where to find the redirect URL. The REST API will send it back, the SOAP does not. I had to dig through some of the SDK files to find it.

我在实现SOAP API与REST API时遇到的第一个问题是,我在文档的任何地方都找不到查找重定向URL的位置。 REST API会将其发回,而SOAP则不会。我不得不深入研究一些SDK文件来找到它。

Redirect to here: https://www.sandbox.paypal.com/webscr?cmd=_express-checkout&token=

重定向到这里:https://www.sandbox.paypal.com/webscr?cmd = _express-checkout&token =

#1


1  

I'm going to assume you want to implement Express Checkout.

我假设您要实施Express Checkout。

The flow is basically the same, different endpoints, but same steps. You can see the workflow here: https://developer.paypal.com/docs/classic/express-checkout/ht_ec-singleItemPayment-curl-etc/

流程基本相同,端点不同,但步骤相同。您可以在此处查看工作流程:https://developer.paypal.com/docs/classic/express-checkout/ht_ec-singleItemPayment-curl-etc/

Just reference the diagram. Everything below isn't specific to SOAP.

只需参考图表。以下所有内容并非特定于SOAP。

In brief, the flow looks like this:

简而言之,流程如下所示:

1: Call SetExpressCheckout to get back a token.

2: Redirect to PayPal using token obtained in step 1.

3. If user accepts checkout then call GetExpressCheckoutDetails to get transaction details.

4. Use Token and PayerID (obtained in step 3) in call to DoExpressCheckoutPayment to capture payment.

Here's a good place to start: https://developer.paypal.com/docs/classic/api/#ec

这是一个很好的起点:https://developer.paypal.com/docs/classic/api/#ec

The first snag I ran into when implementing the SOAP API versus the REST API was that I couldn't find anywhere in the documentation where to find the redirect URL. The REST API will send it back, the SOAP does not. I had to dig through some of the SDK files to find it.

我在实现SOAP API与REST API时遇到的第一个问题是,我在文档的任何地方都找不到查找重定向URL的位置。 REST API会将其发回,而SOAP则不会。我不得不深入研究一些SDK文件来找到它。

Redirect to here: https://www.sandbox.paypal.com/webscr?cmd=_express-checkout&token=

重定向到这里:https://www.sandbox.paypal.com/webscr?cmd = _express-checkout&token =