Dwolla Php Checkout

214 views Asked by At

I want to accept Dwolla payments on my site. I'm using Php and currently getting the error message "Error: Access token is empty.". Not sure what I'm doing wrong.

Send the users to Dwolla to login.

$apiKey = "mykey";
$apiSecret = "mysecret";
$Dwolla = new DwollaRestClient($apiKey, $apiSecret);

$url = $Dwolla->getAuthUrl();
header("Location: {$url}");

This sends user to Dwolla and they login. I then redirect them to my page and it does have a code value sent as a get string. So I then try and send the payment.

$code = $_GET['code'];
$apiKey = "mykey";
$apiSecret = "mysecret";
$Dwolla = new DwollaRestClient($apiKey, $apiSecret);
$token = $Dwolla->requestToken($code);
$Dwolla->setToken($token);

$pin = $_SESSION['dwolla_pin'];
$destination = '[email protected]';
$amount = $_SESSION['dwolla_amount'];
$notes = 'Testing';

unset($_SESSION['dwolla_amount']);
unset($_SESSION['dwolla_pin']);

$tid = $Dwolla->send($pin, $destination, $amount, $notes);

I really need some help here, thanks!

1

There are 1 answers

0
user2027231 On BEST ANSWER

I got the answer. Enable debugging mode and get the output, this will help walk you through the process of getting the corrections made. Also I had to specifically set my uri!

$Dwolla = new DwollaRestClient($apiKey, $apiSecret, $uri);
$Dwolla->setDebug(true);