He terminado una app, hice las pruebas con sandbox y todo bien, al momento de cambiar a ENVIRONMENT_PRODUCTION no tuve problemas, pero al iniciar sesión me dice error de inicio de sesión.
He verificado las credenciales de usuario y las de desarrollador en paypal live y todo esta bien, Mi cuenta es de argentina y estan deshabilitadas las 3 ultimas opciones de paypal live.
Direct credit cards Accept payments from customers directly using their credit cards on your web or mobile app.
Future Payments Use virtual tokens to save customer payment information.
Payouts Payout up to 500 recipients in one API Call.
En la consola veo este mensaje
E/paypal.sdk: request failure with http statusCode:401,exception:org.apache.http.client.HttpResponseException: Unauthorized
E/paypal.sdk: request failed with server response:{"error":"invalid_user","error_description":"Invalid user credentials"}
E/PayPalService: invalid_user
MainActivity.java
public class MainActivity extends Activity implements OnClickListener{
private Button pay;
private static final String CONFIG = PayPalConfiguration.ENVIRONMENT_PRODUCTION;
private static final String CLIENT_ID = "AS28yU-cXWZuh-vVJ1TJUvWcdF4HpywXmBv2STQw4PeFSgC91hCt9UkC7tViiTMbAXs-pij14AFDjUhB";
private static final int REQUEST_PAYMENT = 1;
private static PayPalConfiguration config = new PayPalConfiguration()
.environment(CONFIG)
.clientId(CLIENT_ID)
.merchantName("MultiAndroid zone")
.merchantPrivacyPolicyUri(Uri.parse("http://www.example.com/privacy"))
.merchantUserAgreementUri(Uri.parse("http://www.example.com/legal"));
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
pay = (Button)findViewById(R.id.button1);
pay.setOnClickListener(this);
Intent intent = new Intent(this,PayPalService.class);
intent.putExtra(PayPalService.EXTRA_PAYPAL_CONFIGURATION, config);
startService(intent);
}
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
switch (v.getId()){
case R.id.button1:
PayPalPayment item = new PayPalPayment(new BigDecimal(1), "USD", "MultiAndroid zone",PayPalPayment.PAYMENT_INTENT_SALE);
Intent in = new Intent(MainActivity.this,PaymentActivity.class);
in.putExtra(PaymentActivity.EXTRA_PAYMENT,item);
startActivityForResult(in, REQUEST_PAYMENT);
break;
}
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
// TODO Auto-generated method stub
if (requestCode == REQUEST_PAYMENT){
if(resultCode == Activity.RESULT_OK){
PaymentConfirmation confirm = data.getParcelableExtra(PaymentActivity.EXTRA_RESULT_CONFIRMATION);
if(confirm== null){
try {
System.out.println("Responses" +confirm) ;
Log.i("PayPal Example Payments" , confirm.toJSONObject().toString());
JSONObject obj = new JSONObject(confirm.toJSONObject().toString());
String paymentID=obj.getJSONObject("response").getString("id");
System.out.println("payment id:-=="+paymentID);
Toast.makeText(getApplicationContext(), paymentID ,Toast.LENGTH_LONG).show();
}catch(JSONException e){
Log.e("Payment", "failure occured:",e);
}
}
}else if(requestCode == Activity.RESULT_CANCELED){
Log.i("Paymentdemo","The user cancelled");
}else if(requestCode == PaymentActivity.RESULT_EXTRAS_INVALID){
Log.i("paymentdemo","Invalid payment Submitted");
}
}
}}
dependencies
dependencies {
compile 'com.android.support:support-v4:18.0.0'
compile('com.paypal.sdk:paypal-android-sdk:2.12.5')
}