0

以下のコードを使用して取得しようとしauth Access tokenました。このコードに基づいて、Paypal の完全なトランザクションの詳細を取得します。以下のコードは Lollipop 以降では正常に動作しますが、バージョン以下の Lolipop でアプリを実行すると、Paypal SDK から応答がありません。この問題について多くの研究開発を行いました。解決策を教えてください。Lollipop以降の私の作業コード:

public void getAcessToken(final String PayID) {

        base64 = "Basic " + Base64.encodeToString((URLs.PAYPAL_CLIENTID + ":" + URLs.PAYPAL_SECRET_KEY).getBytes(), Base64.NO_WRAP);
        Log.i("TAG", "Base64=" + base64);
        if (!CM.isInternetAvailable(this)) {
            CM.showPopupCommonValidation(this, getResources().getString(R.string.internet_unavailable_msg), false);
            return;
        }
        showDialog();
        String url = "https://api.sandbox.paypal.com/v1/oauth2/token";
        Log.i("WebCalls", url);
        StringRequest stringRequest = new StringRequest(Request.Method.POST,
                url,
                new Response.Listener<String>() {
                    @Override
                    public void onResponse(String response) {
                        KcsLog.i("WebCalls", response.toString());
                        String AccessToken = CM.getValueFromJson("access_token", response);
                        String token_type = CM.getValueFromJson("token_type", response);
                        GetTransactionID(token_type + " " + AccessToken, PayID);
                    }
                }, new Response.ErrorListener() {
            @Override
            public void onErrorResponse(VolleyError error) {
                dismissDialog();
                CM.showVolleyErrorMessage(error, ViewGiftCode.this, "", false);
            }
        }) {
            @Override
            protected Map<String, String> getParams() throws AuthFailureError {
                Map<String, String> post = new HashMap<String, String>();
                post.put("grant_type", "client_credentials");
                return post;
            }

            @Override
            public Map<String, String> getHeaders() throws AuthFailureError {
                Map<String, String> post = new HashMap<String, String>();
                post.put("Accept", "application/json");
                post.put("Accept-Language", "en_US");
                post.put("Content-Type", "application/x-www-form-urlencoded");
                post.put("Authorization", base64);
                return post;
            }
        };
        ((MainApplications) getApplicationContext()).volley.addToRequestQueue(stringRequest);
    }

以下のロリポップの解決策を教えてください。

4

0 に答える 0