2012-03-19 47 views
1

我正在開發一個支付寶的自適應付款API的Python綁定,目前我正在實施並行/鏈接付款調用,但我被困在一個相當神祕的錯誤。貝寶自適應付款API失敗,多個接收器

我已經實現與參數詳見Pay API Operation如下基本的「PAY」操作:

{'actionType': 'PAY', 
'cancelUrl': 'http://my_domain.com/cancel_url', 
'clientDetails.applicationId': 'My Application ID', 
'clientDetails.ipAddress': 'MY IP', 
'currencyCode': 'USD', 
'receiverList.receiver(0).amount': 15, 
'receiverList.receiver(0).email': '[email protected]', 
'requestEnvelope.detailLevel': 'ReturnAll', 
'requestEnvelope.errorLanguage': 'en_US', 
'returnUrl': 'http://my_domain.com/cancel_url'} 

,它的工作真的很好,但是當我嘗試在receiverList對象添加多個接收器PayPal的返回我不說什麼了一個錯誤:

{'error(0).category': ['Application'], 
'error(0).domain': ['PLATFORM'], 
'error(0).errorId': ['580001'], 
'error(0).message': ['Invalid request: {0}'], 
'error(0).severity': ['Error'], 
'error(0).subdomain': ['Application'], 
'responseEnvelope.ack': ['Failure'], 
'responseEnvelope.build': ['2486531'], 
'responseEnvelope.correlationId': ['f454f1118f799'], 
'responseEnvelope.timestamp': ['2012-03-18T17:48:10.534-07:00']} 

而且這一切,它並沒有說明該請求是無效的,我實在找不出什麼毛病變化設置爲添加的第一個參數:

'receiverList.receiver(1).amount': 15, 
'receiverList.receiver(1).email': '[email protected]' 

我是否必須啓用某些功能才能在沙箱中測試鏈接/並行付款,或者是否忘記了發送基本頭文件/參數中的某些配置?

感謝所有幫助

回答

2

與PayPal後,他們告訴我嘗試發送receiverList對象秩序,例:

{'actionType': 'PAY', 
'cancelUrl': 'http://my_domain.com/cancel_url', 
'clientDetails.applicationId': 'My Application ID', 
'clientDetails.ipAddress': 'MY IP', 
'currencyCode': 'USD', 
'receiverList.receiver(0).amount': 15, 
'receiverList.receiver(0).email': '[email protected]', 
'receiverList.receiver(1).amount': 15, 
'receiverList.receiver(1).email': '[email protected]', 
'requestEnvelope.detailLevel': 'ReturnAll', 
'requestEnvelope.errorLanguage': 'en_US', 
'returnUrl': 'http://my_domain.com/cancel_url'} 

當我執行體,因爲它成爲了一個Python字典無序的,所以我開始使用OrderedDict這對我來說伎倆:)

+0

這對我有效。好的提示。 – DavidWinterbottom 2013-01-30 13:33:50