Download the PHP package jkbroot/thawani without Composer
On this page you can find all versions of the php package jkbroot/thawani. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download jkbroot/thawani
More information about jkbroot/thawani
Files in jkbroot/thawani
Package thawani
Short Description A Laravel package for Thawani payment gateway integration.
License MIT
Informations about the package thawani
jkbroot/thawani
This Laravel package facilitates easy integration with the Thawani payment gateway, offering a straightforward and intuitive set of functionalities for payment session creation, customer management, and transaction handling, all within your Laravel application.
Features
- Easy integration with Laravel applications
- Support for creating and managing Thawani checkout sessions
- Customer management utilities
- Payment and refund handling
- Support for payment intents
Requirements
- PHP 7.3 or higher
- Laravel 6.0 or higher
Installation
This package supports Package Auto-Discovery, which was introduced in Laravel 5.5. Therefore, it doesn't require manual registration of the ServiceProvider in most cases.
If you're using a version of Laravel where auto-discovery is not supported or have specifically disabled it, you need to register the ServiceProvider manually.
Add the ServiceProvider to the providers array in config/app.php:
Configuration:
Publish the configuration file by running the following Artisan command. This will publish the Thawani configuration file to config/thawani.php, where you can customize your settings.
_Copy the Thawani Pay configuration snippet you provided and paste it into your .env file. However,The THAWANIMODE should be set to live instead of test for a production environment :
Replace your_thawani_live_secret_key and your_thawani_live_publishable_key with your actual Thawani live secret and publishable keys.
Instantiating ThawaniPay Class
To begin using the Thawani payment functionality, you need to instantiate the ThawaniPay
class. Follow these steps:
Step 1: Import ThawaniPay Class
Before you can create an instance of the ThawaniPay
class, ensure that you import it into your PHP file using the use
statement:
Step 2: Instantiate ThawaniPay Class
Once the class is imported, you can instantiate it using the following code:
This creates an instance of the ThawaniPay class, allowing you to utilize its methods and properties for handling Thawani payments within your Laravel application.
Additional Notes
- Ensure that you have installed the jkbroot/thawani package via Composer before attempting to use it.
- Review the package documentation for any specific configurations, requirements, or additional functionality provided by the package.
How to use :
1 - checkout & session
- Create session :
Create session Response :
- Retrieve session :
Retrieve session Response :
- Cancel session :
Cancel session Response :
- list Sessions :
list Sessions Response :
-
create Checkout Url :
-
create Checkout Url Response:
- session_id: A unique identifier for the created checkout session.
- redirect_url: The URL to which you should redirect your customers to complete the payment process. This URL leads to Thawani's payment gateway, where the customer can enter their payment details securely.
2 - Customers
-
create customer :
-
create customer Response:
-
retrieve customer :
-
retrieve customer Response:
-
delete customer :
- list customers : ``
3 - Pyament Intents
-
list payment intent :
-
list payment intent Response:
-
create payment intent :
- create payment intent Response:
Here's a concise explanation for each method in the supported classes of your Laravel package for integrating the Thawani payment gateway:
CheckoutSessions
create
: Initializes a new payment session.retrieve
: Fetches details of a specific session.cancel
: Cancels an existing session.list
: Lists all sessions with optional pagination.createCheckoutUrl
: Generates a URL for the payment checkout page.retrieveByClientReference
: Retrieves a session using a client-provided reference ID.retrieveByInvoice
: Retrieves a session using an invoice number.
Customers
create
: Registers a new customer in the payment system.retrieve
: Retrieves information about a specific customer.delete
: Removes a customer from the system.list
: Lists all customers with optional pagination.
PaymentIntents
create
: Creates a payment intent to initiate a transaction.retrieve
: Fetches details of a specific payment intent.cancel
: Cancels an unresolved payment intent.list
: Lists payment intents with optional pagination.confirm
: Confirms a payment intent, attempting to finalize the transaction.
PaymentMethods
list
: Lists all payment methods associated with a given customer ID.delete
: Deletes a specified payment method from a customer's account.
Refunds
create
: Initiates a refund for a specific transaction.retrieve
: Retrieves details of a specific refund.list
: Lists all refunds with optional pagination.
This overview provides a quick guide to the functionalities available in your Laravel package for integrating Thawani payment services.