Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge Chapa - to - Base #8

Merged
merged 15 commits into from
Jul 25, 2024
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
35 changes: 35 additions & 0 deletions .github/workflows/workflow_laravel.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Laravel

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

jobs:
laravel-tests:

runs-on: ubuntu-latest

steps:
- uses: shivammathur/setup-php@15c43e89cdef867065b0213be354c2841860869e
with:
php-version: '8.0'
- uses: actions/checkout@v3
- name: Copy .env
run: php -r "file_exists('.env') || copy('.env.example', '.env');"
- name: Install Dependencies
run: composer install -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist
- name: Generate key
run: php artisan key:generate
- name: Directory Permissions
run: chmod -R 777 storage bootstrap/cache
- name: Create Database
run: |
mkdir -p database
touch database/database.sqlite
- name: Execute tests (Unit and Feature tests) via PHPUnit
env:
DB_CONNECTION: sqlite
DB_DATABASE: database/database.sqlite
run: vendor/bin/phpunit
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,11 @@ All notable changes to `chapa-laravel` will be documented in this file
## 1.0.0 - 201X-XX-XX

- initial release

## 1.0.1 - 2023-05-22

- Supporting latest `Laravel version (10.x)`, formatting and other minor reported bugs.

## 1.0.2 - 2024-07-22

- Support Transfers {Create and Verify} [beta]
45 changes: 33 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
# Unofficial laravel package for Chapa's API (Laravel 5,6,7,9 )

If your are doing a laravel project and want to integrate chapa's payment
<h1 align="center">
<div align="center">
<a href="http://chapa.co/" target="_blank">
<img src="https://assets.chapa.co/assets/images/chapa-logo.svg" width="320" alt="Chapa Logo"/>
</a>
<p align="center">Official Laravel package for Chapa's API (Laravel 5,6,7,9,10)</p>
</div>
</h1>

If your are doing a Laravel project and want to integrate Chapa's payment
solution, this package would help big time.

Go to [Chapa](https://dashboard.chapa.co/) to signup and get your public and private key
Go to [Chapa](https://dashboard.chapa.co/) to signup and get your secret key

## Documentation

Expand All @@ -15,16 +22,14 @@ Please visit [Developers Guide](https://developer.chapa.co/laravel-sdk/) for ful

### Usage

You can check [this](https://github.com/Chapa-Et/sdk-examples/tree/master/chapa-laravel-example) sample laravel code as a reference.
You can check [this](https://github.com/Chapa-Et/sdk-examples/tree/master/chapa-laravel-example) sample Laravel code as a reference.

### Configuration

Open your .env file and add your public key, secret keys, and other environment variables like this:

```
CHAPA_PUBLIC_KEY=FLWPUBK-xxxxxxxxxxxxxxxxxxxxx-X
CHAPA_SECRET_KEY=FLWSECK-xxxxxxxxxxxxxxxxxxxxx-X
CHAPA_WEBHOOK_SECRET='My_webook_secret_key123'
CHAPA_SECRET_KEY=CHAPA-SECK-xxxxxxxxxxxxxxxxxxxxx-X
```

## Features
Expand All @@ -33,6 +38,8 @@ The current features have been implemented

- Initiate Payment
- Payment verification
- Create a Transfer
- Verify a Transfer

## API Reference

Expand All @@ -45,12 +52,14 @@ The current features have been implemented
| Parameter | Type | Required | Description |
| :--------------------------- | :------- | :------- | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `key` | `string` | **Yes**. | This will be your public key from Chapa. When on test mode use the test key, and when on live mode use the live key. |
| `email` | `string` | **Yes**. | A customer’s email. address. |
| `email` | `string` | **No**. | A customer’s email. address. |
| `phone_number` | `numeric` | **No**. | A customer’s phone number. address. |
| `amount` | `string` | **Yes**. | The amount you will be charging your customer. |
| `first_name` | `string` | **Yes**. | A customer’s first name. |
| `last_name` | `string` | **Yes**. | A customer’s last name. |
| `first_name` | `string` | **No**. | A customer’s first name. |
| `last_name` | `string` | **No**. | A customer’s last name. |
| `tx_ref` | `string` | **Yes**. | A unique reference given to each transaction. |
| `callback_url` | `string` | **Yes**. | Function that runs when payment is successful. This should ideally be a script that uses the verify endpoint on the Paystack API to check the status of the transaction. |
| `callback_url` | `string` | **No**. | Function that runs when payment is successful. This should ideally be a script that uses the verify endpoint on the Chapa API to check the status of the transaction. |
| `return_url` | `string` | **No**. | A web address provided by the merchant to a payment gateway during payment integration. It serves as the destination where the payment gateway sends the customer after completing a payment transaction. |
| `currency` | `string` | **Yes**. | The currency in which all the charges are made. Currency allowed is ETB. |
| `customization[tiitle] ` | `string` | **No**. | The customizations field (optional) allows you to customize the look and feel of the payment modal. You can set a logo, the store name to be displayed (title), and a description for the payment.. |
| `customization[description]` | `string` | **No**. | The customizations field (optional) allows you to customize the look and feel of the payment modal. |
Expand All @@ -65,6 +74,18 @@ The current features have been implemented
| :-------- | :------- | :------- | :------------------------------------------------------------------------------------------------------------------- |
| `key` | `string` | **Yes**. | This will be your public key from Chapa. When on test mode use the test key, and when on live mode use the live key. |



### Verify Transfers

```https
GET https://api.chapa.dev/v1/transfers/verify/{tx-ref}
```

| Parameter | Type | Required | Description |
| :-------- | :------- | :------- | :------------------------------------------------------------------------------------------------------------------- |
| `key` | `string` | **Yes**. | This will be your public key from Chapa. When on test mode use the test key, and when on live mode use the live key. |

### Changelog

Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.
Expand Down
11 changes: 8 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,17 @@
"name": "Kidus Yared",
"email": "[email protected]",
"role": "Developer"
},
{
"name": "Israel Goytom",
"email": "[email protected]",
"role": "CTO"
}
],
"require": {
"php": "^7.4|^8.0",
"guzzlehttp/guzzle": "^7.4.5",
"illuminate/support": "^5.0|^6.0|^7.0|^8.0|^9.0"
"php": "^7.2|^8.0|^8.1",
"guzzlehttp/guzzle": "~6|~7|~8|~9",
"illuminate/support": "^5.0|^6.0|^7.0|^8.0|^9.0|^10.0"
},
"require-dev": {
"orchestra/testbench": "^6.0",
Expand Down
Loading
Loading