1
votes

I want to insert different payment buttons in my car sharing web app. The button amounts are based on DB data inserted by sellers.

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. 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.

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/[email protected]&cmd=_xclick&currency_code=EUR&amount=' . $price. '&item_name=Pagamento%20Trip">Pay withPaypal</a>';

1

1 Answers

0
votes

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. ([email protected] is not valid)


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:

                    purchase_units: [{
                        payee: {
                            email_address: '[email protected]'
                        },
                        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.