我正在为我的一位客户集成 PayPal 支付。他已经从他们那里启用了支付功能。当我通过代码运行交易时,我得到了所需的响应,但不知何故,当我登录到 PayPal 沙盒帐户时,我无法看到交易。我还指定了收件人的电子邮件地址,所以我相信我也应该收到付款的电子邮件。所以问题是:
- 无法在仪表板中看到付款
- 由于我在创建付款项目时指定了电子邮件地址,因此没有收到任何电子邮件
这是我为处理付款而编写的代码
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;
谁能告诉我我错过了什么?任何指针将不胜感激
使用请求的日志进行更新。API 请求:
{
"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"
}
]
}
回复:
{
"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"
}
]
}