ozdemirr/mikro-odeme

Mikro Odeme的PHP SDK用于SOAP API

0.1.0 2015-11-29 22:28 UTC

This package is not auto-updated.

Last update: 2024-09-14 18:52:52 UTC


README

Mikro Odeme PHP SDK

使用Composer进行安装;

composer require "ozdemirr/mikro-odeme:*"

Mikro Ödeme最常用的SaleWithTicket支付类型示例用法;

use MikroOdeme\Model\Sale\SaleWithTicket, MikroOdeme\Model\Shared\Input, MikroOdeme\Model\Sale\MSaleProduct, MikroOdeme\Model\Shared\Token, MikroOdeme\Exception\ConfigurationException, MikroOdeme\Exception\MikroOdemeException;

$token = new Token(); // 设置mikro ödeme api信息。$token->UserCode = "abcdef"; $token->Pin = "123456;

// 将有关订单的所有信息设置到input对象中。$input = new Input();

// Mikro ödeme与您之间,用于支付的相关参考号码。// 设置订单id是合理的。

$input->setMpay(12345);

// 假设有一个$orders数组,用于存储已订购的产品信息。// 我们需要逐个将所有产品的必要信息设置到Input对象中。

foreach($orders as $order){

    $mSaleProduct = MSaleProduct();
    $mSaleProduct->setPrice(10.00);
    
    $input->addMSaleProduct($mSaleProduct);

}

// 创建saleWithTicket对象时,提供$input数据。
$saleWithTicket = new SaleWithTicket($input);
// 设置包含api信息的token对象。$saleWithTicket->setToken($token);

try {

$response = $saleWithTicket->send();

// ödeme ekranı açmamız için gerekli url
$result->SaleWithTicketResult->RedirectUrl;

}catch(ConfigurationException $e){

}catch(MikroOdemeException){

}catch(\Exception $e){

}