嗨,我正在使用braintree,并尝试通过快速结帐来获得现时数据。但是问题是,我的付款屏幕可以打开,但是在我的日志中,我什么地方都看不到现时的现象。还有一个问题是付款后,我想重定向到我的片段之一,但它没有重定向。有人可以帮我吗?
https://github.com/braintree/braintree_android/issues/199
public void setupBraintreeAndStartExpressCheckout() {
PayPal.requestOneTimePayment(mBraintreeFragment, getPayPalRequest(rus.replace("$","").replace(" ","")));
}
private PayPalRequest getPayPalRequest(@Nullable String amount) {
PayPalRequest request = new PayPalRequest(amount);
request.currencyCode("USD");
request.displayName(preference.getUserName(this));
request.landingPageType(PayPalRequest.LANDING_PAGE_TYPE_LOGIN);
request.userAction(PayPalRequest.USER_ACTION_COMMIT);
// request.intent(PayPalRequest.INTENT_SALE);
return request;
}
@Override
public void onPaymentMethodNonceCreated(PaymentMethodNonce paymentMethodNonce) {
// Send nonce to server
nonce = paymentMethodNonce.getNonce();
if (paymentMethodNonce instanceof PayPalAccountNonce) {
PayPalAccountNonce payPalAccountNonce = (PayPalAccountNonce)paymentMethodNonce;
// payPalAccountNonce.getPayerId()
String paymentNonce = payPalAccountNonce.getNonce();
Intent intent = new Intent()
.putExtra("tests", paymentMethodNonce);
getActivity().setResult(Activity.RESULT_OK, intent);
getActivity().finish();
}
}
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
//If the result is from paypal
//If the result is OK i.e. user has not canceled the payment
if (resultCode == RESULT_OK) {
//Getting the payment confirmation
Parcelable returnedData = data.getParcelableExtra("tests");
if (returnedData instanceof PaymentMethodNonce) {
String paymentNonce = ((PaymentMethodNonce) returnedData).getNonce();
System.out.println("NONCE CREATED"+nonce);
bModel bm=new bModel ();
orderid=bm.getOrderid();
MyFrags myfrag = new MyFrags();
Bundle bundle = new Bundle();
bundle.putString("OrderID", orderid);
bundle.putString("PaypalStatus", paymentNonce);
myfrag.setArguments(bundle);
addFragment(R.id.activity_home_fl_container, BuyerMembershipDetailFragment.this, myfrag, true, false);
}}}