1. Home
  2. Docs
  3. Chainlink Adapters
  4. Private: Adapter Downloads
  5. PayPal External Adapter

PayPal External Adapter

How to use

  • Install dependencies yarn install
  • Build TypeScript files yarn build
  • Set up Environment variables
  • Optional: Run tests yarn test. Please read Testing first!
  • Run this adapter using a serverless provider:
    • use the handler() wrapper for AWS Lambda
    • use the gcpservice() wrapper for GCP
  • Use one of the available Available methods
    • Set method name in data.method, along with method-specific parameters

To create a ZIP file to upload to AWS/GCP, run:

zip -r cl-ea.zip .

Environment variables

VariableDescriptionExample
MODEOptionalLIVE or SANDBOXSANDBOX
CLIENT_IDRequiredYour PayPal Client IDEBWKjlELKMYqRNQ6sYvFo64FtaRLRR5BdHEESmha49TM
CLIENT_SECRETRequiredYour PayPal Client SecretEO422dn3gQLgDbuwqTjzrFgFtaRLRR5BdHEESmha49TM
API_METHODOptionalSet a specific method to use for this adapter. Overwrites method in request body.sendPayout

To get PayPal developer credentials, please check out https://developer.paypal.com/.

Testing

Before you start testing, make sure you have necessary PayPal developer credentials set up. Set the MODE env variable to sandbox.

In order to test sending payouts, make sure your facilitator account is funded. Also make sure you are sending in the default currency of your account. Receiver should be your “buyer” account. These env vars can be set with TEST_CURRENCY and TEST_RECEIVER, as well as TEST_AMOUNT.

To test the getPayout method with another payout other than the one created in the test, set the TEST_PAYOUT_ID env var.

Available methods

Method can be specified by the method key in the request body or the API_METHOD environment variable. If the environment variable is set, it takes precedence over the method specified in the request body.

sendPayout

Send a payout with the Payouts API.

Request

VariableTypeDescription
amountInteger, decimalRequiredAmount to send. Please refer to the PayPal docs.
currencyStringOptionalThree-character ISO-4217 currency code. Defaults to USD. Please refer to the full list of available currencies.
receiverStringRequiredReceiver of the payout
recipient_typeStringOptionalThe type of receiver. Can be one of EMAIL, PHONE and PAYPAL_ID. Defaults to EMAIL.
noteStringOptionalCustom note for this payout
sender_item_idStringOptionalCustom sender-specified ID for this payout
email_subjectStringOptionalCustom email subject for the payment notification
email_messageStringOptionalCustom email message for the payment notification

Please refer to the PayPal docs for more information on each parameter: https://developer.paypal.com/docs/api/payments.payouts-batch/v1/#payouts_create

Response

{  
  "result":"5UXD2E8A7EBQJ",
   "batch_header":{  
      "sender_batch_header":{  
         "sender_batch_id":"Payouts_2018_100008",
         "email_subject":"You have a payout!",
         "email_message":"You have received a payout! Thanks for using our service!"
      },
      "payout_batch_id":"5UXD2E8A7EBQJ",
      "batch_status":"PENDING"
   }
}

getPayout

Get details on a payout.

Request

VariableTypeDescription
typeStringOptionalType of payout to look up. One of ITEM and BATCH. Defaults to BATCH.
payout_idStringRequiredPayout item ID to look up

Please refer to the PayPal docs for more information on each parameter: https://developer.paypal.com/docs/api/payments.payouts-batch/v1/#payouts_create

Response

{  
   "result":"5UXD2E8A7EBQJ",
   "batch_header":{  
      "sender_batch_header":{  
         "sender_batch_id":"Payouts_2018_100008",
         "email_subject":"You have a payout!",
         "email_message":"You have received a payout! Thanks for using our service!"
      },
      "payout_batch_id":"5UXD2E8A7EBQJ",
      "batch_status":"PENDING"
   }
}

Disclaimer

In order to use this adapter, you will need to create an account with and obtain credentials from PayPal and agree to and comply with PayPal’s applicable terms, conditions and policies. In no event will SmartContract Chainlink Limited SEZC be liable for your or your user’s failure to comply with any or all of PayPal’s terms, conditions or policies or any other applicable license terms.

Was this article helpful to you? Yes No

How can we help?

Leave a Reply

Your email address will not be published. Required fields are marked *