Search code examples
javascriptpaypalpayment

How to create a paypal link from user's email address to send money to them?


I want to create a way to dynamically generate paypal links where the receiver is already set by their email address (and amount). I know that paypal has the "paypal.me" feature for this, but to use it the user has to create it by themselves first. Example: https://paypal.com/sendMoney?receiver=paul@gmail.com&amount=10$


Solution

  • You cannot use the "send money" flow for this, but you can make a regular PayPal payment go to any destination email. Via https://www.paypal.com/buttons , create a Buy Now button and in Step 2 uncheck the option to save the button at PayPal. After clicking to create, switch to the "Email" tab. This results in a link like the following:

    https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&business=xxxxxxxxxx&lc=US&button_subtype=services&no_note=0&cn=Add%20special%20instructions%20to%20the%20seller%3a&no_shipping=2&currency_code=USD&bn=PP%2dBuyNowBF%3abtn_buynowCC_LG%2egif%3aNonHosted

    Which can be simplified to:

    https://www.paypal.com/webscr?cmd=_xclick&item_name=Purpose%20of%20payment%20goes%20here&amount=&currency_code=USD&business=somereceiver@emaildomain.com


    The above satisfies your request for a link. If you want a nice looking button and in-context flow that doesn't redirect away from your site, start with a regular PayPal Checkout integration and add a payee parameter in the createOrder payload, as documented here.