Hi i have mobile application using paypal sdk ,
i have create configure my application with paypal , all proccess going well but when the payment done i get only PayerId and OrderId ,
for PaymentId i got null ,
the payment id very important for me because i'm sending it to my server to check if payment done proccess the server for client .
this is my app config
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()));
}
});
}
}
);
CodePudding user response:
Finally, I found the solution :
- In the new PayPal
Native-CheckoutAndroid SDK, they don't providepaymentId; you can only getPuyerIdandOrderId - I use the
OrderId; I send theOrderIdto my server then. I use PayPal PHP SDK V2 to get the Order details response, which hasPaymentIdand all other payment information.
CodePudding user response:
It will not be in the approval object, it will be in the capture result since it is created after capture. You are already logging the result so you should see the data there or via one of its methods.
Look for a capture id, which has the same 17 alphanumeric format as an order id but is a different value. The capture id corresponds to the PayPal transaction id used for accounting purposes in PayPal.com details , reports, and email notifications to the receiver.
(The order id is only used during approval and there is no reason to store it permanently, it's only useful for debug purposes)
