Search code examples
paypalpaypal-sandbox

I can't find out transaction history in sandbox use paypal checkout-sdk


I use java checkout-sdk-1.0.4 to develop PayPal payment. I successfully submit an order to PayPal, get the payment url.

I log in with personal account and click the continue button.

enter image description here

And then paypal just redirect to the url i set.

http://localhost:38001/checkout/submit/result?token=60X99286YV4394812&PayerID=9WXE2YPSNEJSN

I can see the api call history in developer dashboard. enter image description here

But i can't see any transaction history in my business account and personal account. enter image description here

How do I determine if my payment is successful。


I try this tutorial from here

https://developer.paypal.com/docs/business/checkout/server-side-api-calls/create-order/

https://developer.paypal.com/docs/business/checkout/server-side-api-calls/capture-order/

At the end, paypal return capture success.

Status Code: 201
Status: COMPLETED
Order ID: 1AL061567P026410J
Links: 
    self: https://api.sandbox.paypal.com/v2/checkout/orders/1AL061567P026410J
Capture ids:
    6NY33838LX3268618

But i still can't see transaction history in my personal test account. enter image description here


Solution

  • But I can't see any transaction history in my business account and personal account. enter image description here

    You can't see any transaction because there is no transaction. There won't be any, unless you show the required order review page and perform the required capture API call when the customer returns to your site. (if you want to skip showing a review page and proceed directly with making the API call, then you should set the application_context object's user_action to 'PAY_NOW', so the last button's text is changed from 'Continue' to 'Pay Now' and the user knows to expect no review page. You still need to perform the API call to capture regardless).


    The flow you are using of redirecting over to PayPal and then showing a review page or doing a capture call after being redirected back, is an old checkout flow and does not provide the best user experience. It is better to not use any redirects. At all.

    Instead, make two routes on your server, one for 'Create Order' and one for 'Capture Order', documented here. These routes should return only JSON data (no HTML or text). The latter one should (on success) store the payment details in your database before it does the return (particularly purchase_units[0].payments.captures[0].id, the PayPal transaction ID)

    Pair those two routes with the following approval flow: https://developer.paypal.com/demo/checkout/#/pattern/server