norfolkmustard / ApplePayJS

Working draft of ApplePayJS with php
GNU General Public License v3.0
144 stars 60 forks source link

apple_pay_conf.php question #1

Closed ryanburnett closed 8 years ago

ryanburnett commented 8 years ago

On line 9 of apple_pay_conf.php:

define('PRODUCTION_MERCHANTIDENTIFIER', openssl_x509_parse( file_get_contents( PRODUCTION_CERTIFICATE_PATH ))['subject']['UID'] ); //e.g. merchant.com.mydomain or merchant.com.mydomain.shop

Let's say my name is merchant.com.name should this line be:

define('PRODUCTION_MERCHANTIDENTIFIER', openssl_x509_parse( file_get_contents( PRODUCTION_CERTIFICATE_PATH ))['subject']['merchant.com.name'] ); //e.g. merchant.com.mydomain or merchant.com.mydomain.shop

Thank you!

norfolkmustard commented 8 years ago

Hi. You can leave that line as it is. I'm using openssl_x509_parse() to get the relevant bit of text from your certificate file.

see http://uk.php.net/openssl_x509_parse

and since PHP5.4 you're able to array dereference the result of a function directly i.e. function()[1][2]

see http://php.net/manual/en/language.types.array.php#example-104

If all of that's not working for you for some reason, then replace it with

define('PRODUCTION_MERCHANTIDENTIFIER', 'merchant.com.name');

ryanburnett commented 8 years ago

OK thanks @norfolkmustard