worldline-ind/php-checkoutjs
最新稳定版本:v1.0.0
Composer 安装命令:
composer require worldline-ind/php-checkoutjs
包简介
PHP CheckoutJS integration for Worldline
README 文档
README
PHP CheckoutJS Integration Documentation
PHP CheckoutJS Integration
Integrate your PHP applications with Worldline's CheckoutJS to seamlessly handle payments.
Badges
Table of Contents
Installation
Install the package via Composer:
composer require worldline-ind/php-checkoutjs
Configuration
Place the worldline_AdminData.json file in your project root with the following contents:
{
"merchantCode": "YOUR_MERCHANT_CODE",
"merchantSchemeCode": "YOUR_SCHEME_CODE",
"salt": "YOUR_SALT",
"typeOfPayment": "TEST",
"currency": "INR",
"primaryColor": "#000000",
"secondaryColor": "#FFFFFF",
"buttonColor1": "#0000FF",
"buttonColor2": "#FFFFFF",
"logoURL": "https://yourdomain.com/logo.png",
"enableExpressPay": true,
"separateCardMode": false,
"enableNewWindowFlow": true,
"merchantMessage": "Thank you for your order!",
"disclaimerMessage": "Please review your order before proceeding.",
"paymentMode": "ALL",
"paymentModeOrder": "NB,CARD,UPI",
"enableInstrumentDeRegistration": false,
"transactionType": "SALE",
"hideSavedInstruments": false,
"saveInstrument": false,
"displayTransactionMessageOnPopup": false,
"embedPaymentGatewayOnPage": false,
"enableEmandate": false,
"hideSIConfirmation": false,
"expandSIDetails": false,
"enableDebitDay": false,
"showSIResponseMsg": false,
"showSIConfirmation": false,
"enableTxnForNonSICards": false,
"showAllModesWithSI": false,
"enableSIDetailsAtMerchantEnd": false
}
Usage
Basic Usage
Initialize the Checkout Class:
<?php
require 'vendor/autoload.php';
use WorldlineInd\CheckoutJS\Checkout;
$checkout = new Checkout("YOUR_MERCHANT_CODE", "INR", "YOUR_SALT");
?>
Process Payment Request:
<?php
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$data = [
'mrctCode' => $_POST['mrctCode'],
'txn_id' => $_POST['txn_id'],
'amount' => $_POST['amount'],
'custID' => $_POST['custID'],
'mobNo' => $_POST['mobNo'],
'email' => $_POST['email'],
'returnUrl' => $_POST['returnUrl'],
];
$checkout->processPayment($data);
}
?>
Handle Payment Response:
<?php
$response = $_POST;
$verified = $checkout->verifyResponse($response);
if ($verified) {
if ($response['statusCode'] == '0300') {
echo "Transaction Successful";
} else {
echo "Transaction Failed";
}
} else {
echo "Invalid response hash";
}
?>
Advanced Features
Explore additional functionalities such as refunds, reconciliation, and server-to-server communication within the documentation.
<?php
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$transactionIdentifier = $_POST['transactionIdentifier'];
$fromDate = $_POST['fromtransactionDate'];
$toDate = $_POST['totransactionDate'];
$reconciliationData = $checkout->reconcile($transactionIdentifier, $fromDate, $toDate);
// Process reconciliation data
}
?>
Testing
Run the following command to execute tests:
phpunit
Contributing
Contributions are welcome! Please see CONTRIBUTING.md for more details.
License
This project is licensed under the MIT License - see the LICENSE file for details.
统计信息
- 总下载量: 8
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-07-01