Paypal不允许非美国开发人员使用REST API.所以我留下的选择是经典的API.这就是问题所在.我不知道如何使用它们.
我打算使用NVP API.我不知道怎么做但下面是我计划做的方式的流程图.我需要在checkout.java上设置项目编号,描述,价格等,然后发送到www.domain.com/setsessions.PHP
我不确定它是否会起作用.但即使它可以,那么我想知道新的’意图’如何检测用户是否已成功付款,付款失败或取消付款.
我需要帮助.这真是令人沮丧……已经尝试将paypal整合近2周.感觉如此无益
这还好吗?还是有更好的方法?
我的要求是设置发票编号,项目编号,价格,位置,这些都是应用程序所需的.
public class PizzaMain extends Activity implements OnClickListener { /** Called when the activity is first created. */ @OverrIDe public voID onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentVIEw(R.layout.main); PayPal ppObj = PayPal.initWithAppID(this.getBaseContext(),"APP-80W284485P519543T",PayPal.ENV_NONE); Checkoutbutton launchPayPalbutton = ppObj.getCheckoutbutton(this,PayPal.button_152x33,Checkoutbutton.TEXT_PAY); relativeLayout.LayoutParams params = new relativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT); params.addRule(relativeLayout.CENTER_HORIZONTAL); launchPayPalbutton.setLayoutParams(params); launchPayPalbutton.setonClickListener(this); ((relativeLayout) findVIEwByID(R.ID.mRlayout1)).addVIEw(launchPayPalbutton); } @OverrIDe public voID onClick(VIEw v) { // Todo auto-generated method stub PayPalPayment newPayment = new PayPalPayment(); char val[] = { '5','0' }; BigDecimal obj_0 = new BigDecimal(val); newPayment.setSubtotal(obj_0); newPayment.setCurrencyType("USD"); newPayment.setRecipIEnt("my@email.com"); newPayment.setMerchantname("My Company"); Intent paypalintent = PayPal.getInstance().checkout(newPayment,this); this.startActivityForResult(paypalintent,1); } @SuppressWarnings("unused") @OverrIDe public voID onActivityResult(int requestCode,int resultCode,Intent data) { switch (resultCode) { case Activity.RESulT_OK: // The payment succeeded String payKey = data.getStringExtra(PayPalActivity.EXTRA_PAY_KEY); // Tell the user their payment succeeded break; 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); // Tell the user their payment was Failed. break; } }}
并在AndroIDManifest.xml文件中提供以下权限.
<uses-permission androID:name="androID.permission.INTERNET"/><uses-permission androID:name="androID.permission.READ_PHONE_STATE"/>
并将Activity添加到AndroIDManifest.xml文件中.
<activity androID:name="com.paypal.androID.MEP.PayPalActivity" androID:configChanges="keyboardHIDden|orIEntation" androID:theme="@androID:style/theme.Translucent.NoTitlebar" />
将PayPal_MPL.jar Jar文件作为参考库添加到您的应用程序中
总结以上是内存溢出为你收集整理的如何使用webview将paypal集成到Android应用程序全部内容,希望文章能够帮你解决如何使用webview将paypal集成到Android应用程序所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)