Created
April 4, 2011 14:17
-
-
Save vivdub/901708 to your computer and use it in GitHub Desktop.
Sample file to demonstatrate simple paypal integration
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.paypal; | |
import java.math.BigDecimal; | |
import android.app.Activity; | |
import android.content.Intent; | |
import android.os.Bundle; | |
import android.util.Log; | |
import com.paypal.android.MEP.PayPal; | |
import com.paypal.android.MEP.PayPalPayment; | |
public class Paypal extends Activity { | |
/** Called when the activity is first created. */ | |
@Override | |
public void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
setContentView(R.layout.main); | |
// Intent i = new Intent(this, PaypalExpressCheckout.class); | |
//this.startActivity(i); | |
invokeSimplePayment(); | |
} | |
//=============================================================== | |
private void invokeSimplePayment(){ | |
try{ | |
PayPalPayment newPayment = new PayPalPayment(); | |
newPayment.setSubtotal(BigDecimal.valueOf(10)); | |
newPayment.setCurrencyType("USD"); | |
//.setCurrency("USD"); | |
newPayment.setRecipient("[email protected]"); | |
newPayment.setMerchantName("My Company"); | |
PayPal pp = PayPal.getInstance(); | |
if(pp==null) | |
pp = PayPal.initWithAppID(this, "APP-80W284485P519543T", PayPal.ENV_SANDBOX); | |
Intent paypalIntent = pp.checkout(newPayment, this); | |
this.startActivityForResult(paypalIntent, 1); | |
}catch(Exception e){e.printStackTrace();} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment