2016-12-05 20 views
0

定期的に請求された請求情報を使用してトランザクションを作成したいとします。私は、ノードReculryモジュールコールノード-recurly にhttps://github.com/robrighter/node-recurlyノード定期的に保存された請求情報を使用してトランザクションを作成する

以下

を使用しています、それはエラーメッセージの下に戻る私のコード

 recurly.transactions.create({ 
      'account_code': orgId, 
      'amount_in_cents': 200, 
      'currency': 'AUD' 
      }, function (err, response) { 
       if (err) { 
       return res.send({ 
        success :false, 
        message :message_common.coupon_create_err, 
        data: err, 
        status :status_common.error_res 
       }); 
       } else { 
       return res.send({ 
        success :true, 
        message :message_common.coupon_create_success, 
        data: [], 
        status :status_common.success_res 
       }); 
       } 
      }); 

を見つけてください、

{ 
    "statusCode": 400, 
    "headers": { 
     "date": "Mon, 05 Dec 2016 11:34:53 GMT", 
     "content-type": "application/xml; charset=utf-8", 
     "transfer-encoding": "chunked", 
     "connection": "close", 
     "set-cookie": [ 
     "__cfduid=deb9088318b3890486d479eb2a9a4aed11480937692; expires=Tue, 05-Dec-17 11:34:52 GMT; path=/; domain=.recurly.com; HttpOnly" 
     ], 
     "x-api-version": "2.0", 
     "content-language": "en-US", 
     "x-ratelimit-limit": "2000", 
     "x-ratelimit-remaining": "1996", 
     "x-ratelimit-reset": "1480937940", 
     "cache-control": "no-cache", 
     "x-request-id": "aopr1tvaaooktujne13g", 
     "strict-transport-security": "max-age=15552000; includeSubDomains; preload", 
     "server": "cloudflare-nginx", 
     "cf-ray": "30c73103cdd42384-FRA" 
    }, 
    "data": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<error>\n <symbol>invalid_xml</symbol>\n <description>The provided XML was invalid.</description>\n <details>Unacceptable tag &lt;account_code&gt;</details>\n</error>" 
    } 
+0

「提供されたXMLは無効です。許容できないタグ」*は非常に具体的なエラーです。 – Tomalak

+0

あなたの提案は何ですか? –

+0

エラーメッセージの意味について考えてください。エラーメッセージを検索しますか? APIのドキュメントを読んでください。 Wiresharkを使い、HTTPパッケージを見て比較しますか?これらはすべて基本的なデバッグです。それはあなたの仕事です。あなたは質問をするためにここに来る前にそれらをしておくべきでした。 – Tomalak

答えて

0

は、XMLデータの整形はありません与えますあなたがlibxmljsモジュールについて知っていて、問題を解決するのに役立つnode-recurlyと一緒に使うならばエラーです。ex、

var libxmljs = require("libxmljs"); 
var xml = '<?xml version="1.0" encoding="UTF-8"?>' + 
      '<root>' + 
       '<child foo="bar">' + 
        '<grandchild baz="fizbuzz">grandchild  content</grandchild>' + 
       '</child>' + 
       '<sibling>with content!</sibling>' + 
      '</root>'; 

を使用すると、トランザクションコードがxml変数値で置き換えられます。

// Example with Stored Billing Info 
<transaction> 
    <amount_in_cents>100</amount_in_cents> 
    <currency>USD</currency> 
    <account> 
    <account_code>1</account_code> 
    </account> 
</transaction> 

// Example with new Billing Info 
<transaction> 
    <amount_in_cents>1000</amount_in_cents> 
    <currency>USD</currency> 
    <account> 
    <account_code>1</account_code> 
    <billing_info> 
     <first_name>Verena</first_name> 
     <last_name>Example</last_name> 
     <address1>123 Main St.</address1> 
     <city>San Francisco</city> 
     <zip>94105</zip> 
     <country>US</country> 
     <number>4111-1111-1111-1111</number> 
     <verification_value>123</verification_value> 
     <month>11</month> 
     <year>2015</year> 
    </billing_info> 
    </account> 
</transaction> 
+0

あなたのフィードバックをありがとう、ここで小さなサンプルを行うことができますか? –

+0

非公式のnode.js apiを使用している場合、recurly.transactions.create関数がaccount_codeタグの問題チェックであることを確認し、 "orgId"が文字列であることを確認します。 – ankur

関連する問題