故事就是如此,奥马尔为了解他为什么他的Dwolla代码不起作用而进行了广泛的搜索。每次尝试输出都是
{"Result":"Failure","Message":"Invalid application credentials."}
我的密钥,秘密和destinationId都是正确的(三重检查),互联网的唯一建议是确保发送的正文是JSON编码的......它是。我搜索过堆栈,阅读开发文档和谷歌搜索几个小时,只是出现了更多的困惑和头痛。这是我的代码:
$body= '{
"Key": "'.$key.'",
"Secret": "'.$secret.'",
"PurchaseOrder": {
"DestinationId": ".$destinationId.",
"Discount": 0,
"OrderItems": [ {
"Description": "Description #1",
"Name": "Item #1",
"Price": 4,
"Quantity": 1
}, {
"Description": "Description #2",
"Name": "Item #2",
"Price": 2,
"Quantity": 2
} ],
"Shipping":2,
"Tax": 0,
"Total": 10,
"Notes": "A note on this order",
"Test" : "true",
"orderId" : 1,
"callback" : "https://test.com/library/payments.php" ,
"redirect" : "https://test.com/library/payments.php"
}
}'
;
$result = file_get_contents('https://www.dwolla.com/payment/request', null, stream_context_create(array(
'http' => array(
'method' => 'POST',
'header' => 'Content-Type: application/json' . "\r\n" .
'Content-Length: ' . strlen($body) . "\r\n",
'content' => $body,
),
)
));
谁能帮助我找到一个解决方案,就会得到一个虚拟cookie和一个高五。谢谢你们!
答案 0 :(得分:1)