btph/gateway-sdk

This package's canonical repository appears to be gone and the package has been frozen as a result.

v3.0 2023-09-07 07:43 UTC

This package is auto-updated.

Last update: 2024-10-17 07:21:14 UTC


README

Lightweight SDK for Gateway API for Laravel Projects

Installation

Install the package using composer

composer require btph/gateway-sdk

⚠️ Make sure to publish the Service Provider by running php artisan vendor:publish and select the package.

Environment Variables

After publishing set the following environment variables to your projects .env file.

GATEWAY_API_KEY=<YOUR GATEWAY API KEY>
GATEWAY_SECRET_KEY=<YOUR GATEWAY SECRET KEY>
GATEWAY_API_URL=<GATEWAY API URL>

How to use

Attaching a customer

To attach a customer details before creating an intent. ⚠️YOU MUST ALWAYS CALL FIRST the attachCustomer function.

// use Btph\GatewaySdk\Facade\Gateway
Gateway::attachCustomer([...customer_object]);

Customer object

Creating intents

To create a deposit intent you must first attach a customer by calling attachCustomer() function and then call createDepositIntent() or createWithdrawalIntent() functions.

Deposit intent

// use Btph\GatewaySdk\Facade\Gateway
Gateway::attachCustomer([...customer_object])->createDepositIntent([..intent_details]);

Withdrawal intent

// use Btph\GatewaySdk\Facade\Gateway
Gateway::attachCustomer([...customer_object])->createWithdrawalIntent([..intent_details]);

Deposit Intent object

Withdrawal Intent object

Processing withdraw transactions

After creating a Withdrawal intent you may now process by calling the processWithdrawalIntent() you will need the Transaction Number, of the transaction you wish to process. so it is adviced to store it somewhere inside your application.

Processing withdrawals

// use Btph\GatewaySdk\Facade\Gateway
Gateway::attachCustomer([...customer_object])->processWithdrawalIntent(<transaction number>, [..details]);

the first argument of processWithdrawalIntent() is the transaction number you wish to process, and the second argument will depend on what transaction method you use when creating the intent.

Processing Local Bank Transfers

To process withdrawals using local bank transfer, the following key pair values are required

⚠️ An important note when processing withdrawals using JPY currencies as the credit currency

To process this kind of transactions an additional key pair values are required.

Processing third party solutions

Oriental Wallet

For Oriental Wallet withdrawals the following key pair values are required.