2012-08-06 2 views
1

J'ai été intégré paypal dans mon application android mais ça ne marche pas. il y a un bouton sur le clic de ce bouton passer à paypal où demander un paiement onclick de paypal buttom écran de connexion rarement ouvert rarement et quand cliquez sur l'écran de connexion ouvrir après entrée login message d'enregistrement montre connexion échouer s'il vous plaît voir quelqu'un où je me trompe le code est le suivant: -Pourquoi l'intégration paypal ne fonctionne pas?

private LinearLayout mainLayout = null; 

@Override 
protected void onCreate(Bundle savedInstanceState) { 
    super.onCreate(savedInstanceState); 

    System.out.println("inside"); 
    callPayment(); 
    setContentView(mainLayout); 
} 

private void initializePayPal() 
{ 

} 
private void callPayment() 
{ 
    mainLayout= new LinearLayout(this); 
    PayPal mpaypal = PayPal.initWithAppID(this, "APP-80W284485P519543T", PayPal.ENV_SANDBOX); 
    LinearLayout layoutSimplePayment = new LinearLayout(this); 

    layoutSimplePayment.setLayoutParams(new LayoutParams(130,100)); 

    layoutSimplePayment.setOrientation(LinearLayout.VERTICAL); 
    CheckoutButton getpaypalbutton =mpaypal.getPaymentButton(PayPal.BUTTON_152x33,this,PayPal.PAYMENT_TYPE_HARD_GOODS); 
    getpaypalbutton.setOnClickListener(this); 

    layoutSimplePayment.addView(getpaypalbutton); 

    mainLayout.addView(layoutSimplePayment); 
} 

@Override 
public void onClick(View v) 
{ 
    PayPalPayment mpaypalpayment = new PayPalPayment(); 
    mpaypalpayment.setAmount(0.2f); 
    mpaypalpayment.setCurrency("USD"); 
    mpaypalpayment.setRecipient("[email protected]"); 
    mpaypalpayment.setItemDescription("mother board"); 
    mpaypalpayment.setMerchantName("BidNear"); 
    Intent checkoutIntent = new Intent(this, PayPalActivity.class); 
    checkoutIntent.putExtra(PayPalActivity.EXTRA_PAYMENT_INFO, mpaypalpayment); 
    this.startActivityForResult(checkoutIntent, 1); 
} 

@Override 
protected void onActivityResult(int requestCode, int resultCode, Intent data) 
{ 
    switch(resultCode) { 
    case Activity.RESULT_OK: 
    //The payment succeeded 
    String transactionID = data.getStringExtra(PayPalActivity.EXTRA_TRANSACTION_ID); 
    //Tell the user their payment succeeded 
    //Tel break; 
    Toast.makeText(this,"Success"+transactionID,Toast.LENGTH_LONG).show(); 

    case Activity.RESULT_CANCELED: 
    //The payment was canceled 
    //Tell the user their payment was canceled 
    break; 
    case PayPalActivity.RESULT_FAILURE: 
    //The payment failed -- we get the error from the EXTRA_ERROR_ID and EXTRA_ERROR_MESSAGE 
    String errorID = data.getStringExtra(PayPalActivity.EXTRA_ERROR_ID); 
    String errorMessage = data.getStringExtra(PayPalActivity.EXTRA_ERROR_MESSAGE); 
    Toast.makeText(this,"Failure"+"errorid"+errorID+"errormessage"+errorMessage,Toast.LENGTH_LONG).show(); 
    //Tell the user their payment was failed. 
    } 
} 
+0

est-ce pas l'intégration Paypal contre le TOS Android. J'avais l'impression que les achats in-app devaient passer par "PLAY", le marché Google. – trgraglia

+0

avez-vous ajouté l'activité dans le manifeste? – Android2390

Répondre