我如何使用PayPal配置托管参考交易?(How do i Configure hosted reference transactions with PayPal?)

编程入门 行业动态 更新时间:2024-10-09 01:20:06
如何使用PayPal配置托管参考交易?(How do i Configure hosted reference transactions with PayPal?)

我的要求是我需要使用托管(英国)解决方案来生成一个引用事务令牌,然后可以定期调用,而无需用户再次启动事务。

目前,使用传统的API我有类似于参考交易的工作,但是这需要用户拥有一个PayPal账户 - 我还需要能够接受信用卡信息(无PayPal账户)。

接受卡信息的唯一方式似乎是托管(英国)解决方案,但我不知道如何设置。 所以,我想问题是这样的:

1)我是否可以允许卡和PayPal账户进行参考交易?

要么

2)如何设置/配置托管解决方案? 或者仅仅是在PayPal帐户中使用文档和没有配置的iframe的情况?

My requirement is that i need to use a Hosted (uk) solution to generate a reference transaction token that can then be called periodically without the user having to initiate the transaction again.

Currently, using the classic API I have something akin to a reference transaction working, however this requires the user to have a PayPal account - I also need to be able to accept card details (no PayPal account).

The only way to accept card details seems to be with the hosted (uk) solution however I have no idea how to set this up. So, I guess the questions are this:

1) Am I able to allow card AND PayPal account for the reference transactions?

or

2) How do I setup / configure a hosted solution? or is this simply a case of using the docs and an iframe with no config in the PayPal account?

最满意答案

对于你的第二个问题 - 是的,它很简单。 查看托管文档并整合。

As @DiceyRamp has stated the hosted solution is just a case of using the docs, no account specific setup is required.

To answer the first question :- it is NOT possible to use the PayPal Hosted API for Reference Transactions. You instead must use the Button API to create a reference token. In order to generate a token without a purchase you must go one further, generate an order and then immediately void it.

Credit where credit is due, this was answered for me over email by another developer. Im including his explanation here in the hope that it helps others.

Paypal button API Examples

The specific process is this:

We create an iframe url using the PayPal BMCreateButton method, with the BUTTONTYPE set to “PAYMENT” and the BUTTONCODE as “TOKEN”. We then set all the usual order parameters up (name, address, notify_url etc) and then url encode them. We then execute the BMCreateButton with the above arguments set, this gives us an iframe url which we render on the page.

To generate a token we use a dummy £1 order.

The code that executes on the “notify_url” basically takes the IPN message, and if the result is ‘VERIFIED’ then it stores the ‘txn_id’ as the token.

This can then be used later on a Paypal DoReferenceTransaction API call, using the txn_id as the “REFERENCEID” parameter. The notify_url code will NOT store the txn_id if the IPN states the order was a VOID, you can’t do a repeat against a void, so we never store the void txn_id as a token.

更多推荐

本文发布于:2023-08-02 03:39:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1369119.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:如何使用   PayPal   Configure   transactions   reference

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!