使用自适应支付 API 调用在 Paypal 上发出付款请求时,如何将 item_number 传递给 IPN?
我正在使用自适应 api 进行链式支付。代码看起来
ChainedPay chainedPay = new ChainedPay(numberOfReceivers); //为chainedPay对象设置值(例如返回url、取消url、ipn url等) ....
接收器primaryReceiver = new Receiver(); // 设置接收者的值,例如金额等。 ... chainedPay.setPrimaryReceiver(primaryReceiver);
接收器rec1 = new Receiver(); //设置第二个接收者的值 ... chainedPay.addToSecondaryReceivers(rec1);
//发出请求 chainedPay.makeRequest();像这样:
当付款被批准时,我确实收到了 IPN 消息。但我希望能够在付款请求中发送一个值,例如我的系统中存在的 transactionId,并让 IPN 将其发回给我,这样我就可以在我的 iPN 侦听器中通过其 id 查找交易,并且使用该信息向用户提供数字商品。我不知道在付款请求中的哪里设置该值。
在使用自适应支付 api 调用之前,如果我想将交易 id 传递给 IPN,我会将其设置在购买按钮形式的字段中的 item_number 字段中,并且该字段将被传递。自适应api中有类似的东西吗?
谢谢, 蒂姆
I am using adaptive api to make a chained payment. The code looks
ChainedPay chainedPay = new ChainedPay(numberOfReceivers);
//set values (such as return url, cancel url, ipn url etc for the chainedPay object
....
Receiver primaryReceiver = new Receiver();
// set the receiver's value such as amount etc.
...
chainedPay.setPrimaryReceiver(primaryReceiver);
Receiver rec1 = new Receiver();
//set the second receiver's value
...
chainedPay.addToSecondaryReceivers(rec1);
//Make the request
chainedPay.makeRequest(); like this:
I do get the IPN message back when the payment is approved. But I want to be able to send a value such as a transactionId that exists in my system in the pay request, and have the IPN post it back to me, so I can look up the transaction by its id in my ipn listener, and use that information to deliver digital good to the user. I can't figure out where to set that value in the pay request.
Before using adaptive payment api call, if I want to pass the transaction id to the IPN, I would set it in the item_number field in a field in the form of the buy button and that would get passed through. Is there something similar in the adaptive api?
Thanks,
Tim
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
尝试使用trackingid参数。我正在使用 XML 版本,并按如下方式传递它
sRequest.Append("
<
/trackingId>");sRequest.Append(trackingID);
sRequest.Append("
<
/trackingId>");您可以在 PayRequest 类中获取一个属性作为跟踪 id。Try using the trackingid parameter. I am using the XML version and I pass it as follows
sRequest.Append("
<
/trackingId>");sRequest.Append(trackingID);
sRequest.Append("
<
/trackingId>"); You may get a property as tracking id in PayRequest class.我通过 PayRequest Ex 中的 TrackingId 字段传递 orderId
:
PayRequest payRequest = new PayRequest(requestEnvelope,actionType,cancelUrl,currencyCode,receiverList,returnUrl);
payRequest.ipnNotificationUrl = System.Configuration.ConfigurationManager.AppSettings["PaypalNotifyUrl"];
payRequest.trackingId = orderId.ToString();
然后在 IPN 处理程序中,我从 Request 对象中检索它。
I am passing the orderId via the trackingId field in the PayRequest
Ex:
PayRequest payRequest = new PayRequest(requestEnvelope, actionType, cancelUrl, currencyCode, receiverList, returnUrl);
payRequest.ipnNotificationUrl = System.Configuration.ConfigurationManager.AppSettings["PaypalNotifyUrl"];
payRequest.trackingId = orderId.ToString();
Then in the IPN handler, I retrieve it from the Request object.