
Research
/Security News
Shai Hulud Strikes Again (v2)
Another wave of Shai-Hulud campaign has hit npm with more than 500 packages and 700+ versions affected.
lottay-paypal_adaptive
Advanced tools
This gem is a lightweight wrapper for the paypal adaptive payments API.
This is very much a work in progress! Use at your own risk or submit bug fixes :)
Before you need start, read the API manual https://www.x.com/docs/DOC-1531 and check out the forums on http://x.com It'll be invaluable for parameters and error messages. The gem keeps the request/response as hashes so you will have to read the manual to make the proper calls. I made a few test cases for further examples at http://github.com/tc/paypal_adaptive/tree/master/test/
Create paypal_adaptive.yml to your config folder: development: environment: "sandbox" username: "sandbox_username" password: "sandbox_password" signature: "sandbox_signature" application_id: "sandbox_app_id"
test:
environment: "sandbox"
username: "sandbox_username"
password: "sandbox_password"
signature: "sandbox_signature"
application_id: "sandbox_app_id"
production:
environment: "production"
username: "my_production_username"
password: "my_production_password"
signature: "my_production_signature"
application_id: "my_production_app_id"
Make the payment request:
pay_request = PaypalAdaptive::Request.new
data = {
"returnUrl" => "http://testserver.com/payments/completed_payment_request",
"requestEnvelope" => {"errorLanguage" => "en_US"},
"currencyCode"=>"USD",
"receiverList"=>{"receiver"=>[{"email"=>"testpp_1261697850_per@nextsprocket.com", "amount"=>"10.00"}]},
"cancelUrl"=>"http://testserver.com/payments/canceled_payment_request",
"actionType"=>"PAY",
"ipnNotificationUrl"=>"http://testserver.com/payments/ipn_notification"
}
pay_response = pay_request.pay(data)
if pay_response.success?
redirect_to pp_response.approve_paypal_payment_url
else
puts pay_response.errors.first['message']
redirect_to failed_payment_url
end
Once the user goes to pp_response.approve_paypal_payment_url, they will be prompted to login to Paypal for payment.
Upon payment completion page, they will be redirected to http://testserver.com/payments/completed_payment_request.
They can also click cancel to go to http://testserver.com/payments/canceled_payment_request
The actual payment details will be sent to your server via "ipnNotificationUrl" You have to create a listener to receive POST messages from paypal. I added a Rails metal template in the templates folder which handles the callback.
Additionally, you can make calls to Paypal Adaptive's other APIs: payment_details, preapproval, preapproval_details, cancel_preapproval, convert_currency, refund
Input is just a Hash just like the pay method. Refer to the Paypal manual for more details.
0.0.5 Added Preapproval preapproval_paypal_payment_url along with test case.
0.0.4 Preapproval now returns a PaypalAdaptive::Response class. Added preapproval test cases.
0.0.3 Renamed PayRequest, PayResponse into Request, Response since other api calls use the class as well.
0.0.2 Fixed initialized constant warning.
0.0.1 First release.
Copyright (c) 2009 Tommy Chheng. See LICENSE for details.
FAQs
Unknown package
We found that lottay-paypal_adaptive demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Research
/Security News
Another wave of Shai-Hulud campaign has hit npm with more than 500 packages and 700+ versions affected.

Product
Add real-time Socket webhook events to your workflows to automatically receive software supply chain alert changes in real time.

Security News
ENISA has become a CVE Program Root, giving the EU a central authority for coordinating vulnerability reporting, disclosure, and cross-border response.