如何在Android应用程序中集成Paypal?
我尝试使用沙箱将 PayPal 与 Android 应用程序集成。我成功地渴望使用贝宝,但当我进行付款时,屏幕将直接变得不可见,而没有响应。
我怎样才能得到上述问题的答复?
这是我的代码。
private void invokeSimplePayment()
{
try
{
PayPalPayment payment = new PayPalPayment();
payment.setSubtotal(new BigDecimal(Amt));
payment.setCurrencyType(Currency_code[code]);
payment.setRecipient("Rec_Email");
payment.setPaymentType(PayPal.PAYMENT_TYPE_GOODS);
Intent checkoutIntent = PayPal.getInstance().checkout(payment, this);
startActivityForResult(checkoutIntent, request);
}
catch (Exception e)
{
e.printStackTrace();
}
}
public void onActivityResults(int requestCode, int resultCode, Intent data)
{
switch(resultCode)
{
case Activity.RESULT_OK:
resultTitle = "SUCCESS";
resultInfo = "You have successfully completed this " ;
//resultExtra = "Transaction ID: " + data.getStringExtra(PayPalActivity.EXTRA_PAY_KEY);
break;
case Activity.RESULT_CANCELED:
resultTitle = "CANCELED";
resultInfo = "The transaction has been cancelled.";
resultExtra = "";
break;
case PayPalActivity.RESULT_FAILURE:
resultTitle = "FAILURE";
resultInfo = data.getStringExtra(PayPalActivity.EXTRA_ERROR_MESSAGE);
resultExtra = "Error ID: " + data.getStringExtra(PayPalActivity.EXTRA_ERROR_ID);
}
System.out.println("Result=============="+resultTitle);
System.out.println("ResultInfo=============="+resultInfo);
}
I try to integrate paypal with Android app using sandbox. I'm getting successfully longing with paypal but when I am doing payment then Screen will get invisible directly without Response.
How can I get the response for the above question?
This is my code.
private void invokeSimplePayment()
{
try
{
PayPalPayment payment = new PayPalPayment();
payment.setSubtotal(new BigDecimal(Amt));
payment.setCurrencyType(Currency_code[code]);
payment.setRecipient("Rec_Email");
payment.setPaymentType(PayPal.PAYMENT_TYPE_GOODS);
Intent checkoutIntent = PayPal.getInstance().checkout(payment, this);
startActivityForResult(checkoutIntent, request);
}
catch (Exception e)
{
e.printStackTrace();
}
}
public void onActivityResults(int requestCode, int resultCode, Intent data)
{
switch(resultCode)
{
case Activity.RESULT_OK:
resultTitle = "SUCCESS";
resultInfo = "You have successfully completed this " ;
//resultExtra = "Transaction ID: " + data.getStringExtra(PayPalActivity.EXTRA_PAY_KEY);
break;
case Activity.RESULT_CANCELED:
resultTitle = "CANCELED";
resultInfo = "The transaction has been cancelled.";
resultExtra = "";
break;
case PayPalActivity.RESULT_FAILURE:
resultTitle = "FAILURE";
resultInfo = data.getStringExtra(PayPalActivity.EXTRA_ERROR_MESSAGE);
resultExtra = "Error ID: " + data.getStringExtra(PayPalActivity.EXTRA_ERROR_ID);
}
System.out.println("Result=============="+resultTitle);
System.out.println("ResultInfo=============="+resultInfo);
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
这是我的代码并且运行良好。有两个班。
对于从沙箱到实时环境的
PayPal
,您必须做两件事:将实际帐户持有人放入设置的接收者中,并通过将您的应用程序提交到PayPal
来获取实时 ID主类:
This is my code and it works fine. There are two classes.
For
PayPal
from sandbox to live environment you have to do 2 things: put the actual account holder in set recipient and get a live ID by submitting your app toPayPal
The main class :
PayPal 为开发者推出 Android SDK
https://www.paypal-launches-android-sdk-for-developers/" paypal-forward.com/innovation/paypal-launches-android-sdk-for-developers/
文档在这里:
https://developer.paypal.com/webapps/developer/文档/集成/移动/android-integration-guide/
PayPal Launches Android SDK for Developers
https://www.paypal-forward.com/innovation/paypal-launches-android-sdk-for-developers/
The documentation Here:
https://developer.paypal.com/webapps/developer/docs/integration/mobile/android-integration-guide/