【发布时间】:2017-03-18 03:20:49
【问题描述】:
有人可以为我提供一个有效的支付类吗?我的代码如下。
我的问题是:我的购买方法在付款成功之前返回true。 (换句话说:pay 方法返回一个令牌,然后要求登录 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;
}
【问题讨论】:
标签: android ios in-app-purchase payment codenameone