嗨,我有使用 paypal sdk 的移动应用程序,
我已经创建了使用 paypal 配置我的应用程序,所有过程都很顺利,但是付款完成后我只得到 PayerId 和 OrderId,
对于 PaymentId 我得到了 null ,
付款 ID 对我来说非常重要,因为我将其发送到我的服务器以检查付款是否为客户端处理服务器。
这是我的应用配置
config = new CheckoutConfig(
getApplication(),
"APP_PAYPAL_CLIENT_ID",
Environment.SANDBOX,
String.format("%s://paypalpay", "APPLICATION_ID"),
CurrencyCode.USD,
UserAction.PAY_NOW,
new SettingsConfig(
true,
false
)
);
PayPalCheckout.setConfig(config);
payPalButton = findViewById(R.id.payPalButton);
payPalButton.setup(
new CreateOrder() {
@Override
public void create(@NotNull CreateOrderActions createOrderActions) {
ArrayList purchaseUnits = new ArrayList<>();
purchaseUnits.add(
new PurchaseUnit.Builder()
.amount(
new Amount.Builder()
.currencyCode(CurrencyCode.USD)
.value("10.00")
.build()
)
.build()
);
Order order = new Order(
OrderIntent.CAPTURE,
new AppContext.Builder()
.userAction(UserAction.PAY_NOW)
.build(),
purchaseUnits
);
createOrderActions.create(order, (CreateOrderActions.OnOrderCreated) null);
}
},
new OnApprove() {
@Override
public void onApprove(@NotNull Approval approval) {
approval.getOrderActions().capture(new OnCaptureComplete() {
@Override
public void onCaptureComplete(@NotNull CaptureOrderResult result) {
Log.i("CaptureOrder", String.format("CaptureOrderResult: %s", result));
Log.i("CaptureOrder", String.format("CaptureOrderResult: %s", approval.getData().getOrderId()));
Log.i("CaptureOrder", String.format("CaptureOrderResult: %s", approval.getData().getPaymentId()));
Log.i("CaptureOrder", String.format("CaptureOrderResult: %s", approval.getData().getPayerId()));
}
});
}
}
);