I've integrated the new paypal checkout order using smart payment buttons (https://developer.paypal.com/docs/checkout/#). It's working quite well allowing me to let the User pay with a Credit Card or SEPA without a paypal account:
paypal.Buttons({
// ...
createOrder(data, actions) {
},
// ...
onApprove(data, actions) {
// data.orderID available here
Now in the User's order overview I want to display which type of payment was used and not only that they used paypal to pay me.
However I cannot find a way to get that information using the @paypal/checkout-server-sdk
nor the paypal-rest-sdk
because all I have is the CheckoutOrder
and the Capture
objects.
The orderID from the client can be used in my backend to get the Order details:
paypalCheckoutSdk.orders.OrdersGetRequest(payload.orderID)
But all I get is this stuff:
"result": {
"id": "6CC44267CA709615A",
"intent": "CAPTURE",
"purchase_units": [{
"reference_id": "default",
"amount": { ... },
"payee": { ... },
"shipping": {
"name": { ... },
"address": { ... }
},
"payments": {
"captures": [{
"id": "2GP872418N1179401",
"status": "COMPLETED",
"amount": { ... },
"final_capture": true,
"seller_protection": {...},
"links": [...],
...
}]
}
}],
"payer": { ... },
"status": "COMPLETED"
}
No information about the credit card that was used, not even that is was a credit card and not a paypal account.
If I try to use the paypal-rest-sdk the Order cannot even be found by that ID. Must be some special checkout order.
The Capture object paypalOrder.result.purchase_units[0].payments.captures[0].id
does not help either. It's quite bare and offers nothing that the Order did not already tell me. No link to anywhere. The captureId does not allow me to search for a transaction or payment.
If I log into the sandbox seller account, the order does not show which payment type was used either. Is that information just lost? Or is there a way to retrieve it?
Thanks!