# vasylenkomykola/paypal-php-encrypt architecture

> Architecture diagram of the GitHub repository vasylenkomykola/paypal-php-encrypt, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-04). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/vasylenkomykola/paypal-php-encrypt
- Repository: https://github.com/vasylenkomykola/paypal-php-encrypt

## Overview

This is a small PHP library for creating PayPal Encrypted Website Payments payloads. A caller supplies button parameters to `encrypt()`, which serializes them, signs them with merchant credentials, applies the OpenSSL binary workaround, encrypts the result with PayPal’s certificate, and returns PKCS7-armored data for a PayPal button. The implementation is concentrated in one class; the certificate files described by the README are not present in the tree. Internal stages are separated here for clarity, not because they are separate modules.

Main entry points: [`PayPalEncrypt.class.php`](https://github.com/vasylenkomykola/paypal-php-encrypt/blob/master/PayPalEncrypt.class.php) (Encrypt API)

## Diagram (Mermaid)

```mermaid
flowchart TD

node_caller(("Merchant application"))
node_encrypt["Encrypt API"]
node_serialize["Parameter serialization"]
node_sign["PKCS7 signing"]
node_workaround["Binary workaround"]
node_encrypt_paypal["PayPal encryption"]
node_armor["PKCS7 armor"]
node_certs["PEM certificates"]
node_button["Button payload"]
node_paypal["PayPal Payments"]

node_caller -->|"calls"| node_encrypt
node_encrypt -->|"serializes"| node_serialize
node_encrypt -->|"signs"| node_sign
node_encrypt -->|"decodes conditionally"| node_workaround
node_encrypt -->|"encrypts"| node_encrypt_paypal
node_encrypt -->|"formats result"| node_armor
node_encrypt -->|"reads"| node_certs
node_encrypt -->|"returns payload"| node_button
node_button -->|"posts to"| node_paypal

click node_encrypt "https://github.com/vasylenkomykola/paypal-php-encrypt/blob/master/PayPalEncrypt.class.php"
click node_serialize "https://github.com/vasylenkomykola/paypal-php-encrypt/blob/master/PayPalEncrypt.class.php"
click node_sign "https://github.com/vasylenkomykola/paypal-php-encrypt/blob/master/PayPalEncrypt.class.php"
click node_workaround "https://github.com/vasylenkomykola/paypal-php-encrypt/blob/master/PayPalEncrypt.class.php"
click node_encrypt_paypal "https://github.com/vasylenkomykola/paypal-php-encrypt/blob/master/PayPalEncrypt.class.php"
click node_armor "https://github.com/vasylenkomykola/paypal-php-encrypt/blob/master/PayPalEncrypt.class.php"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_caller,node_certs,node_button,node_paypal toneIndigo
class node_encrypt toneMint
class node_serialize,node_sign,node_workaround,node_encrypt_paypal,node_armor toneTeal
```

## Components

### Other components

- **Merchant application**
- [Encrypt API](https://github.com/vasylenkomykola/paypal-php-encrypt/blob/master/PayPalEncrypt.class.php): `PayPalEncrypt.class.php`
- [Parameter serialization](https://github.com/vasylenkomykola/paypal-php-encrypt/blob/master/PayPalEncrypt.class.php): `PayPalEncrypt.class.php`
- [PKCS7 signing](https://github.com/vasylenkomykola/paypal-php-encrypt/blob/master/PayPalEncrypt.class.php): `PayPalEncrypt.class.php`
- [Binary workaround](https://github.com/vasylenkomykola/paypal-php-encrypt/blob/master/PayPalEncrypt.class.php): `PayPalEncrypt.class.php`
- [PayPal encryption](https://github.com/vasylenkomykola/paypal-php-encrypt/blob/master/PayPalEncrypt.class.php): `PayPalEncrypt.class.php`
- [PKCS7 armor](https://github.com/vasylenkomykola/paypal-php-encrypt/blob/master/PayPalEncrypt.class.php): `PayPalEncrypt.class.php`
- **PEM certificates**
- **Button payload**
- **PayPal Payments**

## Connections

- Merchant application → Encrypt API: calls (evidence: `README.md`)
- Encrypt API → Parameter serialization: serializes (evidence: `PayPalEncrypt.class.php`)
- Encrypt API → PKCS7 signing: signs (evidence: `PayPalEncrypt.class.php`)
- Encrypt API → Binary workaround: decodes conditionally (evidence: `PayPalEncrypt.class.php`)
- Encrypt API → PayPal encryption: encrypts (evidence: `PayPalEncrypt.class.php`)
- Encrypt API → PKCS7 armor: formats result (evidence: `PayPalEncrypt.class.php`)
- Encrypt API → PEM certificates: reads (evidence: `PayPalEncrypt.class.php`)
- Encrypt API → Button payload: returns payload (evidence: `README.md`)
- Button payload → PayPal Payments: posts to (evidence: `README.md`)
