public static void getRewardsBalance ( final BraintreeFragment fragment , final String nonce , final String currencyIsoCode ) { fragment . waitForConfiguration ( new ConfigurationListener ( ) { @ Override public void onConfigurationFetched ( Configuration configuration ) { String getRewardsBalanceUrl = Uri . parse ( AMEX_REWARDS_BALANCE_PATH ) . buildUpon ( ) . appendQueryParameter ( "paymentMethodNonce" , nonce ) . appendQueryParameter ( "currencyIsoCode" , currencyIsoCode ) . build ( ) . toString ( ) ; fragment . sendAnalyticsEvent ( "amex.rewards-balance.start" ) ; fragment . getHttpClient ( ) . get ( getRewardsBalanceUrl , new HttpResponseCallback ( ) { @ Override public void success ( String responseBody ) { fragment . sendAnalyticsEvent ( "amex.rewards-balance.success" ) ; try { fragment . postAmericanExpressCallback ( AmericanExpressRewardsBalance . fromJson ( responseBody ) ) ; } catch ( JSONException e ) { fragment . sendAnalyticsEvent ( "amex.rewards-balance.parse.failed" ) ; fragment . postCallback ( e ) ; } } @ Override public void failure ( Exception exception ) { fragment . postCallback ( exception ) ; fragment . sendAnalyticsEvent ( "amex.rewards-balance.error" ) ; } } ) ; } } ) ; }
Gets the rewards balance associated with a Braintree nonce . Only for American Express cards .