SitePoint Sponsor

User Tag List

Results 1 to 7 of 7
  1. #1
    SitePoint Member
    Join Date
    Nov 2012
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question Is it possible to achieve this with Paypal?

    Hello everyone.

    I am trying to add a feature in my website where users can make a payment. The amount to be payed is calculated via PHP on my site, and I need to pass this value along some other variables located in my PHP, to the Paypal payment page. However, I have not been able to achieve this and it makes me wonder if Paypal even offers this possibility in the first place.

    I made a diagram that shows more or less what I am trying to achieve:



    Basically, I tried to insert a Paypal 'Pay Now' button on my site, but when the user clicks it, it prompts for payment amount input, which makes it useless for me. I need that Paypal checkout page to display the amount to charge with the variable I'm passing to it. I know that I can add variables to the button on creating via the Paypal website, but it only allows me to set static prices.

    Apart from this, I also would like to know if when the transaction finishes succesfully on the Paypal payment page, do I get some sort of return value/signal that lets me know if there was a success/error ? I need this signal in order to do some other processes on my website with PHP.

    I would greatly appreciate help, I'm at a total loss and I need to implement this badly for a serious project I'm working on.

  2. #2
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,607
    Mentioned
    24 Post(s)
    Tagged
    1 Thread(s)
    See https://cms.paypal.com/us/cgi-bin/?c..._htmlvariables for the list of all the parameters that you can pass to Paypal.

    The amount is one of the values that you are allowed to pass.

    There are a couple of custom fields that you can use to pass values that Paypal doesn't have listed - if you have lots of data that you need to assocate with a payment then store all the info in a database and pass the key of that record in a custom field so you can use it to retrieve the rest of the data.
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">

  3. #3
    Community Advisor silver trophy

    Join Date
    Nov 2006
    Location
    UK
    Posts
    2,521
    Mentioned
    37 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by BigChief View Post
    I also would like to know if when the transaction finishes succesfully on the Paypal payment page, do I get some sort of return value/signal that lets me know if there was a success/error ? I need this signal in order to do some other processes on my website with PHP.
    https://www.paypal.com/ipn

  4. #4
    SitePoint Member
    Join Date
    Nov 2012
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by felgall View Post
    See https://cms.paypal.com/us/cgi-bin/?c..._htmlvariables for the list of all the parameters that you can pass to Paypal.

    The amount is one of the values that you are allowed to pass.

    There are a couple of custom fields that you can use to pass values that Paypal doesn't have listed - if you have lots of data that you need to assocate with a payment then store all the info in a database and pass the key of that record in a custom field so you can use it to retrieve the rest of the data.
    I checked that site before, I tried sending my price value within HTML with the code given to me when I create a Pay Now button, I tried sending it as a hidden input but it won't work. In paypal it says "Use a line break between each variable. The variables will appear in your button’s HTML code. Learn more" however the code given to me is always the same, I don't see any change.

    So if my variables are not supposed to be passed as hidden inputs within the button's form, then how? What am I doing wrong...

    Code:
    <input type='hidden' name='amount' value='$price'>
    The above code is inside the form code generated by PayPal. All of this code is echoed.

    Quote Originally Posted by EastCoast View Post
    Thanks for this link, I will look into it.

  5. #5
    SitePoint Member
    Join Date
    Nov 2012
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ok. I finally managed to solve all the above and just need to add one final thing.

    After this payment I recieve from a user, I need to make another Paypal transaction to another Paypal account, automatically. Is this even possible? The only thing I can think of right now would be to call some sort of procedure in my IPN after its been successfully recieved. But do I write the procedure?

    This is the final step for this Paypal implementation, help would greatly be appreciated.

  6. #6
    Community Advisor silver trophy

    Join Date
    Nov 2006
    Location
    UK
    Posts
    2,521
    Mentioned
    37 Post(s)
    Tagged
    1 Thread(s)
    You can use either adaptive payments api
    https://www.x.com/content/introducing-adaptive-payments

    or mass payment api
    https://cms.paypal.com/us/cgi-bin/?c...to_api_masspay


    bear in mind a transaction fee will be incurred by either the sender or recipient depending on how you set this up

  7. #7
    SitePoint Evangelist yasha78's Avatar
    Join Date
    Feb 2003
    Location
    ny, ny
    Posts
    474
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Might be a bit off topic, but if you want seamless credit card site integration (and, thus, being able to do whatever you want with your orders/data), I would suggest looking into stripe.com
    -yasha78
    Ad-Network reviews and useful tips:
    WebsterFlooble.com - Last Updated: CasaleMedia
    GetRichandQuick.com - Laugh your a** off, learn something useful.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •