0
有人可以爲我提供正常運作的支付類嗎?我的代碼如下。支付示例代碼
我的問題是:我的購物方法在支付成功之前返回true。 (換句話說:支付方法返回一個令牌,然後請求登錄的iTunes或Google Play商店中的用戶不得與採購繼續,因爲他/她已經可能繼續
public boolean purchase() {
final Purchase p = Purchase.getInAppPurchase();
boolean retVal = true;
if (p != null) {
if (p.isManagedPaymentSupported()) {
if (Display.getInstance().getPlatformName().equalsIgnoreCase(Constants.ANDROID)) {
p.purchase(Payment.SKUS_AND[this.membershipType]);
}
else {
p.purchase(Payment.SKUS_IOS[this.membershipType]);
}
}
else {
String retToken = null;
if (p.isManualPaymentSupported()) {
if (Display.getInstance().getPlatformName().equalsIgnoreCase(Constants.IOS)) {
retToken = p.pay(Payment.ITEM_COSTS[this.membershipType], Payment.CURRENCY, "lfiuhlecfhbweucfbhewucfbhewluh");
}
else {
retToken = p.pay(Payment.ITEM_COSTS[this.membershipType], Payment.CURRENCY, "6578346756347865783");
}
retVal = retToken != null;
}
else {
UITools.infoDialog(Settings.getInstance().getLocalizedText(TextConstants.UNSUPPORTED_PAYMENT));
retVal = false;
}
}
}
else {
UITools.infoDialog(Settings.getInstance().getLocalizedText(TextConstants.UNSUPPORTED_PAYMENT));
retVal = false;
}
return retVal;
}