Download the PHP package vandarpay/cashier without Composer

On this page you can find all versions of the php package vandarpay/cashier. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package cashier

Vandar Cashier

GitHub license GitHub Workflow Status Packagist Downloads Packagist PHP Version Support Laravel Version Support

Vandar Cashier is a Laravel package that provides you with a seamless integration with Vandar services. Take a look at Vandar Documentation for more information on the services we provide.

Setup

To use Vandar Cashier, you need to install it through Composer first:

Then, you will need to publish the package's assets and migrate your project's database to add Vandar Cashier's tables:

After that, open your User model (located in app/User.php or app/Models/User.php in most projects) and add the Billable trait:

You will need to add the necessary configuration to your .env file:

VANDAR_MOBILE and VANDAR_PASSWORD are your login credentials to Vandar dashboard, the VANDAR_BUSINESS_SLUG is set by you when you add a business in Vandar and VANDAR_API_KEY is obtained through your business dashboard.

Usage

Currently, Vandar Cashier supports three of Vandar services: IPG, Direct Debit, and Settlement. IPG is the more common method used which provides you with a link that the user can use to pay for a service. The direct debit service works by requesting access from a user's bank account and withdrawing from their accounts periodically without a need for user interaction.

IPG

Independent

if you're creating a donation form, or you don't really need a logged-in user to make payments, you will need two paths. The first path is going to be initiating the payment and sending it to payment gateway. The second path (also known as callback url) will verify the transaction once your user has returned.

User-Dependent

In a user-dependant scenario, we are assuming that anyone making a payment is already logged-in to your system, therefore, you can create a payment link for them to redirect them to through their user model:

Callback URL

Once the transaction finishes (successfully or not), they will be redirect back to the path you defined in callback, you may define a controller or a route to verify the payment using the Payment::verify($request) method:

The verify method automatically updates the transaction status in your database.

Also, for IPG, you're going to need to define a callback url for when users are returning from Vandar to your application, you can either set the VANDAR_CALLBACK_URL environment variable or modify config/vandar.php. You will also need to add the callback URL in your Business Dashboard in Vandar or otherwise it will lead into an error.

Direct-Debit

When setting up direct-debit, you have two main steps to take.

  1. Get user to allow for access to their account (also known as a Mandate)
  2. Request a withdrawal from a user's account

Mandate

A mandate is basically a permission that a customer gives us to access their accounts. in Vandar, a customer is defined by their phone number and that's considered the primary key when it comes to customers. if you're planning to use subscription services in your project, you will need a mobile_number column in your users table. This code can be used as a migration that will add such a column:

You may also pass the mobile_number key in the array passed to authorizeMandate manually.

You can then create a mandate and redirect the user to the bank for authorizing the mandate:

You are also going to need a callback url for the user to return to after they're finished with the mandate process, this path should be set as an absolute url through VANDAR_MANDATE_CALLBACK_URL or editing the config file.

You can verify whether the mandate was successfully made and update the mandate accordingly using the Mandate::verifyFromRequest method:

You can also revoke any mandates through the Mandate model's revoke function:

Since the only way for a user to cancel a mandate is through your platform, it is standard to provide a way for users to do so in a convenient way.

Withdrawal

Once the mandate has been created successfully, you may create a withdrawal through the mandate:

Please note that you may use any method you like to find your current mandate, for example if you have more than one mandate per user, you may use different queries to find that particular mandate.

When creating a new withdrawal, passing authorization_id and notify_url is not necessary as Cashier automatically sets these values.

Note: if not provided, Vandar Cashier automatically sets withdrawal_date to now. (date('Y-m-d'))

if you're not creating an instant withdrawal (is_instant = false) you can also cancel the withdrawal before it is run:

Settlement

Vandar Cashier provides the ability to make requests for settlements:

Once a settlement is created successfully, Vandar will queue the settlement and send it to bank. When the settlement is finalized, a notification will be sent to the URL specified in settlement_notify_url in vandar config.

Vandar Cashier provides a route that automatically handles settlement updates and updates your databases accordingly, so you don't need to update the settlement_notify_url unless you need to implement your own solution.

You may also cancel a settlement through the cancel method before it is done, if successful, CANCELED will be returned. if the cancel attempt fails, the last known settlement status is returned from the database:

Utilities

You may use the Vandar::getBanksHealth() method to get an array containing a list of all banks and whether they're healthy.

Error Handling

When making contact with Vandar APIs, a series of exceptions may be raised due to errors while processing your requests in the APIs. All of these errors can be caught and processed through Vandar\Exceptions\ResponseException exception. This means that all exceptions raised by Cashier have the following methods:

You may also attempt to differentiate between the errors based on the exception that was raised:

License

All material in this project (unless otherwise noted) are available under the MIT License. See LICENSE for more information.


All versions of cashier with dependencies

PHP Build Version
Package Version
Requires php Version ^7.2.5|^8.0|^8.1
guzzlehttp/guzzle Version ^6.3.1|^7.0.1
illuminate/support Version ^6.0|^7.0|^8.0|^9.0|^10.0
illuminate/database Version ^6.0|^7.0|^8.0|^9.0|^10.0
illuminate/routing Version ^6.0|^7.0|^8.0|^9.0|^10.0
illuminate/http Version ^6.0|^7.0|^8.0|^9.0|^10.0
ext-json Version *
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package vandarpay/cashier contains the following files

Loading the files please wait ....