2

つまり、Omar は自分の 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,
        ), 
    )
)); 

そして、私が解決策を見つけるのを手伝ってくれる人は誰でも、仮想クッキーとハイタッチを獲得します. みんなありがとう!

4

1 に答える 1

1

https://www.dwolla.com/payment/requestの代わりにhttps://uat.dwolla.com/oauth/rest/offsitegateway/checkoutsを使用すると、問題が解決する場合があります。

于 2015-08-13T09:49:35.920 に答える