waldson/omnipay-rede-rest-api

用于Omnipay支付处理库的Rede驱动程序

1.0.3 2017-11-08 13:44 UTC

This package is not auto-updated.

Last update: 2024-09-28 03:55:21 UTC


README

Rede Rest API 是Omnipay PHP支付处理库的驱动程序

安装

此库通过 Composer 安装。要安装,请调用

composer require waldson/omnipay-rede-rest-api

支持的方法

此包支持以下方法

  • 授权
  • 捕获
  • 购买(在单个步骤中进行 授权捕获
  • 退款
  • 获取交易

基本用法

此包提供以下网关

  • Rede

示例

use Omnipay\Omnipay;

$gateway = Omnipay::create('Rede');
$gateway->setMerchantId($yourCV); // Filiação
$gateway->setMerchantKey($yourToken); // Token

$card     = array('number' => '4242424242424242', 'expiryMonth' => '6', 'expiryYear' => '2030', 'cvv' => '123', 'name' => 'Holder name');
$response = $gateway->purchase(array('amount' => '10.00', 'reference' => '1', 'card' => $card))->send(); //or authorize(...)

if ($response->isSuccessful()) {
    // payment was successful: update database
    $transactionId = $response->getTransactionId();

    //with transactionId you can fetch...
    $transactionInfo = $gateway->fetchTransaction(['transactionId' => $transactionId]); //you can pass 'reference' too

    //refund...
    $response = $gateway->refund(['transactionId' => $transactionId, 'amount' => '10.00']);

    //or capture (don't work with purchase, you can only capture authorized requests)
    $response = $gateway->capture(['transactionId' => $transactionId, 'amount' => '10.00']);

} else {
    // payment failed: display message to customer
    $errorMessage = $response->getMessage();
    $errorCode    = $response->getCode();
    ...
}

支持

如果您认为发现了错误,请使用 GitHub 问题跟踪器 报告它,或者更好的方法是分支库并提交一个拉取请求。

PS: Rede 是一个巴西支付网关。