You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
`** implementation not yet complete for specified payment handler. PRs welcomed if you cannot afford to wait 😉`
32
+
> [!NOTE]
33
+
> _key_:
34
+
> ** for the indicated providers, a few features may be missing. PRs welcomed if you cannot afford the wait 😉
34
35
36
+
> [!TIP]
35
37
> Your preferred payment handler is not yet supported? Please consider [opening the appropriate issue type](https://github.com/damms005/laravel-multipay/issues/new?assignees=&labels=&template=addition-of-new-payment-handler.md&title=Addition+of+new+payment+handler+-+%5Bpayment+handler+name+here%5D).
36
38
37
-
> Adding a new payment handler is straight-forward. Simply add a class that extends `Damms005\LaravelMultipay\Services\PaymentHandlers\BasePaymentHandler` and implement `Damms005\LaravelMultipay\Contracts\PaymentHandlerInterface`
39
+
> [!TIP]
40
+
> Adding a new payment handler is straight-forward. Simply add a class that extends `Damms005\LaravelMultipay\Services\PaymentHandlers\BasePaymentHandler` and implement `Damms005\LaravelMultipay\Contracts\PaymentHandlerInterface`
38
41
39
-
> **Note** <br />
42
+
> [!NOTE]
40
43
> Payment providers that you so register as described above are resolvable from the [Laravel Container](https://laravel.com/docs/9.x/container) to improve the flexibility of this package and improve DX.
41
44
42
45
## Installation
@@ -60,7 +63,7 @@ php artisan migrate
60
63
```
61
64
62
65
### Demo Repo
63
-
I published an open source app that uses this payment package. It is also an excellent example of a Laravel app that uses [Laravel Vite](https://laravel.com/docs/9.x/vite#main-content) and leverages on [Laravel Echo](https://laravel.com/docs/9.x/broadcasting#client-side-installation) to provide realtime experience via public and private channels using [Laravel Websocket](https://beyondco.de/docs/laravel-websockets), powered by [Livewire](https://laravel-livewire.com/docs). The app is called [NFT Marketplace. Click here to check it out ✌🏼](https://github.com/damms005/nft-marketplace)
66
+
I [published an open source app](https://github.com/damms005/nft-marketplace) that uses this payment package. It is also an excellent example of a Laravel app that uses [Laravel Vite](https://laravel.com/docs/9.x/vite#main-content) and leverages on [Laravel Echo](https://laravel.com/docs/9.x/broadcasting#client-side-installation) to provide realtime experience via public and private channels using [Laravel Websocket](https://beyondco.de/docs/laravel-websockets), powered by [Livewire](https://laravel-livewire.com/docs).
- Paystack: Paystack requires a secret key. Go to [the Paystack dashboard](https://dashboard.paystack.co/#/settings/developer) to obtain one, and use it to set the following variable:
- Remita: Ensure to set the following environment variables:
97
100
98
101
```
99
-
REMITA_MERCHANT_ID=xxxxxxxxxxxxxxxxxxxxx-X
100
-
REMITA_API_KEY=xxxxxxxxxxxxxxxxxxxxx-X
102
+
REMITA_MERCHANT_ID=xxxxxxxxxxxxxxxxxxxxx
103
+
REMITA_API_KEY=xxxxxxxxxxxxxxxxxxxxx
101
104
```
102
105
103
106
> For most of the above environment variables, you should rather use the (published) config file to set the corresponding values.
@@ -126,17 +129,26 @@ Upon user confirmation of transaction, user is redirected to the appropriate pay
126
129
When user is done with the transaction on the payment handler's end (either successfully paid, or declined transaction), user is redirected
127
130
back to `/payment/completed` (`route('payment.finished.callback_url')` provided by this package) .
128
131
129
-
> [!NOTE]
130
-
> If the `Payment` has [`metadata`](#step-1) (supplied with the payment initiation request), with a key named `completion_url`, the user will be redirected to that URL instead on successful payment, with the transaction reference included as `transaction_reference` in the URL query string.
132
+
### Metadata Usage
131
133
132
-
> [!NOTE]
133
-
> If the `Payment` has [`metadata`](#step-1) (supplied with the payment initiation request), and it contains a key named `payment_processor`, it will be used to dynamically set the payment handler for that particular transaction. Valid value is any of [the providers listed above](#currently-supported-payment-handlers)
134
+
In the payment initiation request in [Step 1](#step-1), you can provide a `metadata` field. This field is stored in the `metadata` column of the `payments` table, and available as `AsArrayObject::class` property of the `Payment` model and it provides powerful customization options for individual payments.
134
135
135
-
> [!NOTE]
136
-
> If the `Payment` has [`metadata`](#step-1) (supplied with the payment initiation request), with a key named `split_code`, for Paystack transactions, it will be processed as [Paystack Multi-split Transaction](https://paystack.com/docs/payments/multi-split-payments).
136
+
The metadata should be a valid JSON string containing key-value pairs that modify payment behavior.
137
137
138
-
> [!NOTE]
139
-
> If there are additional steps you want to take upon successful payment, listen for `SuccessfulLaravelMultipayPaymentEvent`. It will be fired whenever a successful payment occurs, with its corresponding `Payment` model.
138
+
#### Available Metadata Keys
139
+
140
+
**`completion_url`**
141
+
- After successful payment, the user will be redirected to the URL specified by this key instead of the default payment completion page
142
+
- When user is redirected to the specified URL, the transaction reference will be included as `transaction_reference` in the URL query string
143
+
144
+
**`payment_processor`**
145
+
- Use this key to dynamically set the payment handler for the specific transaction
146
+
- Valid values are any of [the providers listed above](#currently-supported-payment-handlers)
147
+
- This will override the default payment processor configuration
148
+
149
+
**`split_code`** (Paystack only)
150
+
- When using Paystack, you can use this key to specify a split code to process the transaction as a [Paystack Multi-split Transaction](https://paystack.com/docs/payments/multi-split-payments)
151
+
- This feature is only available when using Paystack as the payment handler
140
152
141
153
## Payment Conflict Resolution (PCR)
142
154
@@ -146,16 +158,24 @@ If for any reason, your user/customer claims that the payment they made was succ
146
158
/**
147
159
* @var bool //true if payment was successful, false otherwise
The payment will be re-resolved and the payment will be updated in the database. If the payment is successful, the `SuccessfulLaravelMultipayPaymentEvent` event will be fired, so you can run any domain/application-specific procedures.
153
165
154
-
## Payment Notifications (WebHooks)
155
-
Some payment handlers provide a means for sending details of successful notifications. Usually, you will need to provide the payment handler with a URL to which the details of such notification will be sent. Should you need this feature, the notification URL is handled by `route('payment.external-webhook-endpoint' provided by this package)`.
166
+
## WebHooks Payment Notifications (optional)
167
+
One of the benefits of this package is to remove the need for you to have to deal with payment webhooks. Depending on your needs, the event handling may suffice for your use case.
168
+
169
+
If you need webhook notifications from payment providers, use the webhook endpoint provided by this package: `route('payment.external-webhook-endpoint')`.
156
170
157
171
> If you use this payment notification URL feature, ensure that in the handler for `SuccessfulLaravelMultipayPaymentEvent`, you have not previously handled the event for that same payment.
158
172
173
+
## Events
174
+
175
+
### SuccessfulLaravelMultipayPaymentEvent
176
+
177
+
If there are additional steps you want to take upon successful payment, listen for `SuccessfulLaravelMultipayPaymentEvent`. This event will be fired whenever a successful payment occurs, with its corresponding `Payment` model.
0 commit comments