Open mattpoq-belk opened 6 years ago
The symmetric key is generated from the merchant id and the shared secret: https://github.com/spreedly/gala/blob/master/lib/gala/payment_token.rb#L98-L110
The merchant id can be extracted from the merchant's certificate: https://github.com/spreedly/gala/blob/master/lib/gala/payment_token.rb#L81-L88 (See "Party V Info" on https://developer.apple.com/library/content/documentation/PassKit/Reference/PaymentTokenJSON/PaymentTokenJSON.html.)
The shared secret is generated from the merchant's private key and the payment token's ephemeral public key: https://github.com/spreedly/gala/blob/master/lib/gala/payment_token.rb#L90-L94
Shameless plug: If you are testing out stuff in non-production, you could perhaps benefit from https://github.com/clearhaus/pedicel-pay 🙂
Very nice! I should've been more clear about what I was asking. I was asking is it meant to be a simple string of the shared secret and symmetric key, because the output is not a standard string. So I didn't know how to convert the output into something that could be put into those variables.
Awesome repo for working locally! Wish I had seen that before.
Shameless plug of my own. I was attempting to do this as NPM since there are few NPM examples. With the help of @murcialito I was able to make a working example in JS. https://github.com/inturbidus/applepay-token
I'm attempting to use rake test with my certificate and paymentData. But I'm unsure what should go in @merchant_id in setup.
Same for @shared_secret and @symmetric_key, where do I get these from?