I'm using the sandbox. I keep getting the discover test card declined with a INV TRAN message. I've tried different encryption methods but no avail. It shows up on the test merchant payments page as a failed payment, so I'm assuming the card number is making it through, so I'm thinking it's not the encryption. I've also received a crypto error before when trying various things, so I think it is something else. I looked at the merchant's permissions under api tokens and Merchant, Orders, and Payments are all Read & Write.
My workflow is as follows:
- using v3/merchants/mid/orders to generate a new order
- using v3/merchants/mid/orders/orderid to set it open
- get the key using v2/merchant/mid/pay/key
- encrypt the card with the prefix prepended
- use the v2/merchant/mid/pay to post the payment which is where the error returns
Apparently it is something with the encryption. I was finally able to get it to work using the returned PEM certificate, extracting the public key from it, and then encrypting the card information using the public key. Everytime I tried using the modulus and exponent it would return the INV TRAN message. Seems like some better failure messages. Maybe something more explaining there was a crypo error or something.