/settlement-paypal

An Interledger settlement engine for PayPal

Primary LanguageTypeScript

PayPal ILP Settlement Engine

This repository houses an implementation of an ILP settlement engine for PayPal per the proposed Settlement RFC!

Due to the limitations of paypal-rest-sdk, this settlement engine requires transactions to occur between PayPal business accounts. In order to listen for payments, this engine requires manual configuration of account settings to include an endpoint for Instant Payment Notifications.

Usage

Create a PayPal application in live or sandbox mode on the developer site.

Configure launch.ts with the corresponding PayPal email, id, and secret of the application.

In the settings of the PayPal business account, add the endpoint url that listens for Instant Payment Notifications. The url is set to follow this format: https://{hostname}/{clientid}/ipn.

To launch, run:

npm run start

Testing

Utilize the PayPal Webhook Simulator to simulate Payment payouts-item succeeded, which this engine listens for.

In order to test the handling of an incoming transaction, create a separate business account in the same mode to send a payout to the account on the engine. Configure pay.ts at the top of the script, and run:

npm run build && node ./build/pay.js

TODO

  • Add webhook and ipn verification logic
  • Add integration tests

Contributing

Pull requests are welcome. Please fork the repository and submit!