Download the PHP package neuron-php/payments without Composer
On this page you can find all versions of the php package neuron-php/payments. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download neuron-php/payments
More information about neuron-php/payments
Files in neuron-php/payments
Package payments
Short Description Gateway-agnostic payment processing with a Stripe driver.
License MIT
Informations about the package payments
Neuron Payments
Gateway-agnostic payment processing for the Neuron PHP framework, with a hosted-checkout Stripe driver.
The component never touches raw card data: donors/customers enter payment details on the provider's hosted page and are returned to your success/cancel URLs. Completed payments are confirmed asynchronously via signed webhooks.
Installation
This pulls in stripe/stripe-php.
Usage
Cart / multi-item checkout
For a shopping-cart purchase, pass lineItems instead of relying on the single
amount. Each LineItem has a name, a unit price, and a quantity, and the
gateway charges them as separate lines on one hosted checkout. Cart checkout is
always one-time ( any recurring frequency is ignored when line items are
present ).
Webhooks
verifyWebhook() returns a gateway-agnostic WebhookEvent that covers the full
lifecycle of one-time payments and recurring subscriptions:
WebhookEvent accessors are shape-tolerant across event types:
metadata(), sessionId(), invoiceId(), subscriptionId(),
paymentIntentId(), amountTotal(), amountPaid(), customerEmail(),
subscriptionStatus(), currentPeriodEnd(), billingReason(), isRenewal().
Managing subscriptions
Recurring cadence
Frequency maps human cadences to Stripe subscription intervals:
| Frequency | Stripe interval | interval_count |
|---|---|---|
OneTime |
(payment mode) | - |
Monthly |
month | 1 |
Quarterly |
month | 3 |
SemiAnnual |
month | 6 |
Annual |
year | 1 |
Configuration reference
GatewayFactory::create() accepts:
| Key | Required | Description |
|---|---|---|
provider |
yes | Gateway driver. Currently stripe. |
secret_key |
yes | Provider API secret (sk_live_... / sk_test_...). |
webhook_secret |
yes* | Signing secret (whsec_...); required to verify webhooks. |
currency |
no | ISO 4217 code; defaults to usd. |
Keep secret_key and webhook_secret out of source control — load them from an
encrypted secrets store or environment, never a committed config file.
Using with Neuron CMS
neuron-php/cms ships an optional payments feature that uses this package.
A single engine handles every payment type — donations, memberships, dues — as
one-time payments or recurring subscriptions, with each renewal recorded and the
subscription lifecycle driven by the webhook. A payment's purpose (default
donation) tags what it is for. The feature is gated behind class_exists() +
config, so the CMS runs unchanged when the package is absent.
1. Install
2. Configure (config/neuron.yaml)
Put the real secret_key / webhook_secret in config/secrets.yml.enc under a
payments: section — not in neuron.yaml.
A legacy top-level
donations:section (same keys) is still honored for backward compatibility whenpaymentshas noforms.
3. Migrate
4. Embed the form
Add the shortcode to any page's content (in a paragraph block — Raw HTML
blocks are not shortcode-parsed). [payment] is the generic shortcode;
[donation] is a friendly alias:
5. Register the Stripe webhook
In the Stripe dashboard add an endpoint pointing at your site and subscribe to these events:
checkout.session.completed— marks the payment complete; opens a subscription record for recurring payments.invoice.paid(orinvoice.payment_succeeded) — records each recurring renewal as a new charge and refreshes the subscription period.customer.subscription.updated/customer.subscription.deleted— sync status / period, mark cancellations.invoice.payment_failed— flags the subscriptionpast_due.
The webhook is the source of truth: it verifies the signature, persists state,
and triggers receipt + internal notification emails. The success page is
informational only. (/donations/webhook and the other /donations/* routes
remain as aliases.)
CMS routes: POST /payments/checkout, GET /payments/success,
GET /payments/cancel, GET /payments/token, POST /payments/webhook
(each also available under /donations/*). Admin screens live at
/admin/payments and /admin/subscriptions (the latter can cancel an active
subscription).