Paypal payment execute transaction refused - paypal

Everything is good at sandbox environment, but something wrong in production.
First, i created a payment with enough information. It's still good.
Second, I redirect to apprvoved url for end user, user accepted payment.
Lastly, i make a request execute payment within payerId, but i received response error, it's return 400 and message name TRANSACTION_REFUSED.
Anyone help me!
Detail payment: here
Detail error: here

The payment attempt was rejected by PayPal. This error is normal behavior when a payment is declined.
Have the user use a different account or payment method.
Unrelated to the decline issue, you are using a deprecated v1/payments API, which should not be used for any new integrations. Here is how to change to a current v2/checkout/orders integration:
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

Related

What are the returned parameters for the PayPal Success Return

I am integrating PayPal Payments blind, this means I have no means to test, I've researched this more than a lot of times, and I can't seem to find any information about this.
When my client successfully pays me (integrated using REST API), and they are returned to the specified return URL, what are the exact parameters returned, primarily, what are the parameter keys for the Payment ID and the Payer ID.
Thank you for your assistance.
I am integrating PayPal Payments blind, this means I have no means to test
This doesn't make any sense; you should fully test your integration as you develop it, using the PayPal sandbox environment.
Redirecting away from your site is an old way to integrate PayPal, used by old websites. Current integrations do not use any redirects. At all.
Follow the Set up standard payments guide and make 2 routes on your server, one for 'Create Order' and one for 'Capture Order', documented here. Both routes should return only JSON data (no HTML or text). Inside the 2nd route, when the capture API is successful you should store its resulting payment details in your database (particularly purchase_units[0].payments.captures[0].id, which is the PayPal transaction ID) and perform any necessary business logic (such as sending confirmation emails or reserving product) immediately before forwarding your return JSON to the frontend caller.
Pair those 2 routes with the frontend approval flow: https://developer.paypal.com/demo/checkout/#/pattern/server

Upgrading PayPal payment to Orders API, the testing account didn't receive any money after finish the payment

I'm trying to implement the new PayPal Orders API, here is what I did:
Create a developer account, add an app name and then I have Client Id and Secret.
Use OrderCreateRequest to create an Order
Get approvel_url from the resposne->result->links
Redirect to this approvel_url and finish the payment
Paypal will redirect back to my website.
But I never got any thing from the PayPal testing account,Please, what did I miss?
Edit:
On No.4, when redirects to the PayPal page, somehow it only shows 'Continue' button on the page, not the 'make payment' button.
You are missing:
Display an order review page to the payer.
Capture the order with an API call, which (if successful) will return the transaction ID in the purchase_units[0].payments.captures[0] object.
On success, display a thank you/confirmation page.
Without the final capture API call, there is no PayPal transaction.
You are also still using an old integration method based on redirects, which is for old websites. Current PayPal Checkout integrations use no redirects. At all.
Instead of redirecting, 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). When a capture response is successful, store its resulting payment details in your database (particularly purchase_units[0].payments.captures[0].id, the PayPal transaction ID) and perform any necessary business logic (such as sending confirmation emails or reserving product) right before sending your return JSON.
Pair those two routes with the following approval flow: https://developer.paypal.com/demo/checkout/#/pattern/server

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.
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.
But i can't see any transaction history in my business account and personal account.
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.
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

Process PayPal payments lead to Payer has not approved payment error

I have implemented PayPal payment described here
https://developer.paypal.com/docs/api/quickstart/payments/ with provided Java SDK which use API /v1/payments
<dependency>
<groupId>com.paypal.sdk</groupId>
<artifactId>rest-api-sdk</artifactId>
<version>1.14.0</version>
</dependency>
Step1 : Create payment as describe in above link and it will create payment at PayPal and we got approval_url which is shared to customer to complete payment.
Step2 : There is a webhook listener for only one event there
Step3 : when my application receives that event from PayPal then it executes payment as described in above link
This is working for most of the payment case, but few payments, during payment execution following error get occurred.
{"name":"PAYMENT_NOT_APPROVED_FOR_EXECUTION","message":"Payer has not approved payment","information_link":"https://developer.paypal.com/docs/api/payments/#errors","debug_id":"8c19669326adc"}
Now, this is not clean what is different between payment which lead to successful execution and other which lead to failure with "Payer has not approved payment" message. And what should be done to solve issue here?
When an old deprecated API v1/payment (or with the current API, a v2/checkout/order) is created, it is in an unapproved state. For it to be executable (or with v2, capturable) a payer must log into a checkout and approve it.
If no one logs in and approves a payment, it remains in an unapproved state.
When you attempt to 'execute' a payment (or with the current v2/checkout/orders API, 'capture' an order) that has not been approved by a payer, you will receive an error message stating that the payment has not been approved.
You can only execute payments (or capture orders) that have been approved.
For best results, use the current v2/checkout API with an in-context approval flow. 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). When a capture response is successful, store its resulting payment details in your database (particularly purchase_units[0].payments.captures[0].id, the PayPal transaction ID) and perform any necessary business logic (such as sending confirmation emails or reserving product) before sending your return JSON.
Pair those two routes with the following approval flow: https://developer.paypal.com/demo/checkout/#/pattern/server

How to link with Paypal from our website?

When the user signed up on the website (new account) then I would like to give the user the opportunity to link Paypal account on our website so that they can make an order using Paypal payment method.
Is this the correct API documentation https://developer.paypal.com/docs/log-in-with-paypal/integrate/ or I'm I looking at the wrong place?
Log in with PayPal is for logging in. If you want payments for orders, use Checkout with PayPal.
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