如何在paypal中报告应用android的描述?
我正在用android做一个应用程序。我使用PayPalPayment.class与paypal连接,我想报告更多详细信息中显示的她的销售描述 我的部分代码:如何在paypal中报告应用android的描述?,android,paypal,Android,Paypal,我正在用android做一个应用程序。我使用PayPalPayment.class与paypal连接,我想报告更多详细信息中显示的她的销售描述 我的部分代码: PayPalPayment thingToBuy = new PayPalPayment(new BigDecimal("4.99"), "EUR", "Datos de contacto - "+pro.getTitulo()); Intent intent = new Intent(InfoProyecto.this, Paymen
PayPalPayment thingToBuy = new PayPalPayment(new BigDecimal("4.99"), "EUR", "Datos de contacto - "+pro.getTitulo());
Intent intent = new Intent(InfoProyecto.this, PaymentActivity.class);
intent.putExtra(PaymentActivity.EXTRA_PAYPAL_ENVIRONMENT, CONFIG_ENVIRONMENT);
intent.putExtra(PaymentActivity.EXTRA_CLIENT_ID, CONFIG_CLIENT_ID);
intent.putExtra(PaymentActivity.EXTRA_RECEIVER_EMAIL, CONFIG_RECEIVER_EMAIL);
// It's important to repeat the clientId here so that the SDK has it if Android restarts your
// app midway through the payment UI flow.
intent.putExtra(PaymentActivity.EXTRA_CLIENT_ID, "APP-80W284485P519543T");
intent.putExtra(PaymentActivity.EXTRA_PAYER_ID, "your-customer-id-in-your-system");
intent.putExtra(PaymentActivity.EXTRA_PAYMENT, thingToBuy);
startActivityForResult(intent, 0);
这样试试
Intent intent = new Intent(this, PayPalService.class);
intent.putExtra(PaymentActivity.EXTRA_PAYPAL_ENVIRONMENT, CONFIG_ENVIRONMENT);
intent.putExtra(PaymentActivity.EXTRA_CLIENT_ID, CONFIG_CLIENT_ID);
intent.putExtra(PaymentActivity.EXTRA_RECEIVER_EMAIL, CONFIG_RECEIVER_EMAIL);
startService(intent);
外部onCreate()
谢谢你的回答。现在,我如何使用“支付密钥”@carlosierrargarcia u将在成功支付后获得一个
交易ID
(支付ID)
public void onBuyPressed(View pressed) {
Double amount=Double.parseDouble(Amount.toString());
PayPalPayment thingToBuy = new PayPalPayment(new BigDecimal(String.valueOf(amount)), "NOK","ITEM_S");
Intent intent = new Intent(this, PaymentActivity.class);
intent.putExtra(PaymentActivity.EXTRA_PAYPAL_ENVIRONMENT, CONFIG_ENVIRONMENT);
intent.putExtra(PaymentActivity.EXTRA_CLIENT_ID, CONFIG_CLIENT_ID);
intent.putExtra(PaymentActivity.EXTRA_RECEIVER_EMAIL, CONFIG_RECEIVER_EMAIL);
intent.putExtra(PaymentActivity.EXTRA_PAYMENT, thingToBuy);
startActivityForResult(intent, 0);
}
public void onBuyPressed(View pressed) {
Double amount=Double.parseDouble(Amount.toString());
PayPalPayment thingToBuy = new PayPalPayment(new BigDecimal(String.valueOf(amount)), "NOK","ITEM_S");
Intent intent = new Intent(this, PaymentActivity.class);
intent.putExtra(PaymentActivity.EXTRA_PAYPAL_ENVIRONMENT, CONFIG_ENVIRONMENT);
intent.putExtra(PaymentActivity.EXTRA_CLIENT_ID, CONFIG_CLIENT_ID);
intent.putExtra(PaymentActivity.EXTRA_RECEIVER_EMAIL, CONFIG_RECEIVER_EMAIL);
intent.putExtra(PaymentActivity.EXTRA_PAYMENT, thingToBuy);
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));
JSONObject json=confirm.toJSONObject();
JSONObject payment=json.getJSONObject("payment");
String product=payment.getString("short_description");
String amount=payment.getString("amount").substring(0, 5);
String currency_code=payment.getString("currency_code");
//Toast.makeText(getBaseContext(), "Payment for "+product+" is done sucessfully. Amount of "+amount+" "+currency_code+" has been charged ..!!" , Toast.LENGTH_LONG).show();
tv.setText( getResources().getString(R.string.Payment_for)+product+""+getResources().getString(R.string.has_been_charge)+""+getResources().getString(R.string.Amount)+amount+
" "+currency_code+getResources().getString(R.string.has_been_charge));
new ACtivate_POST().execute();
} catch (JSONException e) {
Log.e("paymentExample", "an extremely unlikely failure occurred: ", e);
}
}
}
else if (resultCode == Activity.RESULT_CANCELED) {
Log.i("paymentExample", "The user canceled.");
Toast.makeText(this,"transaksjonen avbrutt.",Toast.LENGTH_LONG).show();
}
else if (resultCode == PaymentActivity.RESULT_PAYMENT_INVALID) {
Log.i("paymentExample", "An invalid payment was submitted. Please see the docs.");
Toast.makeText(this,"En ugyldig betalingen ble sendt. Vennligst se docs.",Toast.LENGTH_LONG).show();
}
}