I coded an ecommerce script based on express js (NodeJs). before i was able to make the payment via paypal (sandbox) but after a week of coding right now every time i try to purchase something from the script via paypal i got this errors
{
name: 'COMPLIANCE_VIOLATION',
message: 'Transaction is declined due to compliance violation.',
information_link: 'https://developer.paypal.com/docs/api/payments/#errors',
debug_id: '9ebba0bda94ee',
httpStatusCode: 400
}
(node:1226) UnhandledPromiseRejectionWarning: Error: Response Status : 400
at IncomingMessage.<anonymous> (/Users/ismail/Desktop/expressjs-blank/node_modules/paypal-rest-sdk/lib/client.js:130:23)
at IncomingMessage.emit (events.js:215:7)
at endReadableNT (_stream_readable.js:1184:12)
at processTicksAndRejections (internal/process/task_queues.js:80:21)
(node:1226) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:1226) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
2
Answers
There are many possible reasons for a compliance violation.
If you were to receive this error in the live environment, you may need to add an auto withdrawal method to the account (such as a bank account or local Visa card that supports withdrawals), among other possible reasons. You would have to contact PayPal for further support in identifying the reason for the violation.
Since your question is for the sandbox environment, simply try your testing with a receiver Business account from a different country, for example US or UK. Create one at https://www.paypal.com/signin?intent=developer&returnUri=https%3A%2F%2Fdeveloper.paypal.com%2Fdeveloper%2Faccounts%2F , and then an app with a ClientID/Secret for it at https://developer.paypal.com/developer/applications
Try to create new sandbox business account and use it’s credentials (cliend_id, secret) instead of default sandbox business account credentials.
I faced this problem and this help me :).