0

PayOne ( https://www.payone.de/en/ )でクレジット カードを確認しようとしています。

私が取得したパラメータのリストAccording to 3.4.1 Verifying credit cards (creditcardcheck)とドキュメントPAYONE_Platform_Client_API_EN.pdfのセクション( https://www.payone.de/en/contact/3.1.2 Standard parameterからリクエストできます)。

  1. (aid, api_version, mid, mode, portalid, responsetype, request, storecarddata) (Python) のハッシュ値を計算し、クライアント側に渡します。
# build hash on server side: 
import hmac
import hashlib

params = {
    'aid': '123456', 
    'api_version': '3.12', 
    'mid': '123456', 
    'mode': 'test', 
    'portalid': '1234567', 
    'responsetype': 'JSON', 
    'request': 'creditcardcheck', 
    'storecarddata': 'yes'
}
message = ''.join([params[k] for k in sorted(params)])
return hmac.new(b'some-secret-key!', msg=message.encode('utf-8'), digestmod=hashlib.sha384).hexdigest()
  1. 次に、サーバー側から取得した追加のパラメーター ( cardcvc2、cardexpiredate、cardpan、cardtype ) とハッシュを使用して、JSONP (なぜここに CORS と RESTful API がないのですか?) 要求を実行します。

https://secure.pay1.de/client-api/?aid=123456&api_version=3.10&cardcvc2=123&cardexpiredate=1801&cardpan=012344567890123&cardtype=M&mid=12345&mode=test&portalid=1234567&responsetype=JSON&request=creditcardcheck&storecarddata=yes&hash=c6a8fe28e6d4cc63139aae5eba41bdb74f877f364a444745f4083a22db0f9861247cd4a0dfa82bd42df1ff7724754ea6&callback_method= ng_jsonp .__req0.finished

  1. 結果を得る:

{ "customermessage": "このトランザクションの処理中にエラーが発生しました (パラメーターが間違っています)。", "errorcode": "2007", "errormessage": "ハッシュが正しくありません", "status": "ERROR" }

私はpython 3.5とangular2を使用しています。

ここで何が間違っていますか?

PS:

  • ここにphpコードの例がありますが、pythonコードはありません

PPS:

Web インターフェイスでハッシュ方式が選択されています: https://pmi.pay1.de/merchants/?navi=portal&rc=1 ( Method hash calculation*: SHA2-384 (recommended method))

4

2 に答える 2

0

api_version解決策は、パラメーターなしでエンドポイントを呼び出すことです。

# build hash on server side: 
import hmac
import hashlib

params = {
    'aid': '123456', 
#    'api_version': '3.12', 
    'mid': '123456', 
    'mode': 'test', 
    'portalid': '1234567', 
    'responsetype': 'JSON', 
    'request': 'creditcardcheck', 
    'storecarddata': 'yes'
}
message = ''.join([params[k] for k in sorted(params)])
return hmac.new(b'some-secret-key!', msg=message.encode('utf-8'), digestmod=hashlib.sha384).hexdigest()

PS

同時に、セクション で必須パラメーターとして、セクション でハッシュする必要があるapi_versionパラメーターとして注目されています。したがって、ドキュメントに入力するように見えます。3.1.2 Standard parameter3.1.4 Calculation of the HASH value

于 2017-01-23T11:39:12.510 に答える