raojeet / apple-pay
ApplePay php Token Decoder
1.0.0
2024-11-28 17:46 UTC
Requires
- php: ^7.4|^8.0
- ext-openssl: *
- phpseclib/phpseclib: ^3.0
- spomky-labs/php-aes-gcm: ^1.2
- symfony/process: ^4.1|^5.0|^6.0|^7.1
Requires (Dev)
- phpunit/phpunit: ^11.4
This package is auto-updated.
Last update: 2025-03-01 00:42:42 UTC
README
Apple Pay Token Decoder PHP
This library is used to decode tokens for Apple Pay.
It takes a payment token data and returns an ApplePayPaymentData object. ex:
class ApplePayIntegration\Decoding\ApplePayPaymentData#19 (9) {
private $version =>
int(1)
private $applicationPrimaryAccountNumber =>
string(16) "20427527000"
private $applicationExpirationDate =>
string(6) "190731"
private $currencyCode =>
string(3) "643"
private $transactionAmount =>
int(100000)
private $deviceManufacturerIdentifier =>
string(12) "050103073"
private $paymentDataType =>
string(8) "3DSecure"
private $onlinePaymentCryptogram =>
string(28) "Am+7lPDbobAGVT7hNAoABA=="
private $eciIndicator =>
NULL
}
Install:
Run composer require raojeet/apple-pay
Get AppleRootCA-G3.pem:
- Download AppleRootCA-G3.cer
- Run command:
openssl x509 -inform der -in AppleRootCA-G3.cer -out AppleRootCA-G3.pem
Get Private Key:
- Export merchant certificate to a p12 cert
- Use openssl to get the private key:
openssl pkcs12 -in <your_cert>.p12 -out private_key.pem -nocerts -nodes
- Copy content without
BEGIN
andEND
markers
Usage:
See https://github.com/raojeet/apple-pay/blob/main/example/test.php
For more information about how Apple Pay tokens decoding works go to: https://developer.apple.com/library/content/documentation/PassKit/Reference/PaymentTokenJSON/PaymentTokenJSON.html
Only works on Linux hosts with openssl installed