在为Paytm业务创建交易令牌时,我收到以下错误作为Paytm的响应。
CURL请求(根据https://developer.paytm.com/docs/initiate-transaction-api/?ref=payments文档)
curl -X POST 'https://securegw-stage.paytm.in/theia/api/v1/initiateTransaction?mid=hkmbcA45014017456710&orderId=ORDERID_2' \
--header 'Content-Type: application/json' \
--data '{"body":{"requestType":"Payment","mid":"hkmbcA45014017456710","websiteName":"WEBSTAGING","orderId":"ORDERID_2","txnAmount":{"value":"1.00","currency":"INR"},"userInfo":{"custId":"CUST_001"},"callbackUrl":"https://merchant.com/callback"},"head":{"signature":"E3g+4XifD5/XwcD/tJ9ePYJTlJGZL7BneqY4Vf32faqEJ8zkSvgM+pMWfCAfmb0VwQaT3M4p6e+grMXjeqsRScF7en86MjLY1ieA9WRf4w="}}'
响应
{"head":{"requestId":null,"responseTimestamp":"1596714537669","version":"v1"},"body":{"extraParamsMap":null,"resultInfo":{"resultStatus":"F","resultCode":"2005","resultMsg":"Checksum provided is invalid"}}}
我已使用https://github.com/paytm/Paytm_Ruby_Checksum/blob/master/PaytmChecksum.rb
在红宝石中生成了校验和最欢迎回答和提出小建议!!!
答案 0 :(得分:0)
require './lib/modules/PaytmChecksum.rb'
def paytm_txn_gen
body = '{"requestType":"Payment","mid":"YOUR_MID_HERE","websiteName":"WEBSTAGING","orderId":"ORDERID_98765","txnAmount":{"value":"1.00","货币":"INR"},"userInfo":{"custId":"CUST_001"},"callbackUrl":"https://merchant.com/callback"}'
paytmChecksum = PaytmChecksum.new.generateSignature(body, "YOUR_MERCHANT_KEY")
verifyChecksum = PaytmChecksum.new.verifySignature(body, "YOUR_MERCHANT_KEY", paytmChecksum)
puts "generateSignature Returns: %s\n" %[paytmChecksum]
puts "verifySignature Returns: %s\n" %[verifyChecksum]
data = '{"body":{"requestType":"Payment","mid":"YOUR_MID_HERE","websiteName":"WEBSTAGING","orderId":"ORDERID_98765","txnAmount":{"value":"1.00","currency":"INR"},"userInfo":{"custId":"CUST_001"},"callbackUrl":"https://merchant.com/callback"},"head":{"signature":"'+paytmChecksum+'"}}'
puts data
_url = "https://securegw-stage.paytm.in/theia/api/v1/initiateTransaction?mid=YOUR_MID_HERE&orderId=ORDERID_98765";
response = RestClient::Request.new({
method: :post,
url: "#{_url}",
payload: data,
headers: {content_type: "application/json"}
}).execute do |response, request, result|
puts "***********************"
puts JSON.parse(response).inspect
end
结束
答案 1 :(得分:0)
您似乎正在使用错误的参数创建校验和,请查看以下步骤以获得更多说明。
body='{“requestType”:“Payment”,“mid”:“YOUR_MID_HERE”,“websiteName”:“WEBSTAGING”,“orderId”:“ORDERID_98765111”,“txnAmount”:{“value”:“1.00 ”,“currency”:“INR”},“userInfo”:{“custId”:“CUST_001"},“callbackUrl”:“https://merchant.com/callback”}'
paytmChecksum = PaytmChecksum.new.generateSignature(body, “YOUR_Key_HERE”)
您的最终卷曲请求应该是
curl -X POST ‘https://securegw-stage.paytm.in/theia/api/v1/initiateTransaction?mid=hkmbcA45014017456710&orderId=ORDERID_2’
--header ‘Content-Type: application/json’
--data '{“body”:{“requestType”:“Payment”,“mid”:“INTEGR77698636129383”,“websiteName”:“WEBSTAGING”,“orderId”:“ORDERID_98765111”,“txnAmount”:{“value” :“1.00”,“currency”:“INR”},“userInfo”:{“custId”:“CUST_001"},“callbackUrl”:“https://merchant.com/callback”},“head”:{ “签名”:“'+paytmChecksum+'“}}'