Zend certified PHP/Magento developer

Decrypt Apple Pay PKPaymentToken using Braintree

I have a mobile app connected to magento via rest api.
As payment processor I am using Braintree, default payment extension by Gene Commerce.
Credit card, google pay works, problem is with Apple pay, because when I try to pay, I get encrypted data back and not sure what to do with that.

Found that it needs to go to braintree somehow, i think same via an api, but can’t find nothing on web. Asked braintree they said to ask gene commerce, asked gene sent me back to braintree 🙂

So in order to complete the apple pay transaction I need data from that PKPaymentToken, data like nonce, id, card etc..

token example:

{
    "version": "EC_v1",
    "data": "vxae4VFHqdtWakaJ1wqQHyel...<a lot more data>...ggVQsfUxBXR8=",
    "signature": "MIAGCSqGSIb3DQEHAqCA...<a lot more data>...MAAAAAAAA=",
    "header": {
        "ephemeralPublicKey": "MFkwEwYHKoZIzj0CAQYIKoZICZImiZPyLGQBAQwgbWVyY2hhbnQuY29tLmdy332d55suNAl1RIZi3KIT5hwmiSKSch9+6OOGlRZw0xOTAy4jejmO0A==",
        "publicKeyHash": "0aB0KxDCKoZICZImiZPyLGQBAQwoIwz3m6bKxuqPe+F6yQco=",
        "transactionId": "54829332dd6db37d06KoZICZImiZPyLGQBAQw5e6f35059acad43133d792fc139"
    }
}

I have found this https://github.com/samcorcos/apple-pay-decrypt but looks like its not a good ideea to decrypt it locally because I will have to add certificates locally in the app, not secure.

Any help with that please?

Thanks