loov-payment/laravel-sdk

1.0.2 2023-10-12 16:19 UTC

This package is auto-updated.

Last update: 2024-04-16 15:19:06 UTC


README

Build Status Total Downloads Latest Stable Version License

Introduction

Loov Solutions is an online payment tools.

Installation

Run this in your terminal to install loov fro comand line

composer require loov-payment/laravel-sdk

Requirements

  • amount: The payment amount in the specified currency.
  • currency: The currency code of the payment amount.
  • description: Description of the payment purpose.
  • username: Customer name.
  • email: Customer email.
  • operator: The mobile operator code used for the payment (e.g., "orange-money-cm")
  • phoneNumber: Customer phone number.
  • return_url: URL to redirect after successful payment.
  • cancel_url: URL to redirect if payment is canceled.
  • callback_url: URL for payment notifications (webhook).
  • payment_mode: The chosen payment mode. value: ALL, CARD, MOBILE_MONEY.

Pay In

<?php
namespace App\Htpp\Controllers;
use Loovpayment\LaravelSdk\LoovService; 

class payment extends Controller{

    public function payment(){
        
     $data =[
        'amount' =>50000,
        'currency' => 'XAF',
        'payment_mode' => 'CARD',
        "return_url" => "https://google.com?state=return_url",
        "cancel_url" => "https://google.com?state=cancel",
        "callback_url" => "https://webhook.site/9c647add-6b43-4832-bd5d-db529c7c9b79",
        "description" => "test payment de service en ligne",
        "username" => "Arolle Fona",
        "email" =>"arollefona11@gmail.com",
        "phoneNumber" => "237699009999"
     ];
     $response = (new LoovService())->setKeys(AppKey MerchantKey)->payIn($data);   
    }

}

Success Response

Upon successful payment initiation, the API will respond with a status code of 200 along with the following response body:

{
    "status": 200,
    "message": "Payment initiated",
    "payment_url": "https://api.secure.payment.loov-solutions.com/payinit/oa7DZzEd8gwJ5PYQ",
    "reference": "LOC8SXoZuDVEvu1ODxs"
}

Mobile SoftPay

<?php
namespace App\Htpp\Controllers;
use Loovpayment\LaravelSdk\LoovService; 

class payment extends Controller{

    public function payment(){
     $data =[
        'amount' =>50000,
        'operator' => 'XAF',
        "callback_url" => "https://webhook.site/9c647add-6b43-4832-bd5d-db529c7c9b79",
        "username" => "Arolle Fona",
        "email" =>"arollefona11@gmail.com",
        "phoneNumber" => "237699009999"
     ];
     $response = (new LoovService())->setKeys(AppKey MerchantKey)->mobileSoftPay($data);
    }

}

Success Response

Upon successfully initiating the mobile payment, the API will respond with a JSON object containing payment information.

{
    "error": false,
    "status": "success",
    "amount": "500",
    "fees": 10,
    "message": "Confirm the payment by entering your PIN code and you will receive an SMS. Thank you for using Orange Money services.",
    "reference": "LOMoac3hqZXuBHUHKy8"
}

Supported Operators

country operator operator_code
Benin Mtn mtn-benin
Benin Moov moov-benin
Cameroon Orange orange-money-cm
Cameroon Mtn mtn-cm
Ivory Coast Mtn mtn-ci
Ivory Coast Moov moov-ci
Mali Moov moov-ml
Mali Orange orange-money-ml
Senegal Orange orange-money-senegal
Senegal Expresso expresso-senegal
Senegal Free free-money-senegal
Senegal Wave Senegal wave-senegal
Togo T-money t-money-togo

Pay Out

<?php
namespace App\Htpp\Controllers;
use Loovpayment\LaravelSdk\LoovService; 

class payment extends Controller{

    public function payment(){
     $data =[
        'amount' =>50000,
        "operator": "orange-money-cm",
        'phoneNumber' => '237699009999',
        "currency" => "XAF"
     ];
     $response = (new LoovService())->setKeys(AppKey MerchantKey)->payOut($data);
    }

}

Success Response

Upon successfully initiating the mobile payment, the API will respond with a JSON object containing payment information.

{
    "error": false,
    "status": "success",
    "amount": "50000",
    "reference": "MOMAVzvTY7DLyiRCR38",
    "message": "Transfer of 500 XAF transferred to 237699009999"
}

Check Status

<?php
namespace App\Htpp\Controllers;
use Loovpayment\LaravelSdk\LoovService;  

class payment extends Controller{

    public function payment(){
     $response = (new LoovService())->setKeys(AppKey MerchantKey)->checkStatus($reference);
    }

}

Success Response

Upon successfully retrieving the payment status, the API will respond with a JSON object containing the payment status information.

{
    "error": false,
    "reference": "MOMAVzvTY7DLyiRCR38",
    "amount": "500",
    "currency": "XAF",
    "status": "initiated",
    "date": "2023-08-08 09:08:17",
    "customer": null
}

Security Vulnerabilities

If you discover a security vulnerability within Laravel, please send an e-mail to Arolle Fona via fona.arolle@mounir-holding.com. All security vulnerabilities will be promptly addressed.

License

The Laravel framework is open-sourced software licensed under the MIT license.