I am working on integrating PayPal Payouts for one of my clients. He has get the Payout feature enabled from them. When I run the transactions via code, I am getting the required response but somehow I am unable to see the transactions when I login to the PayPal Sandbox account. I am also specifying Receiver's Email address so I believe I should be getting emails for the payout too. So the problems are:
- unable to see the payouts in dashboard
- not receiving any emails since I specified email address while creating payout items
Here is the code I have written to process Payouts
Payout payout = new Payout
{
sender_batch_header = new PayoutSenderBatchHeader()
{
email_subject = "You recieved a payout!!",
recipient_type = PayoutRecipientType.EMAIL,
sender_batch_id = "batch_" + Guid.NewGuid().ToString().Substring(0, 8),
}
};
payout.items = new List<PayoutItem>();
payout.items.Add(new PayoutItem()
{
recipient_type = PayoutRecipientType.EMAIL,
amount = new Currency()
{
currency = "USD",
value = amountToBePaid.ToString(),
},
note = "Please check your email for details.",
sender_item_id = "item_" + Guid.NewGuid().ToString().Substring(0, 4),
receiver = "XXXXXXXXXX@gmail.com",
});
payout.items.Add(new PayoutItem()
{
recipient_type = PayoutRecipientType.EMAIL,
amount = new Currency()
{
currency = "USD",
value = amountToBePaid.ToString(),
},
note = "Please check your email for details.",
sender_item_id = "item_" + Guid.NewGuid().ToString().Substring(0, 4),
receiver = "XXXXXXXXXX@gmail.com",
});
var createdPayout = payout.Create(token, false);
var payoutBatch = Payout.Get(token, createdPayout.batch_header.payout_batch_id);
string status = payoutBatch.batch_header.batch_status;
string payoutItemId = payoutBatch.items[0].payout_item_id;
string payoutBatchId = payoutBatch.batch_header.payout_batch_id;
Can anyone advise what I am missing? Any pointers would be highly appreciated
Updating with requested log. API Request:
{
"batch_header": {
"payout_batch_id": "XXX",
"batch_status": "PENDING",
"time_created": "2022-02-23T07:01:04Z",
"sender_batch_header": {
"sender_batch_id": "batch_9f63cf9a",
"email_subject": "You recieved a payout!!",
"recipient_type": "EMAIL"
},
"amount": {
"currency": "USD",
"value": "50.00"
},
"fees": {
"currency": "USD",
"value": "1.00"
}
},
"items": [
{
"payout_item_id": "XXX",
"transaction_status": "PENDING",
"payout_item_fee": {
"currency": "USD",
"value": "1.00"
},
"payout_batch_id": "XXX",
"payout_item": {
"recipient_type": "EMAIL",
"amount": {
"currency": "USD",
"value": "50.00"
},
"note": "Please check your email for details.",
"receiver": "channa.development@gmail.com",
"sender_item_id": "item_a42a"
},
"links": [
{
"href": "https://api.sandbox.paypal.com/v1/payments/payouts-item/XXX",
"rel": "item",
"method": "GET",
"enctype": "application/json"
}
]
}
],
"links": [
{
"href": "https://api.sandbox.paypal.com/v1/payments/pa youts/XXX?page_size=1000&page=1",
"rel": "self",
"method": "GET",
"enctype": "application/json"
}
]
}
Response:
{
"batch_header": {
"payout_batch_id": "XXX",
"batch_status": "PENDING",
"sender_batch_header": {
"sender_batch_id": "batch_9f63cf9a",
"email_subject": "You recieved a payout!!",
"recipient_type": "EMAIL"
}
},
"links": [
{
"href": "https://api.sandbox.paypal.com/v1/payments/payouts/XXX",
"rel": "self",
"method": "GET",
"enctype": "application/json"
}
]
}