简体   繁体   English

在iOS app +服务器集成中的paypal链式支付(或自适应)

[英]paypal chained payment (or adaptive) inside iOS app + server integration

I want to implement paypal chained payment (is't one of the adaptive payment methods) within a marketplace iphone app and I want my server to be able to track all the payment steps to avoid multiple concurrent purchases on the same product (it's a physical product and it can't be purchased twice). 我想在市场上的iphone应用程序中实现paypal链式支付(不是自适应支付方式之一),我希望我的服务器能够跟踪所有支付步骤,以避免在同一产品上多次并发购买(这是物理的产品,它不能购买两次)。

I read this docs from paypal about adaptive payment flow , this about mobile integration and this about IPN server side implementation. 我从paypal阅读了关于自适应支付流程的文档,这是关于移动集成的 ,关于IPN服务器端实现。

Now the only way to achieve this seems doing the following: 现在实现这一目标的唯一方法似乎是:

  1. when the user clicks on the pay button, the client calls our server to create a "pending" transaction for that product. 当用户点击付费按钮时,客户端会调用我们的服务器为该产品创建“待处理”事务。
  2. the client calls the native paypal sdk to present the payment view to the user with all information returned by our server. 客户端调用本机paypal sdk向用户显示支付视图,其中包含我们服务器返回的所有信息。
  3. paypal calls our server to notify about the completed payment and here the server completes the pending transaction previously created. paypal呼叫我们的服务器通知已完成的付款,此处服务器完成先前创建的待处理事务。
  4. paypal calls the client to notify about the completed payment and here is shown the "thank-you" screen. paypal致电客户通知已完成的付款,并在此处显示“谢谢”屏幕。

I wouldn't make this kind of things for these reasons: 出于以下原因,我不会做出这样的事情:

  • I have to put a "lock" on the product to avoid duplicate purchase: the only place I can put this lock is right before calling the paypal UI and then unlock it in case the user cancels the operation. 我必须对产品进行“锁定”以避免重复购买:在调用paypal UI之前,我可以放置此锁的唯一位置,然后在用户取消操作时将其解锁。 What about if the user stays on the paypal confirmation for long time? 如果用户长时间保留在PayPal确认书上怎么办? I could put a timeout on the server (for 1 hour for example) but this wouldn't avoid the user to complete the purchase after that period! 我可以在服务器上设置超时(例如1小时),但这不会避免用户在此期间完成购买!
  • I have to set the payment details (like the amount and the receiver email) from the client. 我必须从客户端设置付款详细信息(如金额和接收方电子邮件)。 As I wrote, I could use the data provided by the server but this would lead me in several security and complexity issues. 正如我所写,我可以使用服务器提供的数据,但这会导致我遇到一些安全性和复杂性问题。
  • Using the native sdk the user can choose from one of their existing shipping addresses, but he can't create or edit a new one. 使用本机sdk,用户可以从他们现有的一个发货地址中进行选择,但他无法创建或编辑新的地址。 I have to ask for the shipping address outside paypal and pass this data to my own server. 我必须在paypal外面询问送货地址,并将此数据传递给我自己的服务器。

Any suggestions? 有什么建议么?

At the end the working approach for us was using paypal preapproval. 最后,我们的工作方法是使用paypal preapproval。 if you don't know what a preapproval is, imagine a bank rid: you ask the user the permission to charge him at anytime, in our case we charge the seller for a fee commission when he sells an item. 如果您不知道预先批准的是什么,想象一下银行摆脱:您要求用户随时向他收取费用,在我们的情况下,我们会在销售商品时向卖家收取费用佣金。

keeping the seller outside of the transaction flow, permitted us to let the buyer completes the checkout using the express checkout implementation, from within an embedded webview. 将卖家保持在交易流程之外,允许我们让买家在嵌入式网页浏览中使用快速结账实施完成结账。

with this technique, you are basically asking the buyer to pre-authorize a payment. 使用这种技术,您基本上是要求买方预先授权付款。 after he grants the permission you pass a secret token back to your webserver where the real payment is performed (along with any other secure validation). 在他授予许可后,您将秘密令牌传递回您执行真实付款的网络服务器(以及任何其他安全验证)。

after moving the money from the buyer to the seller, we charge the seller for the transaction using the preapproval. 在将钱从买方转移到卖方后,我们使用预批准向卖方收取交易费用。

please let me note that at the end we are not using the real paypal chained payment, but for us this approach was good and everything seems to work fine by now. 请让我注意,最后我们没有使用真正的paypal链式付款,但对我们来说这种方法很好,现在一切似乎都运行良好。

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

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