public static PayPalPaymentResource fromJson ( String jsonString ) throws JSONException { JSONObject json = new JSONObject ( jsonString ) ; PayPalPaymentResource payPalPaymentResource = new PayPalPaymentResource ( ) ; JSONObject redirectJson = json . optJSONObject ( PAYMENT_RESOURCE_KEY ) ; if ( redirectJson != null ) { payPalPaymentResource . redirectUrl ( Json . optString ( redirectJson , REDIRECT_URL_KEY , "" ) ) ; } else { redirectJson = json . optJSONObject ( AGREEMENT_SETUP_KEY ) ; payPalPaymentResource . redirectUrl ( Json . optString ( redirectJson , APPROVAL_URL_KEY , "" ) ) ; } return payPalPaymentResource ; }
Create a PayPalPaymentResource from a jsonString . Checks for keys associated with Single Payment and Billing Agreement flows .