# Payment Setup Guide: WeChat Pay, Alipay, Zelle, and Invoice

## Current version

This package includes a **payment-selection interface** and a **payment-confirmation workflow**.

When a parent submits a course package order:

1. The order is saved in `material_orders`.
2. A pending payment is saved in `payments`.
3. The parent is redirected to a payment instruction page.
4. The parent can submit a transaction ID or confirmation note.
5. Admin can mark the payment as `paid`, `failed`, `refunded`, or `cancelled` in the dashboard.

## WeChat Pay

The current website has a WeChat Pay UI placeholder and confirmation workflow.

To connect real WeChat Pay API later, you generally need:

- verified WeChat Pay merchant account
- merchant ID
- app ID / official account or mini program binding if applicable
- API v3 key
- merchant certificate / serial number
- private key and signature verification
- notify callback URL

Placeholder file:

`php/payment_webhook_wechat.php`

Do not mark an order paid from a webhook until official signature verification is implemented.

## Alipay / Alipay+

The current website has an Alipay UI placeholder and confirmation workflow.

To connect real Alipay / Alipay+ later, you generally need:

- approved merchant account
- app ID / merchant ID
- private key and public key setup
- SHA256/RSA signature logic
- notify callback URL
- order query and refund handling if needed

Placeholder file:

`php/payment_webhook_alipay.php`

Do not mark an order paid from a webhook until official signature verification is implemented.

## Zelle

For small businesses, Zelle is usually handled through the business bank account, email, phone, or Zelle tag. This prototype displays your Zelle payment instructions and lets the parent submit a confirmation number.

Edit these values in `php/db_config.php`:

- `ZELLE_EMAIL`
- `ZELLE_PHONE`
- `ZELLE_TAG`

## Manual invoice

Manual invoice is useful when:

- the parent wants to pay later
- you need to verify a student before accepting payment
- the payment method is not automated yet

Admin can mark the payment `paid` from the dashboard after confirmation.

## Recommended next development stage

For a real commercial tutoring platform, the best next step is to choose one gateway first:

1. Stripe or PayPal for U.S. credit-card payments.
2. Zelle manual confirmation for local U.S. parents.
3. WeChat Pay / Alipay through an approved merchant account or payment processor that supports U.S. businesses.

