2

所以故事是这样的,Omar 到处寻找他的 Dwolla 代码为什么不起作用的原因。每次尝试的输出都是

{"Result":"Failure","Message":"Invalid application credentials."}

我的密钥、秘密和destinationId 都是正确的(三重检查),来自互联网的唯一建议是确保发送的正文是JSON 编码的......它是。我搜索了堆栈,阅读了开发文档并在 Google 上搜索了几个小时,却发现更多的困惑和头痛。这是我的代码:

$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,
        ), 
    )
)); 

谁能帮我找到解决方案,谁就会得到一个虚拟饼干和高五。多谢你们!

4

1 回答 1

1

使用https://uat.dwolla.com/oauth/rest/offsitegateway/checkouts而不是https://www.dwolla.com/payment/request可能会解决问题。

于 2015-08-13T09:49:35.920 回答