Cockootec
Cockootec

Reputation: 546

PayPal Payout always DENIED (sandbox)

I am trying to test synchronized Payout for my PHP application but response from server is always the same and it points me to INTERNAL_ERROR. I am using paypal/rest-api-sdk-php I believe of version v1.0.0 (composer.json says nothing) - should be the newest in my JSON I have version set to dev-master.

try {
    /** @var PayoutBatch $payoutBatch */
    $payoutBatch = $payout->createSynchronous($apiContext);
} catch (\Exception $ex) {
    echo $ex->getMessage();
}

try {
    /** @var PayoutBatch $response */
    $response = Payout::get($payoutBatch->getBatchHeader()->getPayoutBatchId(), $apiContext);

    $status = $response->getBatchHeader()->getBatchStatus();

    if ($status === "SUCCESS") {
        //do some logic
    }

} catch (\Exception $ex) {
    echo $ex->getMessage();
}

Have any of you experienced this issue?

Also a sub-question, don't PayPal PHP SDK has defined some constants where I can find message statuses?

Upvotes: 0

Views: 1406

Answers (1)

Jay Patel - PayPal
Jay Patel - PayPal

Reputation: 1489

Can you please make sure you have Payouts Enabled in your sandbox environment. This allows you to get the proper scope that is required to make payout calls.

Payout Settings

However, if you have already done that and still failing, can you please try the samples out that are shipped along with SDK.

All you need to do is run one command, and you will have the samples running, as mentioned here

php -f vendor/paypal/rest-api-sdk-php/sample/index.php

This will start a sample server, and allow you to play around it.

enter image description here

It has a payout samples, that you could just click and run. If those works, we can now make one tiny change to get samples to use your clientId and secret. Find samples/bootstrap.php in sdk code, and change those clientId and secret, and run the samples again. If you get a failure, let me know and I could look further into that issue.

Upvotes: 1

Related Questions