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

Example for php - TSGSMIPS-5526 #361

Closed serkat closed 6 years ago

serkat commented 6 years ago

Hi. i'm using your example for php on test page with your key and merchantid http://skatline.com/oktravel/ after clicking "test" btn i see data and result payment/init failed, http response: 400

Could you help me - what am i doing wrong in your example?

serkat commented 6 years ago

Also if i want to check echo

https://api.platebnibrana.csob.cz/api/v1.7/echo/A1029DTmM7/20180129214856/VWfAB4FH97iX75viSZbGPuLrh2PMpixSmKxlorR/XhmyRAnlwq2CcZCbhYttjVMq/nvBnY0PeEhufHWEO/dtum3GI8dSlS4iJBTi0Z0YbDp15u0y5LmM8FDkV/ib+rWTCcbL1LcLjxAP8HGOB+SivRcC6CI4/Ny0aGIrPyMR5HO6HYk7HVJFaEpuMu1J7fwSPXQH/WsHHUiNWnojKZCCdMzPC7muXlKnLlhzpNXLOIa6wMIMzy4u3Dj879M8bHe8lhdfX5HDCptmlkbePO5HtoKnj30RB/peuod7SPwIfl9+TGKri/yT6qOZGYfpyyq6juETWTIZQ9GFsdeMYVADSQ==

i see that page can't be found

mjanek commented 6 years ago

Dear Sir, your request is registered and forwarded to responsible service technician. Best regards

serkat commented 6 years ago

Thanks. Waiting for your response

ratajskym commented 6 years ago

You are sending your request to production environment. But using anonymous merchant. You must use production merchant id and send it to production or you must you your anonymous merchant id and send it to sandbox. It depends what you want to do

serkat commented 6 years ago

Could you send production credentials and sendbox, please?

ratajskym commented 6 years ago

You must sign contract with CSOB to get production credentials

serkat commented 6 years ago

is there a sendbox url to test the payment?

serkat commented 6 years ago

i generate a sandbox public key and private key. Also when i start sign-verify-test.php with sandbox public and private keys - i get

sign & verify test ... signing text 'some text to sign' using private key rsa_A309616bIT.key signature is 'U3feXX2Pm0l73InoMZ5Pgz3Zi8ybTfFDt7gP2uTRIBVCnXbI195bEBBWcL0wcHWa0BS6g6kPMHwlEFhJhmpDViB8Jfgq3+E4IGuKyzBogl7OkID7LE20no7CMXv6opxGVb7TfGKmirkBUzRfe7gAZKHiobZgL/kb+kmyyBBJaQ1PxGlODDXSliQEX73AEocbbQXUR6M5yjKFQDVSS5qkTL+bEzO+DJk1wwQXlNX3uGX1xtG9+0y20Glp7LNR7SU9nuH8bClBs3n/zOLKlT2A0mil+jjhj9vwI3GkNi7WCJiP+WXqBoYByXKcIUV1fWoffx5MpY9VTd6zoyBgCqmkEg==' verifying signature using public key rsa_A309616bIT.pub verify result: ok

but then http://skatline.com/payment/ - will say to me that

preparing payment init data ...

preparing cart data: [ { "name": "Shopping at ...", "quantity": 1, "amount": 100, "description": "Lenovo ThinkPad Edge E540..." }, { "name": "Shipping", "quantity": 1, "amount": 0, "description": "PPL" } ]

data to sign: "A309616bIT|123456|20180130223600|payment|card|100|CZK|false|https://vasobchod.cz/gateway-return|POST|Shopping at ...|1|100|Lenovo ThinkPad Edge E540...|Shipping|1|0|PPL|Nákup na vasobchod.cz (Lenovo ThinkPad Edge E540, Doprava PPL)|1234|CZ"

prepared payment/init request: { "merchantId": "A309616bIT", "orderNo": "123456", "dttm": "20180130223600", "payOperation": "payment", "payMethod": "card", "totalAmount": 100, "currency": "CZK", "closePayment": "false", "returnUrl": "https://vasobchod.cz/gateway-return", "returnMethod": "POST", "cart": [ { "name": "Shopping at ...", "quantity": 1, "amount": 100, "description": "Lenovo ThinkPad Edge E540..." }, { "name": "Shipping", "quantity": 1, "amount": 0, "description": "PPL" } ], "description": "Nákup na vasobchod.cz (Lenovo ThinkPad Edge E540, Doprava PPL)", "merchantData": null, "customerId": "1234", "language": "CZ", "signature": "NzYClYJOX87RmJ3MnTYzr15tUvPH2nP8JKppJAzPtgi/u1uV/mNa34avsRUMV9jEyENzT0favPxBb6cEOj9DfNGAZIN06eI9rOlLhUmxKeb9q31D0DvYn/rTgF4s7ZH3biKVwo82HjBUVYC5R7FpmnZcpSLbHK37/ylT1+YrpH9eeSkWFkb77BMP2zeJ6JIXuaWChCEnOO0vvMrSlj5IEtCmszoANzZhcRVLICUt3rN34oFpfeyuX+jkACOpiIGbqmLS5M7Whzqqdtg6ZQi2yzrEgj8k7q1rnQo3gusFK+aZH5mOXWx32nQqPGprZMJYeXKTsrgrSCI1Wa+2jzZknQ==" }

processing payment/init request ...

payment/init result: {"dttm":"20180130203601","signature":"dGzoASdxU/WjhO113PnrJrFqs4WYHpiE98kVlFCsgQD7g1u3BsEJ6yhOdadN3CURohulPBI1BBe7ZityQCNal+yqqfxDaxhLqzSoS8870MtQJor7zN3J34RvqzPXkr/ohGrRNqIaOz1gJVulJwfdHsNIv5e0Q5MfDFVkdehqqKUYgfiVvN8s0W8UTrJhAbXb8JrTLbIUyWGVVFwwrhKe21efTJOPHbULBAgN/HUkpfTyRfOy2niTXtmnGkL9a33HaQdAVBsgaOZEsbTxWDXDQT3cXe579Fxr4Rrw4hDyYBOjYuk8s27Vr+of1wJhRup9udFDr6SV8OnfRVL1VxvhBQ==","payId":"f453cd983716eDA","resultCode":0,"resultMessage":"OK","paymentStatus":1}

payment/init failed, unable to verify signature

serkat commented 6 years ago

is there workable php example with sandbox url where i will change merchantId, add public and private keys - and it will work ? It would be nice if it exists

ratajskym commented 6 years ago

As you can see, your request was succesfull payId":"f453cd983716eDA","resultCode":0,"resultMessage":"OK","paymentStatus":1

BUT, verification of response failed. That means that you have wrong public key (check that you have the right one https://github.com/csob/paymentgateway/tree/master/keys )