descubraomundo/omnipay-pagarme 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

descubraomundo/omnipay-pagarme

最新稳定版本:v3.1

Composer 安装命令:

composer require descubraomundo/omnipay-pagarme

包简介

Pagarme driver for the Omnipay payment processing library

README 文档

README

Pagar.Me gateway for the Omnipay PHP payment processing library

Build Status Code Climate Test Coverage

Latest Version on Packagist Total Downloads

Software License

Omnipay is a framework agnostic, multi-gateway payment processing library for PHP 5.3+. This package implements Pagar.Me support for Omnipay.

Install

Via Composer

$ composer require descubraomundo/omnipay-pagarme

Basic Usage

The following gateways are provided by this package:

For general usage instructions, please see the main Omnipay repository.

Example with Credit Card

// Create a gateway for the Pagarme Gateway
  // (routes to GatewayFactory::create)
  $gateway = Omnipay::create('Pagarme');

  // Initialise the gateway
  $gateway->initialize(array(
      'apiKey' => 'MyApiKey',
  ));

  // Create a credit card object
  // This card can be used for testing.
  $card = new CreditCard(array(
              'firstName'    => 'Example',
              'lastName'     => 'Customer',
              //'name'         => 'Example Customer',
              'birthday'     => '1988-02-28',
              'gender'       => 'M',
              'number'       => '4242424242424242',
              'expiryMonth'  => '01',
              'expiryYear'   => '2020',
              'cvv'          => '123',
              'email'        => 'customer@example.com',
              'address1'     => 'Street name, Street number, Complementary',
              'address2'     => 'Neighborhood',
              'postcode'     => '05443100',
              'phone'        => '19 3242 8855',
              'holder_document_number' => '246.375.149-23', // CPF or CNPJ
  ));

  // Do an authorize transaction on the gateway
  $transaction = $gateway->authorize(array(
      'amount'           => '10.00',
      'soft_descriptor'  => 'test', // 13 characters allowed
      'payment_method'   => 'credit_card',
      'installments'     => 5,
      'postback_url'     => 'http://application.com/api/',
      'card'             => $card,
      // 'card_hash'      => 'card_k5sT...',
      // 'card_id'        => 254786,
      'metadata'         => array(
                                'product_id' => 'ID1111',
                                'invoice_id' => 'IV2222',
                            ),
  ));
  $response = $transaction->send();
  if ($response->isSuccessful()) {
      echo "Authorize transaction was successful!\n";
      $sale_id = $response->getTransactionReference();
      $customer_id = $response->getCustomerReference();
      $card_id = $response->getCardReference();
      echo "Transaction reference = " . $sale_id . "\n";
  }

Example with Boleto

// Create a gateway for the Pagarme Gateway
  // (routes to GatewayFactory::create) 
  // Create array with customer data
  $customer = array(
              'firstName'    => 'Example',
              'lastName'     => 'Customer',
              //'name'         => 'Example Customer',
              'email'        => 'customer@example.com',
              'address1'     => 'Street name, Street number, Complementary',
              'address2'     => 'Neighborhood',
              'postcode'     => '05443100',
              'phone'        => '19 3242 8855',
              'holder_document_number => '246.375.149-23', // CPF or CNPJ
  ));

  // Do an authorize transaction on the gateway
  $transaction = $gateway->authorize(array(
      'amount'           => '10.00',
      'soft_descriptor'  => 'test',
      'payment_method'   => 'boleto',
      'postback_url'     => 'http://application.com/api/',
      'customer'         => $customer,
      'metadata'         => array(
                                'product_id' => 'ID1111',
                                'invoice_id' => 'IV2222',
                            ),
  ));
  $response = $transaction->send();
  if ($response->isSuccessful()) {
      echo "Authorize Boleto transaction was successful!\n";
      $sale_id = $response->getTransactionReference();
      $boleto = $response->getBoleto();
      echo "Boleto Url = " . $boleto['boleto_url'];
      echo "Boleto Barcode = " . $boleto['boleto_barcode'];
      echo "Boleto Expiration Date = " . $boleto['boleto_expiration_date'];
      echo "Transaction reference = " . $sale_id . "\n";
  }

Docs

Read the full Classes Documentation here

Test Mode

Pagar.Me accounts have test-mode API keys as well as live-mode API keys. Data created with test-mode credentials will never hit the credit card networks and will never cost anyone money.

Unlike some gateways, there is no test mode endpoint separate to the live mode endpoint, the Pagar.Me API endpoint is the same for test and for live.

Support

If you are having general issues with Omnipay, we suggest posting on Stack Overflow. Be sure to add the omnipay tag so it can be easily found.

If you want to keep up to date with release anouncements, discuss ideas for the project, or ask more detailed questions, there is also a mailing list which you can subscribe to.

If you believe you have found a bug, please report it using the GitHub issue tracker, or better yet, fork the library and submit a pull request.

Change log

Please see CHANGELOG for more information what has changed recently.

License

The MIT License (MIT). Please see License File for more information.

统计信息

  • 总下载量: 44.24k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 25
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 1

GitHub 信息

  • Stars: 25
  • Watchers: 4
  • Forks: 5
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-09-16