2014-05-24 76 views
0

我在我的Android應用程序中集成了paypal。我已經在沙箱中測試過它轉移Money.It正在按預期工作。問題是它成功付款後沒有顯示任何謝謝屏幕。 感謝您的幫助 enter image description here在貝寶成功付款後不用謝謝你?

這裏是我的代碼

public class Donate extends MainActivity 
{ 
    EditText amount; 

    private static PayPalConfiguration config = new PayPalConfiguration() 
    // Start with mock environment. When ready, switch to sandbox 
    // (ENVIRONMENT_SANDBOX) 
    // or live (ENVIRONMENT_PRODUCTION) 
      .environment(PayPalConfiguration.ENVIRONMENT_SANDBOX) 

      .clientId("ARUADxBbjYlJ7NQhY1Kqmo_8mwUoZHXKswj8Yl4ouFudB5MunhnRiZwHQ0dR"); 

    @Override 
    protected void onCreate(Bundle savedInstanceState) 
    { 
     super.onCreate(savedInstanceState); 
     setContentView(R.layout.donate); 

     Intent intent = new Intent(this, PayPalService.class); 

     intent.putExtra(PayPalService.EXTRA_PAYPAL_CONFIGURATION, config); 

     startService(intent); 
    } 

    public void onBuyPressed(View pressed) 
    { 
     // PAYMENT_INTENT_SALE will cause the payment to complete immediately. 
     // Change PAYMENT_INTENT_SALE to PAYMENT_INTENT_AUTHORIZE to only 
     // authorize payment and 
     // capture funds later. 
     amount = (EditText) findViewById(R.id.amtdon); 
     BigDecimal amt = new BigDecimal(amount.getText().toString()); 

     PayPalPayment payment = new PayPalPayment(amt, "USD", "Donate Remote IT ", PayPalPayment.PAYMENT_INTENT_SALE); 

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

     intent.putExtra(PaymentActivity.EXTRA_PAYMENT, payment); 

     startActivityForResult(intent, 0); 
    } 

    @Override 
    protected void onActivityResult(int requestCode, int resultCode, Intent data) 
    { 
     if (resultCode == Activity.RESULT_OK) 
     { 
      PaymentConfirmation confirm = data.getParcelableExtra(PaymentActivity.EXTRA_RESULT_CONFIRMATION); 
      if (confirm != null) 
      { 
       try 
       { 
        Log.i("paymentExample", confirm.toJSONObject().toString(4)); 

        // TODO: send 'confirm' to your server for verification. 
        // see 
        // https://developer.paypal.com/webapps/developer/docs/integration/mobile/verify-mobile-payment/ 
        // for more details. 

       } 
       catch (JSONException e) 
       { 
        Log.e("paymentExample", "an extremely unlikely failure occurred: ", e); 
       } 
      } 
     } 
     else if (resultCode == Activity.RESULT_CANCELED) 
     { 
      Log.i("paymentExample", "The user canceled."); 
     } 
     else if (resultCode == PaymentActivity.RESULT_EXTRAS_INVALID) 
     { 
      Log.i("paymentExample", "An invalid Payment or PayPalConfiguration was submitted. Please see the docs."); 
     } 
    } 

回答

0

的感謝屏幕前一陣子被淘汰出局。我們計劃添加一個較輕的重量指示,說明付款已成功完成(如烤麪包)。