paytrail / api-documentation

Paytrail Payment API documentation
MIT License
6 stars 11 forks source link

MIT charge 400 - Bad Request using tokenized test card #70

Closed pkilpo closed 9 months ago

pkilpo commented 1 year ago

Hi,

Can you please check what is wrong with my call from your logs.

I am using the code that has worked before, now testing again and now getting 400 error. I been trying to use different test cards none worked so far. I get token successfully but mit charge always fails. Here is one of the failing call. Can't figure out what is wrong here.

Not using redirectUrls and I was adviced by your support to use empty redirect urls since its mandatory and like I said it was working earlier. This is not document that they can be left empty if not used. Best would be of course if they were non mandatory and could be left out in case they are not used.

POST to https://services.paytrail.com/payments/token/mit/charge

headers

{"Accept":"application/json","checkout-timestamp":"2023-01-19T13:08:24+00:00","checkout-account":375917,"checkout-algorithm":"sha256","checkout-method":"POST","checkout-nonce":"8974bdb3-8251-49f3-abdb-021be8fdbfcf","X-CheckoutFiClient-Api-Version":"0.1","Content-Type":"application/json;charset=UTF-8","signature":"666dad0a82eaca39a8bc0cd2dd6dfeb1de0b03a218bfca4c37bc0d131e6ae11f"}

body

{"stamp":"555857","reference":"10005558576","currency":"EUR","language":"FI","amount":10600,"customer":{"firstName":"pekka","lastName":"testaaja2","email":"pkilpo+2@gmail.com"},"redirectUrls":{"success":"","cancel":""},"items":[{"description":"TARJOUSKESTO 12 KK","deliveryDate":"2023-01-19","productCode":"1210","units":1,"unitPrice":10600,"vatPercentage":10}],"token":"8edcbd8f-0aa6-4b1c-a407-46c0809e5f60"}

RESPONSE 400 - Bad Request

Thanks in advance

kotivuori commented 1 year ago

Hi,

This request is successful when calculated signature is ead765f7fc7e3cf26e58cb5a90ed32bc3a6c608715be72a883cf3554d903bcc6

Did you check that checkout headers are passed in alphabetical order https://docs.paytrail.com/#/?id=authentication