Download the PHP package lahiru/laravel-solidgate without Composer
On this page you can find all versions of the php package lahiru/laravel-solidgate. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download lahiru/laravel-solidgate
More information about lahiru/laravel-solidgate
Files in lahiru/laravel-solidgate
Package laravel-solidgate
Short Description Laravel SDK for SolidGate — card & APM payments, subscriptions, webhooks, and reporting with official HMAC-SHA512 signing, typed responses, and smart API defaults.
License MIT
Homepage https://github.com/Lprabodha/laravel-solidgate
Informations about the package laravel-solidgate
Laravel SolidGate
Laravel package for the SolidGate payment gateway. Use the facade or dependency injection, get typed responses, and call 74+ API endpoints with correct HMAC-SHA512 signing and sensible defaults.
Good for: server-side card/APM charges, subscriptions, hosted checkout, embedded payment forms, webhooks, and reporting.
Table of Contents
Getting started
- Features
- Requirements
- Installation
- Configuration
- Choose your integration
- Using the package in Laravel
- Quick Start
Checkout (customer-facing)
- Checkout integrations
- Payment Page (hosted)
- Payment Form (embedded)
Server-side API
- Card Payments
- Alternative Payments (APM)
- Subscriptions
- Products, Taxes & Reporting
- Webhooks
Reference
- Responses & Error Handling
- Helper Classes
- Troubleshooting
- API Reference Map
- Development
- Changelog
- License & References
Features
| Feature | Description |
|---|---|
| 74+ endpoints | Card, APM, subscriptions, taxes, checkout, webhooks, reporting |
| Checkout docs | Payment Form with copy-paste Laravel examples |
| Correct signing | HMAC-SHA512 over exact JSON body — matches official PHP SDK |
| Smart defaults | Auto-fills platform, payment_type, and card expiry formatting |
| Type-safe responses | SolidGateResponse with dot-notation and error helpers |
| Webhook support | Signature verification middleware + Laravel events |
| Helper classes | Platform, PaymentType, RefundReason, currency utilities |
| Laravel native | HTTP client, service container, facade, config publishing |
Requirements
- PHP 8.2+
- Laravel 10.x, 11.x, 12.x, or 13.x (Laravel 13 requires PHP 8.3+)
Installation
Publish the config (recommended):
Copy environment variables from .env.example:
Configuration
Get your keys from SolidGate Hub → Developers → Channel details:
| Key type | Prefix | Used for |
|---|---|---|
| API keys | api_pk_* / api_sk_* |
Outgoing API requests |
| Webhook keys | wh_pk_* / wh_sk_* |
Incoming webhook verification |
Environment variables
Tip: Each API group uses a different base URL. Card payments go to
pay.solidgate.com, subscriptions tosubscriptions.solidgate.com, APM togate.solidgate.com, and reports toreports.solidgate.com. The package routes these automatically — you only call the facade methods.
Config file (config/solidgate.php)
After publishing, keys are read from config('solidgate.public_key') and config('solidgate.secret_key') (backed by SOLIDGATE_* env vars).
Choose your integration
Pick the flow that matches your product. All options below use this package on the server; only Payment Form also needs frontend JS.
| Integration | Customer experience | Package methods | Best when |
|---|---|---|---|
| Payment Page | Redirect to Solidgate-hosted page | createPaymentPage(), deactivatePaymentPage() |
Fastest setup, minimal frontend |
| Payment Form | Card fields on your site | generateSignature() + app helper for merchantData |
Full UI control, no redirect |
Card API (charge) |
You collect PAN (PCI scope) | charge(), auth(), recurring() |
Full backend control |
| APM | PayPal, Pix, etc. | initializeAlternativePayment() |
Alternative payment methods |
| Subscriptions | Recurring billing | retrieveSubscription(), cancelSubscription(), … |
SaaS / memberships |
Using the package in Laravel
Facade (typical)
Dependency injection (testable)
Signing helper (Payment Form)
Uses the same HMAC-SHA512 algorithm as outbound API requests and webhook verification.
Quick Start
Three-minute path to a successful server-side charge. For hosted or embedded checkout, jump to Checkout integrations.
1. Make your first charge
platform and payment_type are auto-filled from config when omitted. Card expiry fields are normalized automatically (3 → "03", year cast to integer).
2. Full controller example
3. Recurring / token payment
Checkout integrations
Customer-facing checkout using Solidgate UI. For server-side card capture without Solidgate JS, see Card Payments.
| Payment Page | Payment Form | |
|---|---|---|
| Docs | Payment Page | Payment Form |
| UX | Redirect to hosted URL | Embedded on your page |
| Frontend | None required | solid-form.js + PaymentFormSdk.init() |
| Backend | createPaymentPage() |
generateSignature() + encrypt paymentIntent |
| PCI | Card data on Solidgate | Card data tokenized by Solidgate iframe |
Payment Page (hosted)
When to use: you want checkout live quickly with almost no frontend work.
Flow
- Laravel calls
SolidGate::createPaymentPage(['order' => [...], 'page_customization' => [...]]). - API returns a
url(expires in ~24 hours). - Redirect the customer with
redirect()->away($url). - After payment, Solidgate sends the user to your
success_urlorfail_url.
API
| Method | Endpoint | Purpose |
|---|---|---|
createPaymentPage($attributes) |
POST /init |
Create hosted page, get URL |
deactivatePaymentPage($pageId) |
POST /deactivate |
Invalidate page before expiry |
Minimal example
Controller + route
Subscriptions / catalog: use product_price_id in order (from SolidGate::getProductPrices()). See Create your payment page.
Checklist
- [ ] Unique
order_idper checkout attempt - [ ] Public
ip_address(not127.0.0.1in production) - [ ]
success_urlandfail_urlregistered and reachable - [ ] Store
idfrom response if you needdeactivatePaymentPage()later
Payment Form (embedded)
When to use: checkout must match your site design and stay on the same URL.
Flow
- Build a
paymentIntentarray (amount, currency,order_id, customer, URLs, etc.). - Server returns
merchantData:merchant,signature,paymentIntent(encrypted). - Blade loads
https://cdn.solidgate.com/js/solid-form.jsand callsPaymentFormSdk.init({ merchantData }).
merchantData shape (passed to JS)
| Key | Source |
|---|---|
merchant |
config('solidgate.public_key') |
signature |
SolidGate::generateSignature($json) |
paymentIntent |
AES-256-CBC encrypted JSON (see helper below) |
App helper — copy to app/Services/SolidgatePaymentForm.php (no extra Composer package):
Encryption matches Solidgate’s without-SDK PHP guide.
Controller
Field reference: paymentIntent object.
Blade
Checklist
- [ ] Never expose
SOLIDGATE_SECRET_KEYto the browser - [ ] New
order_idon every payment attempt - [ ] Public
ip_address - [ ] Load
solid-form.jsonly once (duplicate script causes init warnings) - [ ] Dynamic amount/plan changes: update payment form
Optional: Official
solidgate/php-sdkexposes$api->formMerchantData($paymentIntent)if you prefer not to maintain the encrypt helper.
Card Payments
Server-side card processing (you send PAN/CVV from your backend). For Solidgate-hosted or embedded UI instead, see Checkout integrations.
All card endpoints use the pay API (pay.solidgate.com/api/v1/).
Required fields for charge()
| Field | Type | Example | Notes |
|---|---|---|---|
amount |
integer | 10000 |
Minor units (cents for USD) |
currency |
string | "USD" |
ISO 4217 |
order_id |
string | UUID | Must be unique per attempt |
order_description |
string | "Premium plan" |
|
customer_email |
string | "[email protected]" |
|
ip_address |
string | "203.0.113.0" |
Public IP only — see Troubleshooting |
platform |
string | "WEB" |
WEB, MOB, or APP |
card_number |
string | "4111…" |
Full PAN, 12–19 digits |
card_holder |
string | "John Doe" |
Name on card |
card_exp_month |
string | "12" |
Zero-padded automatically |
card_exp_year |
integer | 2030 |
4-digit year |
card_cvv |
string | "123" |
Required for first payment |
For token payments, omit card fields and pass payment_type + recurring_token instead.
Available methods
Alternative Payments (APM)
APM endpoints use the gate API (gate.solidgate.com/api/), not the pay API.
Note: Card recurring uses
recurring_token. APM recurring usestoken. These are different field names per SolidGate API spec.
Subscriptions
All subscription endpoints use subscriptions.solidgate.com/api/v1/.
Products, Taxes & Reporting
Webhooks
Receive async events (card_gate.order.updated, chargebacks, etc.) on a Laravel route with signature verification.
Setup
The package registers POST /solidgate/webhook with signature verification middleware.
Exclude from CSRF (Laravel 11+):
Incoming headers
| Header | Description |
|---|---|
solidgate-event-type |
Event name, e.g. card_gate.order.updated |
solidgate-event-id |
Unique event ID |
Signature |
HMAC signature of raw request body |
Merchant |
Webhook public key |
Handle events
Manual signature verification
Responses & Error Handling
SolidGate has two types of errors. Handle both:
| Type | HTTP status | How to detect |
|---|---|---|
| Validation / business error | 200 with error object |
! $response->isSuccessful() |
| Transport / server error | 4xx / 5xx |
SolidGateApiException thrown |
Response helpers
Helper Classes
Platform — customer device
PaymentType — CIT / MIT classification
SolidGateConstants — currency formatting
RefundReason / CancelSubscriptionReason
Official reason codes — see Refund Reasons and Cancel Codes.
Troubleshooting
Payment Page or Form fails to load
| Issue | Fix |
|---|---|
| Form blank / init error | New order_id, public ip_address, required paymentIntent fields |
Invalid IP on checkout |
Use customer public IP in production; see below |
| Payment Form script warning | Load solid-form.js only once |
| Page URL expired | Links last ~24h; call createPaymentPage() again |
Platform is empty or invalid (error 2.01)
Add platform to your request or rely on the config default:
Config default: SOLIDGATE_DEFAULT_PLATFORM=WEB
Invalid IP — private IP rejected
SolidGate rejects private IPs (127.0.0.1, 192.168.x.x, etc.). When testing locally:
In production, always pass the customer's public IP from the frontend or a trusted proxy header.
HTTP 200 but payment failed
SolidGate returns HTTP 200 with an error object for validation failures. Always check isSuccessful() — do not rely on HTTP status alone.
Wrong API base URL
| Symptom | Fix |
|---|---|
| Subscription call hits pay API | Use SolidGate::retrieveSubscription() — routes automatically |
| APM call fails with wrong host | Use initializeAlternativePayment() — uses gate API |
| Custom endpoint needed | Use SolidGate::send(), gate(), or subscriptions() |
Enable request logging
Logs URL, method, status, and response to Laravel's log channel at debug level.
API Reference Map
| Category | Base URL | Key methods |
|---|---|---|
| Card payments | pay.solidgate.com/api/v1/ |
charge, auth, recurring, refund, void, settle, status |
| Alternative payments | gate.solidgate.com/api/ |
initializeAlternativePayment, recurringAlternativePayment |
| Subscriptions | subscriptions.solidgate.com/api/v1/ |
retrieveSubscription, cancelSubscription, createProduct |
| Taxes | subscriptions.solidgate.com/api/v1/ |
createTransactionalTax, downloadTransactionalTax |
| Reporting | reports.solidgate.com/ |
getCardOrdersReport, getRoutingEventsReport |
| Checkout (hosted page) | pay.solidgate.com/api/v1/ |
createPaymentPage, deactivatePaymentPage |
| Checkout (payment link) | pay.solidgate.com/api/v1/ |
createPaymentLink, deactivatePaymentLink |
| Payment Form signing | — (local) | generateSignature() + app encrypt helper — see Payment Form |
| Webhooks | pay.solidgate.com/api/v1/ |
createWebhookEndpoint, listWebhookEndpoints |
Full API spec: api-docs.solidgate.com
Development
CI runs on every push and pull request via GitHub Actions:
| Job | Checks |
|---|---|
| tests | PHPUnit on PHP 8.2 (Laravel 12) and PHP 8.3 (Laravel 13) |
| static-analysis | PHPStan level 5 |
| code-style | Laravel Pint |
| security | Composer audit (advisory) |
Changelog
See CHANGELOG.md for full history.
1.0.2 — APM gate endpoints, PaymentType/Platform helpers, error formatting, routing reports.
1.0.1 — HMAC signing fix, endpoint path corrections, webhook validation, unit tests.
License & References
MIT — see LICENSE.
| Resource | Link |
|---|---|
| API Reference | api-docs.solidgate.com |
| Access & Signing | docs.solidgate.com/payments/integrate/access-to-api |
| Payment Guide | docs.solidgate.com |
| Payment Page | docs.solidgate.com/payments/integrate/payment-page |
| Payment Form | docs.solidgate.com/payments/integrate/payment-form |
| Refund Reasons | docs.solidgate.com/payments/payments-insights/refund-reasons |
| Cancel Codes | docs.solidgate.com/billing/subscription-overview/subscription-insights/subscription-cancel-codes |
All versions of laravel-solidgate with dependencies
illuminate/support Version ^10.0|^11.0|^12.0|^13.0
illuminate/http Version ^10.0|^11.0|^12.0|^13.0
illuminate/routing Version ^10.0|^11.0|^12.0|^13.0