Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 10 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,8 @@ $result = SimplePay::payment()->finish(new FinishRequest(
currency: Currency::HUF,
transactionId: $transactionId,
orderRef: 'ORDER-2026-001',
approveTotal: 25400,
amount: 25400, // the amount to capture (approveTotal)
originalTotal: 25400, // the authorized amount
));
```

Expand All @@ -189,15 +190,15 @@ $result = SimplePay::payment()->refund(new RefundRequest(
currency: Currency::HUF,
transactionId: $transactionId,
orderRef: 'ORDER-2026-001',
refundTotal: 25400,
amount: 25400,
));

// Partial refund
$result = SimplePay::payment()->refund(new RefundRequest(
currency: Currency::HUF,
transactionId: $transactionId,
orderRef: 'ORDER-2026-001',
refundTotal: 10000,
amount: 10000,
));
```

Expand Down Expand Up @@ -381,11 +382,11 @@ Available events (all receive `IpnMessage` DTO):
The `IpnMessage` DTO contains:

```php
$event->ipnMessage->orderRef; // Your order reference
$event->ipnMessage->transactionId; // SimplePay transaction ID
$event->ipnMessage->status; // PaymentStatus enum
$event->ipnMessage->paymentMethod; // PaymentMethod enum
$event->ipnMessage->cardMask; // Masked card number
$event->ipn->orderRef; // Your order reference
$event->ipn->transactionId; // SimplePay transaction ID
$event->ipn->status; // PaymentStatus enum
$event->ipn->paymentMethod; // Payment method as a string, e.g. "CARD"
$event->ipn->cardMask; // Masked card number
```

## Back URL Handling
Expand Down Expand Up @@ -429,7 +430,7 @@ Always use enum cases instead of raw strings:
- **`PaymentStatus`** -- `INIT`, `FINISHED`, `AUTHORIZED`, `NOTAUTHORIZED`, `INPAYMENT`, `CANCELLED`, `TIMEOUT`, `INFRAUD`, `FRAUD`, `REFUND`, `REVERSED`
- **`BackEvent`** -- `SUCCESS`, `FAIL`, `CANCEL`, `TIMEOUT`, `PENDING` (Request to Pay)
- **`TransactionType`** -- `CIT` (Customer Initiated), `MIT` (Merchant Initiated), `REC` (Recurring)
- **`ErrorCode`** -- 358+ error codes with Hungarian descriptions
- **`ErrorCode`** -- 350+ error codes with Hungarian descriptions

## Error Handling

Expand Down
15 changes: 9 additions & 6 deletions examples/en/query-refund-cancel.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,26 +88,29 @@ For transactions started with `twoStep: true`, use `finish()` to capture the aut
```php
use Netipar\SimplePay\Facades\SimplePay;
use Netipar\SimplePay\Enums\Currency;
use Netipar\SimplePay\Dto\FinishRequest;

// Capture the full authorized amount
$finish = SimplePay::payment()->finish(
$finish = SimplePay::payment()->finish(new FinishRequest(
currency: Currency::HUF,
transactionId: 123456,
amount: 5000,
orderRef: 'ORDER-PREAUTH-001',
);
amount: 5000, // the amount to capture
originalTotal: 5000, // the authorized amount
));
```

You can also capture a partial amount (less than the originally authorized total):

```php
// Capture only a portion of the authorized amount
$finish = SimplePay::payment()->finish(
$finish = SimplePay::payment()->finish(new FinishRequest(
currency: Currency::HUF,
transactionId: 123456,
amount: 3000, // Less than the original 5000
orderRef: 'ORDER-PREAUTH-001',
);
amount: 3000, // Less than the original 5000
originalTotal: 5000,
));
```

## Error Handling
Expand Down
14 changes: 9 additions & 5 deletions examples/hu/lekerdezes-es-sztorno.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,25 +94,29 @@ $cancel = SimplePay::payment()->cancel(
Ha a fizetést kétlépcsős módban indítottad (`twoStep: true`), a zárolt összeget a `finish()` metódussal terhelheted:

```php
$finish = SimplePay::payment()->finish(
use Netipar\SimplePay\Dto\FinishRequest;

$finish = SimplePay::payment()->finish(new FinishRequest(
currency: Currency::HUF,
transactionId: 123456,
orderRef: 'ORDER-PREAUTH-001',
amount: 15000,
);
amount: 15000, // a terhelendő összeg
originalTotal: 15000, // a zárolt összeg
));
```

A `finish()` meghívásakor az összeg lehet kisebb is, mint az eredetileg zárolt összeg (részleges terhelés).

```php
// Eredetileg 15000 Ft zárolt
// Csak 12000 Ft terhelése
$finish = SimplePay::payment()->finish(
$finish = SimplePay::payment()->finish(new FinishRequest(
currency: Currency::HUF,
transactionId: 123456,
orderRef: 'ORDER-PREAUTH-001',
amount: 12000,
);
originalTotal: 15000,
));
```

## Hibakezelés
Expand Down
26 changes: 16 additions & 10 deletions resources/boost/skills/simplepay-development/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,16 @@ use Netipar\SimplePay\Facades\SimplePay;

$request = new PaymentRequest(
currency: Currency::HUF,
customerEmail: 'customer@example.com',
total: 6000,
orderRef: 'ORDER-001',
customerEmail: 'customer@example.com',
language: 'HU',
url: route('simplepay.back'),
items: [
new Item(title: 'Product name', price: 1000, quantity: 1),
new Item(title: 'Service', price: 2500, quantity: 2, tax: '27'),
new Item(title: 'Service', price: 2500, quantity: 2, tax: 27),
],
methods: [PaymentMethod::CARD],
url: route('payment.back'),
invoice: new Address(
name: 'Customer Kft.',
country: 'HU',
Expand All @@ -78,7 +80,7 @@ $response = SimplePay::payment()->start($request);

// $response->transactionId (int)
// $response->paymentUrl (string) — redirect user here
// $response->timeout (string)
// $response->timeout (?string)

return redirect($response->paymentUrl);
```
Expand All @@ -92,11 +94,13 @@ use Netipar\SimplePay\Dto\FinishRequest;
// Step 1: authorize
$request = new PaymentRequest(
currency: Currency::HUF,
customerEmail: 'customer@example.com',
total: 5000,
orderRef: 'ORDER-002',
customerEmail: 'customer@example.com',
language: 'HU',
url: route('simplepay.back'),
items: [new Item(title: 'Product', price: 5000, quantity: 1)],
methods: [PaymentMethod::CARD],
url: route('payment.back'),
twoStep: true,
);
$response = SimplePay::payment()->start($request);
Expand All @@ -105,8 +109,9 @@ $response = SimplePay::payment()->start($request);
$finish = new FinishRequest(
currency: Currency::HUF,
transactionId: $response->transactionId,
originalTotal: 5000,
approveTotal: 5000,
orderRef: 'ORDER-002',
amount: 5000, // the amount to capture (sent as approveTotal)
originalTotal: 5000, // the authorized amount
);
$finishResponse = SimplePay::payment()->finish($finish);
// $finishResponse->transactionId, $finishResponse->total
Expand Down Expand Up @@ -143,7 +148,7 @@ class HandleSuccessfulPayment
$ipn->orderRef; // string
$ipn->transactionId; // int
$ipn->status; // PaymentStatus enum
$ipn->paymentMethod; // PaymentMethod enum
$ipn->paymentMethod; // ?string, e.g. "CARD"
$ipn->finishDate; // ?string
}
}
Expand Down Expand Up @@ -197,7 +202,8 @@ use Netipar\SimplePay\Dto\RefundRequest;
$request = new RefundRequest(
currency: Currency::HUF,
transactionId: 123456789,
refundTotal: 1000,
orderRef: 'ORDER-001',
amount: 1000, // sent as refundTotal
);

$response = SimplePay::payment()->refund($request);
Expand Down
Loading