Pages:
Author

Topic: Looking for a PHP dev that can give me some Pseudo-code for Dwolla API [2BTC] (Read 4912 times)

legendary
Activity: 980
Merit: 1003
I'm not just any shaman, I'm a Sha256man
sr. member
Activity: 336
Merit: 250
Glad you like the QR-Code, I got it from a QR-Code generator on-line somewhere.

Looks like Nuri won the bounty, I'm going to hook up Mjcmurfy with 1 BTC for being really helpful and getting the ball rolling....

I wasn't in in for the money mate!
Glad you got it all sorted out.
full member
Activity: 143
Merit: 101
where were you two days ago.... Tongue
passed out drunk in the london underground
legendary
Activity: 980
Merit: 1003
I'm not just any shaman, I'm a Sha256man
where were you two days ago.... Tongue
full member
Activity: 143
Merit: 101
Dwolla Devs are telling me SOAP API and OAuth API are deprecated so I guess its back to the REST API where i started.... darn it....
rest owns, soap is the worst trainwreck i've ever seen
legendary
Activity: 980
Merit: 1003
I'm not just any shaman, I'm a Sha256man
Dwolla Devs are telling me SOAP API and OAuth API are deprecated so I guess its back to the REST API where i started.... darn it....
legendary
Activity: 980
Merit: 1003
I'm not just any shaman, I'm a Sha256man
Give me a few hours before bounties are sent guys I'm kind of behind this project. Thanks for your patience

No problem, I'm glad we got through the issue! Tongue

I meant to say nhodges won bounty  Grin
I got your bitcoin address with your forum identity!

It must be a dwolla problem because I have $4 in my dwolla account and It wont let me send money to my self when i use the real API and not the test one.
I get the following error

Quote
object(stdClass)#3 (1) { ["SendMoneyResult"]=> bool(false) }
sr. member
Activity: 322
Merit: 251
Give me a few hours before bounties are sent guys I'm kind of behind this project. Thanks for your patience

No problem, I'm glad we got through the issue! Tongue
legendary
Activity: 980
Merit: 1003
I'm not just any shaman, I'm a Sha256man
Give me a few hours before bounties are sent guys I'm kind of behind this project. Thanks for your patience
legendary
Activity: 980
Merit: 1003
I'm not just any shaman, I'm a Sha256man
Glad you like the QR-Code, I got it from a QR-Code generator on-line somewhere.

Looks like Nuri won the bounty, I'm going to hook up Mjcmurfy with 1 BTC for being really helpful and getting the ball rolling....

sr. member
Activity: 336
Merit: 250
BTW, just scanned your avatar with my smartphone and realized your QR code is encoded with the link to your website.
Thats pretty awesome.
sr. member
Activity: 336
Merit: 250
I tried the following code aswell got a diff error

Code:

//$client = new SoapClient("");
$client = new SoapClient(NULL,
        array(
        "location" => "https://www.dwolla.com/api/API.svc?wsdl",
        "uri"      => "urn:xmethods-delayed-quotes",
        "style"    => SOAP_RPC,
        "use"      => SOAP_ENCODED
           ));
var_dump($client);
$params = array( new SoapParam( 'ApiKey',$apiKey),
new SoapParam('ApiCode', $apiCode),
new SoapParam('Amount' , $amount),
new SoapParam('Description', $description),
new SoapParam('DestinationID',$customerId)
);


try{
$client->__soapCall(serialize("RequestPaymentKey"), $params);
}catch(Exception $e){
echo $e;
echo "ERROR";
}

got the example from here: http://devzone.zend.com/article/689#Heading4


my error is this:
Quote
object(SoapClient)#2 (5) { ["uri"]=> string(27) "urn:xmethods-delayed-quotes" ["style"]=> int(1) ["use"]=> int(1) ["location"]=> string(39) "https://www.dwolla.com/api/API.svc?wsdl" ["_soap_version"]=> int(1) } SoapFault exception: [HTTP] Bad Request in /home/swiftbitcoins/purchase_order.php:38 Stack trace: #0 [internal function]: SoapClient->__doRequest('__soapCall('s:17:"RequestPa...', Array) #2 {main}ERROR

Is there somthing I'm not understanding about soap?

I will be willing to throw in 1 BTC to the person who can get a working code going....

To be honest, that code you derived from the example looks really messy and unlikely to work. I think there is something none of us is understanding about soap! LOL. It's probably something to do with formatting the header correctly, which I have no idea how to do. I'm not a coder by trade, just have a lot of experience with PHP.

nhodges code on stackoverflow might work, you could give that a shot.

But if you are still having trouble, take a look at using their REST API instead of their SOAP API. It uses simpler HTTP GET and POST methods, rather than the complicated SOAP protocol. I believe it also encodes responses in JSON format, so that should be familiar to most devs here. I believe it is still sort of in beta though. Their SOAP API is the bigger brother.

Links for more info:
http://www.dwolla.org/d/showthread.php?2-REST-API
http://www.dwolla.org/d/showthread.php?690-Dwolla-GRID-Start-Here-to-Access-the-GRID
sr. member
Activity: 322
Merit: 251
Updated my StackOverflow answer with a working snippet for you. You might want to refresh your API credentials, too, since you publicized them here.

http://stackoverflow.com/questions/7543582/integrating-dwolla-with-php-with-their-api/7553502#7553502
legendary
Activity: 980
Merit: 1003
I'm not just any shaman, I'm a Sha256man
I tried the following code aswell got a diff error

Code:

//$client = new SoapClient("");
$client = new SoapClient(NULL,
        array(
        "location" => "https://www.dwolla.com/api/API.svc?wsdl",
        "uri"      => "urn:xmethods-delayed-quotes",
        "style"    => SOAP_RPC,
        "use"      => SOAP_ENCODED
           ));
var_dump($client);
$params = array( new SoapParam( 'ApiKey',$apiKey),
new SoapParam('ApiCode', $apiCode),
new SoapParam('Amount' , $amount),
new SoapParam('Description', $description),
new SoapParam('DestinationID',$customerId)
);


try{
$client->__soapCall(serialize("RequestPaymentKey"), $params);
}catch(Exception $e){
echo $e;
echo "ERROR";
}

got the example from here: http://devzone.zend.com/article/689#Heading4


my error is this:
Quote
object(SoapClient)#2 (5) { ["uri"]=> string(27) "urn:xmethods-delayed-quotes" ["style"]=> int(1) ["use"]=> int(1) ["location"]=> string(39) "https://www.dwolla.com/api/API.svc?wsdl" ["_soap_version"]=> int(1) } SoapFault exception: [HTTP] Bad Request in /home/swiftbitcoins/purchase_order.php:38 Stack trace: #0 [internal function]: SoapClient->__doRequest('__soapCall('s:17:"RequestPa...', Array) #2 {main}ERROR

Is there somthing I'm not understanding about soap?

I will be willing to throw in 1 BTC to the person who can get a working code going....
legendary
Activity: 980
Merit: 1003
I'm not just any shaman, I'm a Sha256man
If i var dump the $client when I first connect i get this

object(SoapClient)#2 (2) { ["_soap_version"]=> int(1) ["sdl"]=> resource(6) of type (Unknown) }
legendary
Activity: 980
Merit: 1003
I'm not just any shaman, I'm a Sha256man
I attempted to use the associative array, and made sure all the variables match exactly from any spelling differences. Still getting this error:

Quote
SoapFault exception: [a:DeserializationFailed] The formatter threw an exception while trying to deserialize the message: Error in deserializing body of request message for operation 'RequestPaymentKey'. End element 'Body' from namespace 'http://schemas.xmlsoap.org/soap/envelope/' expected. Found element 'param1' from namespace ''. Line 2, position 158. in /home/swiftbitcoins/purchase_order.php:31 Stack trace: #0 /home/swiftbitcoins/purchase_order.php(31): SoapClient->__soapCall('RequestPaymentK...', Array) #1 {main}ERROR

using this code
Code:
$client = new SoapClient("https://www.dwolla.com/api/TestAPI.svc?wsdl");
$params = array(
  'ApiKey' => $apiKey,
  'ApiCode' => $apiCode,
  'Amount' => $amount,
  'Description' => $description,
  'CustomerID' => $customerId
);


try{
$client->__soapCall("RequestPaymentKey", $params);
}catch(Exception $e){
echo $e;
echo "ERROR";
}

Just so we are clear ApiCode is really the "Secret" key right?
sr. member
Activity: 336
Merit: 250
Sure, I know about PHP's funky type casting (good or bad, however you want to look at it) I was just thinking it might be an issue on the API side. Do you think the issue Xenland is having is more related to the second suggestion I made, though?

It's quite possible. An associative array might do the trick alright.
sr. member
Activity: 322
Merit: 251
Is your amount supposed to be a string or int?

I don't think (int) can accept decimals?

$amount=123;

Why do you have int, then? Tongue

Becuase I previously tryed a varchar but doing the value in quotes.
I thought you ment like forceing php to do int like this

$amount = (int) 123;

If i do that I wont accept decimals (as far as i know)


If you have passed your amount to that script as a string, you can get the float value by using: floatval($amount);
You can have it round to 2 decimal places if you use floatval(round($amount,2));

@nhodges: it doesn't matter what you initialize the variable with. If you initialize it with an integer, the variable will be an integer. If you initialize it with a float, it will be a float variable. So it's not necessarily an integer he has defined. For testing purposes yes, but if he wrote $amount=1.23, it would be initialized as a float.

Sure, I know about PHP's funky type casting (good or bad, however you want to look at it) I was just thinking it might be an issue on the API side. Do you think the issue Xenland is having is more related to the second suggestion I made, though?
sr. member
Activity: 336
Merit: 250
Is your amount supposed to be a string or int?

I don't think (int) can accept decimals?

$amount=123;

Why do you have int, then? Tongue

Becuase I previously tryed a varchar but doing the value in quotes.
I thought you ment like forceing php to do int like this

$amount = (int) 123;

If i do that I wont accept decimals (as far as i know)


If you have passed your amount to that script as a string, you can get the float value by using: floatval($amount);
You can have it round to 2 decimal places if you use floatval(round($amount,2));

@nhodges: it doesn't matter what you initialize the variable with. If you initialize it with an integer, the variable will be an integer. If you initialize it with a float, it will be a float variable. So it's not necessarily an integer he has defined. For testing purposes yes, but if he wrote $amount=1.23, it would be initialized as a float.
sr. member
Activity: 322
Merit: 251
I think you're not forming your object you are passing to the SOAP interface correctly. Shouldn't you have something, like an associative array, that is defining what parameters you are passing to the API?

Code:
$params = array(
  'ApiKey' => $apiKey,
  'ApiCode' => $apiCode,
  'Amount' => $amount,
  'Description' => $description,
  'CustomerID' => $customerId
);

$client->__soapCall("RequestPaymentKey", $params);

Well-constructed API's don't usually parse bundled data sequentially, since there might be non-required fields that would totally skew that type of processing.
Pages:
Jump to: