When you use Paypal to get payments, you can configure a return URL to which the payer will be redirected. When you activate Payment Data Transfer, you get some information about the payment that redirected to your site.
The paypal gem (more info at
leetsoft, although the doc you'll find there is out of date) doesn't work with Payment Data Transfer, but only with Instant Payment Notification (notification made separately by Paypal making a post request to your server).