coderubix / php-pei
pei支付网关与PHP集成。api.pei.is - 冰岛
dev-master
2021-02-04 16:57 UTC
Requires
- php: >=5.3.0
This package is auto-updated.
Last update: 2024-09-05 00:41:37 UTC
README
+
关于此仓库
PEI支付网关与PHP集成。api.pei.is - 冰岛
关于pei
Pei是由Greiðsluiðlun ehf拥有的支付方式。支付中介是开发和运营支付解决方案、信用购买和债务管理的企业、非政府组织、养老基金和公共机构。
支付中介还运营了Norra注册和支付系统,它使体育俱乐部、组织、市政府和企业能够简化课程、活动和其他各种服务的注册和支付。
如何安装包
-
在CLI中进入您的项目目录
-
使用以下命令更新composer
$: `composer update`
- 运行以下命令到您的PHP项目以安装包。
$: `composer require coderubix/php-pei`
- 包安装成功。
示例
<?php
//If you are using core PHP then first include the class from relevent directory from your code.
require_once "../src/pei/PeiPayment.php";
use Pei\PeiPayment as PeiPayment;
$config = [
'live' => [
'auth_url' => 'https://auth.pei.is/core/connect/token/',
'order_url' => 'https://api.pei.is/api/orders/',
'payment_url' => 'https://gattin.pei.is/',
'client_id' => 'XXXXXXXXXXXXXXX', // replace this with your client id provided by pei.is
'secret_key' => 'XXXXXXXXXXXXXXX', // replace this with your secret provided by pei.is
'merchantid' => 1, // replace this with your merchant id provided by pei.is
'postback_url' => '',
'cancel_url' => '',
'success_url' => ''
],
'sandbox' => [
'auth_url' => 'https://authstaging.pei.is/core/connect/token/',
'order_url' => 'https://externalapistaging.pei.is/api/orders/',
'payment_url' => 'https://gattinstaging.pei.is/',
'client_id' => 'democlient',
'secret_key' => 'demosecret',
'merchantid' => 1,
'postback_url' => '',
'cancel_url' => '',
'success_url' => 'https:///xxxxx.php'
]
];
$PeiPayment = new PeiPayment($config, 'sandbox');
// get auth token
//$auth_token = $PeiPayment->authorize();
$ssn = 5554452454;
$order_info = [
'order_id' => uniqid(),
'user' => [
'firstname' => 'ashok',
'lastname' => 'chandrapal',
'email' => 'developer7039@gmail.com'
],
//optional
'tax' => [
'label' => 'Vat',
'amount' => 100
],
//optional
'shipping' => [
'label' => 'Shipping',
'amount' => 50
],
'items' => [
[
'name' => 'item 1',
'code' => '#FFER23', //optional
'quantity' => 20,
'price' => 100
],
[
'name' => 'item 2',
'quantity' => 30,
'price' => 150
]
]
];
$PeiPayment->pay($ssn, $order_info);
许可证
此仓库是受MIT许可证许可的软件。