csob / paymentgateway

English documentation of the ČSOB Payment Gateway that offers an API for credit card payments, Apple Pay, Google Pay, mallpay and ČSOB Payment Button.
https://platbakartou.csob.cz/platebni-brana
GNU General Public License v3.0
121 stars 68 forks source link

Getting error 500 "Internal error" whlie requesting for api "payment/init" #2

Closed krunal131987 closed 9 years ago

krunal131987 commented 9 years ago

I am getting this error json while requesting for api "payment/init" {"resultCode":900,"resultMessage":"Internal error"}

here it is my request,

"Content-Type" : "application/json"

{"returnUrl":"https:\/\/www.print-pix.eu\/functions\/csob_return_payment\/","cart":[{"amount":6.6,"description":"PrintPix - photos printing","quantity":1,"name":"Order of photos"}],"payOperation":"payment","dttm":"20150601121853","currency":"USD","orderNo":"36","description":"PrintPix APP order 36","returnMethod":"POST","totalAmount":"6.6","closePayment":"true","merchantId":"A1050uj4XS","language":"EN","signature":"QTEwNTB1ajRYU3wzNnwyMDE1MDYwMTEyMTg1M3xwYXltZW50fGNhcmR8Ni42fFVTRHx0cnVlfFBy\naW50UGl4IEFQUCBvcmRlciAzNnxFTg==\n","payMethod":"card"}

Please help me out for this error

dmarek commented 9 years ago

Hi, it seems that totalAmount and also cart/amount fields contains invalid value 6.6, it must be integer number, must contain "amount in minor units of currency", i.e. 660 cents.

For more info see https://github.com/csob/paymentgateway/wiki/eAPI-v1-(English-version)

krunal131987 commented 9 years ago

now getting 400 bed request error

my request is, {"returnUrl":"https:\/\/www.print-pix.eu\/functions\/csob_return_payment\/","cart":[{"amount":6,"description":"PrintPix - photos printing","quantity":1,"name":"Order of photos"}],"payOperation":"payment","dttm":"20150601142523","currency":"USD","merchantData":"Order of 1 photos","orderNo":"38","description":"PrintPix APP order 38","returnMethod":"POST","totalAmount":6,"closePayment":"true","merchantId":"A1050uj4XS","language":"EN","signature":"QTEwNTB1ajRYU3wzOHwyMDE1MDYwMTE0MjUyM3xwYXltZW50fGNhcmR8Ni42fFVTRHx0cnVlfFBy\naW50UGl4IEFQUCBvcmRlciAzOHxFTg==\n","payMethod":"card"}

dmarek commented 9 years ago

Please check your settings (merchantId, URL of payment gateway, keys) in your e-shop. Do you want to use integration or production environment? Anonymous development (merchantId A1050uj4XS is available only in integration environment).

for more info please see https://github.com/csob/paymentgateway/wiki/eAPI-v1-(English-version)#integration-process-keys-and-where-to-get-them

krunal131987 commented 9 years ago

i want to use it for integration environment, i just want to know, is there any mistake in my json request? is this error occur because of merchant id ?

dmarek commented 9 years ago

JSON request looks fine (merchantId A1050uj4XS should be valid in this env)

krunal131987 commented 9 years ago

then why i m getting 400 bad request error, and not getting any response from payment gatway

dmarek commented 9 years ago

because of security (if core params are invalid - merchantId, signature, etc. - only 400 bad request is returned in response)

Once again, you tried to initialize payment with merchantId A1050uj4XS against production environment, please change URL of payment gateway entrypoint to integration env.

krunal131987 commented 9 years ago

i am using this url https://api.platebnibrana.csob.cz/api/v1/payment/init, and for generating signature i just converted string of message_data in to base 64

this is my message_data, A1050uj4XS|40|20150601154040|payment|card|6|USD|true|PrintPix APP order 40|EN

this is base64 converted message_data QTEwNTB1ajRYU3w0MHwyMDE1MDYwMTE1NDA0MHxwYXltZW50fGNhcmR8NnxVU0R8dHJ1ZXxQcmlu dFBpeCBBUFAgb3JkZXIgNDB8RU4=

please tell me is there any wrong in to this.

dmarek commented 9 years ago

URL endpoint of integration env is https://iapi.iplatebnibrana.csob.cz/api/v1/payment/init (note "i" in front of api and platebnibrana)

For more info see https://github.com/csob/paymentgateway/wiki/eAPI-v1-(English-version)

krunal131987 commented 9 years ago

both URLs with "https://iapi.iplatebnibrana.csob.cz/api/v1/payment/init" and https://api.platebnibrana.csob.cz/api/v1/payment/init both giving same error 400 bad request

dmarek commented 9 years ago

Your data to sign is invalid, there are missing required fields, like returnUrl, returnMethod and cart items like name, quantity and amount

A1050uj4XS|40|20150601154040|payment|card|6|USD|true|PrintPix APP order 40|EN