应用程序内购买两次

时间:2017-11-07 15:40:16

标签: java android google-play in-app-purchase

我刚测试了我的第一次应用内购买,金额是应该有的两倍。

我使用this库在我的应用程序中实现应用内结算。以下是我实施它的方法:

public class MainActivity extends AppCompatActivity implements BillingProcessor.IBillingHandler {

private Button buyButton;
BillingProcessor bp;


@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    bp = new BillingProcessor(this, "myKeyGoesHere", this);

    buyButton = (Button) findViewById(R.id.buyButton);

    buyButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {

                bp.purchase(MainActivity.this, "mypurchasekey");

            }
        }
    });


}


@Override
public void onProductPurchased(@NonNull String productId, @Nullable TransactionDetails details) {

    Toast.makeText(getApplicationContext(), "Successfully Purchased",
            Toast.LENGTH_LONG).show();

}

@Override
public void onPurchaseHistoryRestored() {

}

@Override
public void onBillingError(int errorCode, @Nullable Throwable error) {

    Toast.makeText(getApplicationContext(), "Billing Error",
            Toast.LENGTH_LONG).show();

}

@Override
public void onBillingInitialized() {

}


@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    if (!bp.handleActivityResult(requestCode, resultCode, data)) {
        super.onActivityResult(requestCode, resultCode, data);
    }
}

@Override
public void onDestroy() {
    if (bp != null) {
        bp.release();
    }
    super.onDestroy();
}

}

购买前出现的弹出窗口显示正确的金额,我已将税金纳入金额。金额/显示为3.99和8.00从我的银行帐户中删除了?

我尝试了解更多相关信息,但找不到任何信息?

请帮忙吗?

0 个答案:

没有答案