Android 使用PayPal SDK进行个人档案共享和支付的单一登录

Android 使用PayPal SDK进行个人档案共享和支付的单一登录,android,paypal,Android,Paypal,我正在尝试使用PayPalSDK实现即时支付。两个配置文件共享,以获得用户的电子邮件地址和付款工作良好 我面临的问题是,档案共享和支付都需要用户同意。要获得同意,档案共享和支付启动不同的登录屏幕,因此用户需要登录两次才能完成此过程 是否有任何方法可以通过单个登录进行档案共享和付款 以下是我现在正在做的事情: //for payment public void onInstantPaymentPressed() { PayPalPayment th

我正在尝试使用
PayPal
SDK
实现即时支付。两个配置文件共享,以获得用户的电子邮件地址和付款工作良好

我面临的问题是,
档案共享
和支付都需要用户同意。要获得同意,
档案共享
和支付启动不同的登录屏幕,因此用户需要登录两次才能完成此过程

是否有任何方法可以通过单个登录进行
档案共享
和付款

以下是我现在正在做的事情:

//for payment
        public void onInstantPaymentPressed() {

                PayPalPayment thingToBuy = getThingToBuy(PayPalPayment.PAYMENT_INTENT_SALE);

                Intent intent = new Intent(PaypalTransactionActity.this, PaymentActivity.class);

                // send the same configuration for restart resiliency
                intent.putExtra(PayPalService.EXTRA_PAYPAL_CONFIGURATION, config);

                intent.putExtra(PaymentActivity.EXTRA_PAYMENT, thingToBuy);

                startActivityForResult(intent, REQUEST_CODE_PAYMENT);
            }


        private PayPalPayment getThingToBuy(String paymentIntent) {
                return new PayPalPayment(new BigDecimal("50.5"), "USD", "sample item",
                        paymentIntent);
            }


    //for profile sharing
       public void onProfileSharingPressed() {
            Intent intent = new Intent(PaypalTransactionActity.this, PayPalProfileSharingActivity.class);

            // send the same configuration for restart resiliency
            intent.putExtra(PayPalService.EXTRA_PAYPAL_CONFIGURATION, config);

            intent.putExtra(PayPalProfileSharingActivity.EXTRA_REQUESTED_SCOPES, getOauthScopes());

            startActivityForResult(intent, REQUEST_CODE_PROFILE_SHARING);
        }

        private PayPalOAuthScopes getOauthScopes() {
            /* create the set of required scopes
             * Note: see https://developer.paypal.com/docs/integration/direct/identity/attributes/ for mapping between the
             * attributes you select for this app in the PayPal developer portal and the scopes required here.
             */
            Set<String> scopes = new HashSet<String>(
                    Arrays.asList(PayPalOAuthScopes.PAYPAL_SCOPE_EMAIL));
            return new PayPalOAuthScopes(scopes);
        }
//用于付款
onInstantPaymentPressed()上的公共无效{
PayPalPayment thingToBuy=getThingToBuy(PayPalPayment.PAYMENT\u INTENT\u SALE);
意向意向=新意向(PaypalTransactionActity.this,PaymentActivity.class);
//发送相同的重新启动弹性配置
intent.putExtra(PayPalService.EXTRA\u PAYPAL\u配置,config);
意向。额外支付(PaymentActivity.EXTRA_PAYMENT,thingToBuy);
startActivityForResult(意向、请求、代码、付款);
}
私人PayPayment getThingToBuy(字符串paymentIntent){
返回新的PayPalPayment(新的BigDecimal(“50.5”),“USD”,“示例项”,
支付意向);
}
//用于配置文件共享
public void onProfileSharingPressed(){
意向意向=新意向(PaypalTransactionActity.this,PayPalProfileSharingActivity.class);
//发送相同的重新启动弹性配置
intent.putExtra(PayPalService.EXTRA\u PAYPAL\u配置,config);
intent.putExtra(paypaplProfileSharingActivity.EXTRA_请求的_作用域,getOauthScopes());
startActivityForResult(意图、请求、代码、配置文件、共享);
}
私有PayPalOAuthScopes getOauthScopes(){
/*创建所需的作用域集
*注:见https://developer.paypal.com/docs/integration/direct/identity/attributes/ 用于在
*您在PayPal开发者门户中为此应用选择的属性以及此处所需的范围。
*/
Set scopes=newhashset(
asList(paypalouthscopes.PAYPAL_SCOPE_EMAIL));
返回新的PayPalOAuthScopes(scopes);
}