webgatetec/omnipay-webdosh

OmniPay的WebDosh支付平台驱动程序

dev-master 2018-04-13 07:06 UTC

This package is not auto-updated.

Last update: 2024-09-28 10:14:24 UTC


README

WebDosh网关是用于Omnipay PHP支付处理库的。

Omnipay是一个与框架无关的多网关支付处理库,适用于PHP 5.3及以上版本。

基本用法

向WebDosh支付平台网关发送支付请求时,至少需要提供以下参数:

  • merchant_id 您的商户账户ID
  • transactionId 唯一的交易ID
  • amount 货币金额
  • currency 货币类型
$gateway = Omnipay::create('WebDosh');
$gateway->setMerchantId('myTestMerchantId');
$gateway->setMerchantSecret('myTestMerchantSecret');

// Create Omnipay CreditCard
$card = new CreditCard([
    'number'      => $number,
    'firstName'   => $firstName,
    'lastName'    => $lastName,
    'expiryMonth' => $month,
    'expiryYear'  => $year,
    'cvv'         => $cvv
]);

//Make Purchase request
$purchaseTransaction = $this->gateway->purchase([
    'amount'   => 5000,
    'currency' => 'AUD',
    'card'     => $card
]);

//Make Refund request
$refundTransaction = $this->gateway->refund([
    'transaction_id' => 'test-id',
    'amount'         => 5000,
]);

//Make Status request
$statusTransaction = $this->gateway->status([
    'amount'         => 5000,
    'transaction_id' => 'test-id'
]);

//Make Tokenize requset 
$tokenizeRequset = $this->gateway->createCard([
    'currency'    => 'AUD',
    'card'        => $card
]);

//Make Token Payment request
$tokenPaymentTransaction =$this->gateway->tokenPayment([
    'currency'               => 'AUD',
    'amount'                 => 5000,
    'card_verification_code' => 111,
    'token'                  => 'test-token',
]);