2012-03-01 80 views
1

我正在使用PayPal Mobile Payments Library来实现使用Adobe AIR的PayPal for Android。贝宝为Android如何识别回拨中的付款项目?

当我为用户创建一些PayPalPayment对象来添加要购买的物品时,如何在回调函数中获取该物品?

我希望能够检查交易是否有效?

谢谢。

+0

您的意思是要问,如何获取用户添加到购物车中的项目,在回调函数中? – nycynik 2012-03-01 15:08:09

+0

是的,当它进入回调。我怎么知道我真的得到了什么。 – yozhik 2012-03-01 15:35:31

回答

0

可以传递任何额外的自定义数据,以确定您的服务器端付款特罗PARAM:

payment.setCustomID(“一些额外的不可见的数据,你可以通过它会回来IPN回调网址你的服务器“);

// Create a basic PayPalPayment. 
PayPalPayment payment = new PayPalPayment(); 

// Sets the currency type for this payment. 
payment.setCurrencyType(currency_type); 

// Sets the recipient for the payment. This can also be a phone number. 
payment.setRecipient(paypal_recipient); 

// Sets the amount of the payment, not including tax and shipping amounts. 
payment.setSubtotal(new BigDecimal(currency_cost)); 

// Sets the payment type. This can be PAYMENT_TYPE_GOODS, PAYMENT_TYPE_SERVICE, PAYMENT_TYPE_PERSONAL, or PAYMENT_TYPE_NONE. 
payment.setPaymentType(PayPal.PAYMENT_TYPE_GOODS); 

// Sets the Custom ID. This is any ID that you would like to have associated with the payment. 
payment.setCustomID(transaction_id); 

// Sets the Instant Payment Notification url. This url will be hit by the PayPal server upon completion of the payment. 
payment.setIpnUrl(payment_url_callback); 

// Sets the memo. This memo will be part of the notification sent by PayPal to the necessary parties. 
payment.setDescription(product_description);