External adapter connecting to the Paypal payouts API using the Paypal payout SDK
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.
Required? | Name | Description | Options | Defaults to |
---|---|---|---|---|
✅ | CLIENT_ID |
API access credential | ||
✅ | CLIENT_SECRET |
API access credential | ||
MODE |
Parameter for determining a live or sandbox environment | sandbox , live |
sandbox |
Required? | Name | Description | Options | Defaults to |
---|---|---|---|---|
endpoint | The Paypal endpoint to use | sendpayout , getpayout |
sendpayout |
Endpoint used to send currency to a specified receiver.
Required? | Name | Description | Options | Defaults to |
---|---|---|---|---|
✅ | amount |
Amount to send as a string | ||
currency |
Three-character ISO-4217 currency code. | options | USD |
|
✅ | receiver |
Specified receiver matching the recipient_type |
||
recipient_type |
The type of receiver |
EMAIL , PHONE , PAYPAL_ID |
EMAIL |
|
note |
Custom note for payout | |||
sender_item_id |
Custom sender-specified ID for payout | |||
email_subject |
Custom email subject for the payment notification | |||
email_message |
Custom email message for the payment notification |
{
"id": "1",
"data": {
"endpoint": "sendpayout",
"amount": "1.00",
"receiver": "[email protected]",
"recipient_type": "EMAIL",
"note": "test transaction",
"sender_item_id": "0x00",
"email_subject": "hello!",
"email_message": "this is the first tx"
}
}
{
"jobRunID": "1",
"result": {
"batch_header": {
"payout_batch_id": "EVFRQ73UQ3PQU",
"batch_status": "PENDING",
"sender_batch_header": {
"sender_batch_id": "mqr",
"recipient_type": "EMAIL",
"email_subject": "hello!",
"email_message": "this is the first tx"
}
},
"links": [
{
"href": "https://api.sandbox.paypal.com/v1/payments/payouts/EVFRQ73UQ3PQU",
"rel": "self",
"method": "GET",
"encType": "application/json"
}
]
},
"statusCode": 201,
"data": {
"result": {
"batch_header": {
"payout_batch_id": "EVFRQ73UQ3PQU",
"batch_status": "PENDING",
"sender_batch_header": {
"sender_batch_id": "mqr",
"recipient_type": "EMAIL",
"email_subject": "hello!",
"email_message": "this is the first tx"
}
},
"links": [
{
"href": "https://api.sandbox.paypal.com/v1/payments/payouts/EVFRQ73UQ3PQU",
"rel": "self",
"method": "GET",
"encType": "application/json"
}
]
}
}
}
Endpoint used to get information about a transaction or batch of transactions.
Required? | Name | Description | Options | Defaults to |
---|---|---|---|---|
✅ | payout_id |
ID of the payout batch or item to lookup | ||
type |
Type of payout to lookup | ITEM , BATCH |
BATCH |
{
"id": "1",
"data": {
"endpoint": "getpayout",
"payout_id": "Y7L245ABZLPZU",
"type": "ITEM"
}
}
{
"jobRunID": "1",
"result": {
"payout_item_id": "Y7L245ABZLPZU",
"transaction_id": "96877893GC888820F",
"activity_id": "322381265N9335843",
"transaction_status": "SUCCESS",
"payout_item_fee": {
"currency": "USD",
"value": "0.02"
},
"payout_batch_id": "DNPMSBKRYB4AN",
"sender_batch_id": "a513191600c8fc240450ba26fd99e784",
"payout_item": {
"recipient_type": "EMAIL",
"amount": {
"currency": "USD",
"value": "1.00"
},
"note": "Here's your payment",
"receiver": "[email protected]",
"sender_item_id": "001",
"recipient_wallet": "PAYPAL"
},
"time_processed": "2021-04-07T15:35:13Z",
"links": [
{
"href": "https://api.sandbox.paypal.com/v1/payments/payouts-item/Y7L245ABZLPZU",
"rel": "self",
"method": "GET",
"encType": "application/json"
},
{
"href": "https://api.sandbox.paypal.com/v1/payments/payouts/DNPMSBKRYB4AN",
"rel": "batch",
"method": "GET",
"encType": "application/json"
}
]
},
"statusCode": 200,
"data": {
"result": {
"payout_item_id": "Y7L245ABZLPZU",
"transaction_id": "96877893GC888820F",
"activity_id": "322381265N9335843",
"transaction_status": "SUCCESS",
"payout_item_fee": {
"currency": "USD",
"value": "0.02"
},
"payout_batch_id": "DNPMSBKRYB4AN",
"sender_batch_id": "a513191600c8fc240450ba26fd99e784",
"payout_item": {
"recipient_type": "EMAIL",
"amount": {
"currency": "USD",
"value": "1.00"
},
"note": "Here's your payment",
"receiver": "[email protected]",
"sender_item_id": "001",
"recipient_wallet": "PAYPAL"
},
"time_processed": "2021-04-07T15:35:13Z",
"links": [
{
"href": "https://api.sandbox.paypal.com/v1/payments/payouts-item/Y7L245ABZLPZU",
"rel": "self",
"method": "GET",
"encType": "application/json"
},
{
"href": "https://api.sandbox.paypal.com/v1/payments/payouts/DNPMSBKRYB4AN",
"rel": "batch",
"method": "GET",
"encType": "application/json"
}
]
}
}
}
For end to end testing, the environment variables described above must be set.
Additionally, the following is required:
- For
e2e/getPayout.test.ts
, the following environment variables need to be set with parameters that can be retrieved by theCLIENT_ID
andCLIENT_SECRET
in thesandbox
export PAYOUT_ID_BATCH='batch payout ID'
export PAYOUT_ID_ITEM='batch item payout ID'
- For
e2e/sendPayout.test.ts
, the account associated with theCLIENT_ID
andCLIENT_SECRET
in thesandbox
must have a balance that can be sent.