从 AdaptivePayments 获取交易编号

Getting Transaction Number from AdaptivePayments

这是对我之前提出的问题的更新。鉴于该问题的整个问题已经改变,我觉得有必要提出一个更准确和详细的问题。这是我的代码:

设置付款()

public PayResponse SetupPayment(string receiverEmail, decimal amountToPay)
{
    ReceiverList receiverList = new ReceiverList { receiver = new List<Receiver>() };
    Receiver receiver = new Receiver(amountToPay) { email = receiverEmail };
    receiverList.receiver.Add(receiver);

    RequestEnvelope requestEnvelope = new RequestEnvelope("en_US");
    const string actionType = "CREATE";
    const string returnUrl = "https://devtools-paypal.com/guide/ap_implicit_payment/dotnet?success=true";
    const string cancelUrl = "https://devtools-paypal.com/guide/ap_implicit_payment/dotnet?cancel=true";
    const string currencyCode = "USD";

    PayRequest payRequest = new PayRequest(
        requestEnvelope,
        actionType,
        cancelUrl,
        currencyCode,
        receiverList,
        returnUrl)
    {
        senderEmail = ConfigurationManager.AppSettings["PayPalSenderEmail"]
    };

    AdaptivePaymentsService adaptivePaymentService = new AdaptivePaymentsService(_payPalConfig);
    PayResponse payResponse = adaptivePaymentService.Pay(payRequest);

    return payResponse;
}

执行支付()

public ExecutePaymentResponse ExecutePayment(string payKey)
{
    RequestEnvelope requestEnvelope = new RequestEnvelope("en_US");
    ExecutePaymentRequest executePaymentRequest = new ExecutePaymentRequest(requestEnvelope, payKey);
    AdaptivePaymentsService adaptivePaymentsService = new AdaptivePaymentsService(_payPalConfig);
    ExecutePaymentResponse executePaymentResponse = adaptivePaymentsService.ExecutePayment(executePaymentRequest);
    return executePaymentResponse;
}

调用那些函数

PayResponse payResponse = payPalAdapter.SetupPayment(payPalUserEmail, commissionAmount);

if (payResponse.responseEnvelope.ack.ToString() == "SUCCESS")
{
    ExecutePaymentResponse executePaymentResponse = payPalAdapter.ExecutePayment(payResponse.payKey);
}

我的问题是 - 如何检索在 SetupPayment() 中创建并在 ExecutePayment() 中执行的付款交易 Number/ID?我在 Adaptive Payments API 中看到的唯一提及是说交易号在 IPN 消息中...但是获取交易号真的只能通过 IPN 吗?

执行付款后调用PaymentDetails。响应应包含交易 ID(接收方交易 ID 为 paymentInfoList.paymentInfo(0).transactionId,发送方交易 ID 为 paymentInfoList.paymentInfo(n).senderTransactionId)。