sandbox: "we're sorry,Things don’t appear to be working at the moment"
GiuTom
Contributor
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Posted on
Jun-28-2018
04:20 AM
environment : sandbox
I use react native, and followed document of express checkout,tested under sandbox
when I was invoking
public void setupBraintreeAndStartExpressCheckout(String amount) { try { PayPalRequest request = new PayPalRequest("1.00"); request.currencyCode("USD"); request.intent(PayPalRequest.INTENT_AUTHORIZE); PayPal.requestOneTimePayment(mBraintreeFragment, request); }catch (Exception e){ onError(e); } }
then jump to website, and login with a sandbox account, after a longtime loading, failed
and got message "we're sorry,Things don’t appear to be working at the moment"
please help me!
here is my code
public class PaypalCheckout extends ReactContextBaseJavaModule implements PaymentMethodNonceCreatedListener, BraintreeErrorListener{ public static BraintreeFragment mBraintreeFragment; private ReactContext context; @Override public String getName() { return "PaypalCheckout"; } public PaypalCheckout(ReactApplicationContext reactContext) { super(reactContext); this.context = reactContext; } private void sendEvent(ReactContext reactContext, String eventName, @Nullable WritableMap params) { reactContext .getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class) .emit(eventName, params); } @ReactMethod protected void onClientTokenFetched(String clientToken,Promise promise) { try { mBraintreeFragment = BraintreeFragment.newInstance(this.getCurrentActivity(), clientToken); promise.resolve(true); } catch (InvalidArgumentException e) { onError(e); promise.reject(e); } } @Override public void onPaymentMethodNonceCreated(PaymentMethodNonce paymentMethodNonce) { // Send nonce to server String nonce = paymentMethodNonce.getNonce(); WritableMap params = Arguments.createMap(); params.putString("nonce",nonce); sendEvent(getReactApplicationContext(),"onPaypalGetNonce",params); if (paymentMethodNonce instanceof PayPalAccountNonce) { PayPalAccountNonce payPalAccountNonce = (PayPalAccountNonce)paymentMethodNonce; // Access additional information String email = payPalAccountNonce.getEmail(); String firstName = payPalAccountNonce.getFirstName(); String lastName = payPalAccountNonce.getLastName(); String phone = payPalAccountNonce.getPhone(); // See PostalAddress.java for details PostalAddress billingAddress = payPalAccountNonce.getBillingAddress(); PostalAddress shippingAddress = payPalAccountNonce.getShippingAddress(); } } // @Override public void onCancel(int requestCode) { WritableMap params = Arguments.createMap(); params.putInt("code",requestCode); sendEvent(getReactApplicationContext(),"onPaypalCancel",params); // Use this to handle a canceled activity, if the given requestCode is important. // You may want to use this callback to hide loading indicators, and prepare your UI for input } @Override public void onError(Exception error) { if (error instanceof ErrorWithResponse) { ErrorWithResponse errorWithResponse = (ErrorWithResponse) error; BraintreeError cardErrors = errorWithResponse.errorFor("creditCard"); WritableMap params = Arguments.createMap(); params.putString("error",errorWithResponse.getMessage()); sendEvent(getReactApplicationContext(),"onPaypalError",params); if (cardErrors != null) { // There is an issue with the credit card. BraintreeError expirationMonthError = cardErrors.errorFor("expirationMonth"); if (expirationMonthError != null) { // There is an issue with the expiration month. } } } } @ReactMethod public void setupBraintreeAndStartExpressCheckout(String amount) { try { PayPalRequest request = new PayPalRequest("1.00"); request.currencyCode("USD"); request.intent(PayPalRequest.INTENT_AUTHORIZE); PayPal.requestOneTimePayment(mBraintreeFragment, request); }catch (Exception e){ onError(e); } } }
1 REPLY 1
CoLeHP
Contributor
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Oct-10-2018
06:50 AM
Haven't Found your Answer?
It happens. Hit the "Login to Ask the community" button to create a question for the PayPal community.