Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>This is complete code which will help you to do this paypal functionality. The remaining task for you only is create an account on <a href="https://developer.paypal.com/" rel="nofollow">https://developer.paypal.com/</a></p> <pre><code>{ CheckoutButton launchSimplePayment; PayPal pp; pp = PayPal.getInstance(); if (pp == null) { createPaypalObject(); //pp = PayPal.initWithAppID(this, "APP-80W284485P519543T",PayPal.ENV_SANDBOX); } else { pp.setShippingEnabled(false); launchSimplePayment = pp.getCheckoutButton(this,PayPal.BUTTON_118x24, CheckoutButton.TEXT_PAY); launchSimplePayment.setOnClickListener( this); yourLayout.addView(launchSimplePayment); } } public void createPaypalObject() { pp = PayPal.initWithAppID(this, "APP-80W284485P519543T",PayPal.ENV_SANDBOX); pp.setShippingEnabled(false); launchSimplePayment = pp.getCheckoutButton(this,PayPal.BUTTON_118x24, CheckoutButton.TEXT_PAY); launchSimplePayment.setOnClickListener( this); handler1.sendEmptyMessage(0); } //do this onClick of that payment button { PayPalPayment payment = new PayPalPayment(); payment.setSubtotal(new BigDecimal(price_of_song)); payment.setCurrencyType("USD"); payment.setRecipient("abc@gmail.com"); //this id must be created by you on payment.paypal.com, this is trial id. payment.setPaymentType(PayPal.PAYMENT_TYPE_GOODS); Intent checkoutIntent = PayPal.getInstance().checkout(payment, this); startActivityForResult(checkoutIntent, 1); } /**This function shows the action by payment paypal*/ @Override public void onActivityResult(int requestCode, int resultCode, Intent data) { switch(resultCode) { case Activity.RESULT_OK: //The payment succeeded Toast.makeText(this,"Payment has done successfully",Toast.LENGTH_SHORT).show(); break; case Activity.RESULT_CANCELED: Toast.makeText(this,"Payment has cancled",Toast.LENGTH_SHORT).show(); //The payment was canceled break; case PayPalActivity.RESULT_FAILURE: Toast.makeText(this,"Sorry Payment failed",Toast.LENGTH_SHORT).show(); //The payment failed -- we get the error from the EXTRA_ERROR_ID and EXTRA_ERROR_MESSAGE } super.onActivityResult(requestCode, resultCode, data); } </code></pre> <p>If any query then feel free to ask me anytime.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload