webimpian / bayarcash-php-sdk
Bayarcash payment gateway PHP Sdk.
Installs: 80
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 1
Open Issues: 0
Type:sdk
Requires
- php: ^7.4|^8.0|^8.1
- ext-json: *
- guzzlehttp/guzzle: ^6.5
Requires (Dev)
- illuminate/support: ^7.0|^8.0|^9.0|^10.0|^11.0
- psr/simple-cache: ^2.0
README
Introduction
The Bayarcash SDK provides an expressive interface for interacting with Bayarcash API.
Official Documentation
Installation
To install the SDK in your project you need to require the package via composer:
composer require webimpian/bayarcash-php-sdk
Basic Usage
You can create an instance of the SDK like so:
$bayarcash = new Webimpian\BayarcashSdk\Bayarcash(TOKEN_HERE); $bayarcash->useSandbox(); // call this method to switch to use sandbox
For Laravel user:
// set value for BAYARCASH_API_TOKEN and BAYARCASH_API_SECRET_KEY in the .env file BAYARCASH_API_TOKEN= BAYARCASH_API_SECRET_KEY=
$bayarcash = app(\Webimpian\BayarcashSdk\Bayarcash::class); $bayarcash->useSandbox(); // call this method to switch to use sandbox
You may create checksum value for your payment request using:
$paymentIntentRequestChecksum = $bayarcash->createPaymentIntenChecksumValue(API_SECRET_KEY, REQUEST_DATA); // append checksum value to your REQUEST_DATA // $data['checksum'] = $paymentIntentRequestChecksum
Note: The checksum value and checksum validation are optional, but it is recommended for enhanced security.
Send your payment request using:
$response = $bayarcash->createPaymentIntent(REQUEST_DATA); header("Location: " . $response->url); // redirect payer to Bayarcash checkout page.
Verify callback using:
// pre-transaction callback $validResponse = $bayarcash->verifyPreTransactionCallbackData(CALLBACK_DATA, API_SECRET_KEY); // transaction callback $validResponse = $bayarcash->verifyTransactionCallbackData(CALLBACK_DATA, API_SECRET_KEY);
FPX Direct Debit
1. FPX Direct Debit Enrolment
$enrolmentRequestChecksum = $bayarcash->createFpxDIrectDebitEnrolmentChecksumValue(API_SECRET_KEY, REQUEST_DATA); // append checksum value to your REQUEST_DATA // $data['checksum'] = $enrolmentRequestChecksum $response = $this->bayarcashSdk->createFpxDirectDebitEnrollmentIntent($data); header("Location: " . $response->url); // redirect payer to Bayarcash Fpx Direct Debit enrolment page.
2. FPX Direct Debit Maintenance
$maintenanceRequestChecksum = $bayarcash->createFpxDIrectDebitMaintenanceChecksumValue(API_SECRET_KEY, REQUEST_DATA); // append checksum value to your REQUEST_DATA // $data['checksum'] = $maintenanceRequestChecksum $response = $this->bayarcashSdk->createFpxDirectDebitMaintenanceIntent($data); header("Location: " . $response->url); // redirect payer to Bayarcash Fpx Direct Debit maintenance page.
3. FPX Direct Debit Termination
$response = $this->bayarcashSdk->createFpxDirectDebitTerminationIntent($data); header("Location: " . $response->url); // redirect payer to Bayarcash Fpx Direct Debit termination page.
Official API Documentation
Please refer to the Official Bayarcash API Documentation for detailed information about our API.
Changelog
Please see CHANGELOG for more information what has changed recently.