简体   繁体   English

可变金额的 PayPal 付款按钮

[英]PayPal Payment Button for Variable Amount

I want to insert different payment buttons in my car sharing web app.我想在我的汽车共享网络应用程序中插入不同的付款按钮。 The button amounts are based on DB data inserted by sellers.按钮数量基于卖家插入的 DB 数据。

Sellers offer service(for $) -> Buyer searches for service -> list of services with related payment buttons are displayed卖家提供服务(美元)-> 买家搜索服务-> 显示相关付款按钮的服务列表

HOW IT WORKS The seller writes his amount $, the amount goes to DB.它是如何工作的 卖家写下他的金额 $,金额转到 DB。 Whenever the buyer searches, a list is displayed with different sellers and related payment buttons (with related amounts).每当买家搜索时,都会显示一个列表,其中包含不同的卖家和相关的付款按钮(带有相关金额)。

I tried to modify PayPal button string, inserting the price variable, but PayPal does not allow these modifications anymore.我试图修改 PayPal 按钮字符串,插入价格变量,但 PayPal 不再允许这些修改。

if(mysqli_num_rows($result) != 0) {
        while($row = mysqli_fetch_assoc($result)){ 
            $user = $row['user'];
            $price= $row['price'];  

            echo '$user' . $userTrip->getName();                                   

            echo 'href="https://www.paypal.com/cgi-bin/webscr?business=email@email.com&cmd=_xclick&currency_code=EUR&amount=' . $price. '&item_name=Pagamento%20Trip">Pay withPaypal</a>';

PayPal does allow those modifications.贝宝确实允许这些修改。 The problem with your example is you also have to pass a valid receiver email address in the "business" parameter.您的示例的问题是您还必须在“业务”参数中传递有效的接收者电子邮件地址。 ( business=email@email.com is not valid) business=email@email.com无效)


A better experience would be to integrate Smart Payment Buttons , instead of a simple link.更好的体验是集成智能支付按钮,而不是简单的链接。

Normally you need the ClientID of each receiver (this is preferred, since PayPal account emails can change) -- but alternatively, you can use your own ClientID and specify the receiver's PayPal email address in the payee field:通常您需要每个接收者的 ClientID(这是首选,因为 PayPal 帐户电子邮件可能会更改)——但或者,您可以使用自己的ClientID 并在payee字段中指定接收者的 PayPal 电子邮件地址:

                    purchase_units: [{
                        payee: {
                            email_address: 'replacewithrealemail@somewhere.com'
                        },
                        amount: {
                            value: <?= $price =>
                        }
                    }]

Perhaps that should be '<$= $userTrip->getEmail() =>' , or however you're meant to obtain and echo it to this Javascript array you're outputting.也许那应该是'<$= $userTrip->getEmail() =>' ,或者无论如何您打算获取它并将其回显到您正在输出的这个 Javascript 数组中。

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

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