randler/ipag-php 问题修复 & 功能扩展

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

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

randler/ipag-php

Composer 安装命令:

composer require randler/ipag-php

包简介

IPag PHP Library

README 文档

README

IPag

Gateway IPag PHP

Biblioteca desenvolvida para facilitar a comunicação com o gateway de pagamento IPag.

React Native is released under the MIT license. Versão Downloads

Introdução

Essa SDK foi construída com o intuito de tornar flexível as chamadas dos metodos de pagamento, de forma que todos possam utilizar todas as features, de todas as versões de API.

Você pode acessar a documentação oficial da API acessando esse link.

Índice





Instalação

Instale a biblioteca utilizando o comando

composer require randler/ipag-php

Requisição de Tokenização

Nesta seção será explicado como realizar requisições para cartão pelo IPag com essa biblioteca.

Token de Cartão

<?php
  $appId = "***";
  $appKey = "D5***DA";
  $sandbox = true;
  
  $client = new Client($appId, $appKey, $sandbox);

  $cardInfo = new CustomerCard();

  $cardInfo->setCardholderName("JOSE SILVA")
      ->setCardNumber("4111111111111111")
      ->setExpirationMonth("01")
      ->setExpirationYear("2029")
      ->setCvv("123")
      ->setCpfCnpj("80630047014")
      ->setMobilePhone("11999999999")
      ->setBirthdate("1989-03-28")
      ->setStreet("Rua dos Bobos")
      ->setNumber("0")
      ->setDistrict("Centro")
      ->setZipcode("12345678")
      ->setCity("São Paulo")
      ->setState("SP");

  $data_card = $cardInfo->getCardData();
  //fwrite(STDERR, print_r($data_card));
  
  $response = $client->card()->create($data_card);
?>


Requisição de transação

Para fazer a requisição de transação.


Criar Transação

  $appId = "***";
  $appKey = "D5***DA";
  $sandbox = true;

  $client = new Client($this->appId, $this->appKey, $this->sandbox);

  $payment = new PaymentData();
  $payment->setAmount(10.35)
          ->setType("card") // card, boleto, pix
          ->setInstallments(1)
          ->setCapture(true)
          ->setCard_token("aea788f4-34cd-4f3d-8003-9c361fc4da99")
          ->setName("JOSE SILVA")
          ->setCpf_cnpj("80630047014");

  $payment = $client
      ->payment()
      ->create($payment->getPaymentCardTokenData());

Detalhe de uma transação

  
  $appId = "***";
  $appKey = "D5***DA";
  $sandbox = true;
  $id = "020001409102281247420000012620420000000000";

  $client = new Client($this->appId, $this->appKey, $this->sandbox);

  $detail = $client
    ->payment()
    ->details($id);

Cancelar uma transação

  
  $appId = "***";
  $appKey = "D5***DA";
  $sandbox = true;
  $id = "020001409102281247420000012620420000000000";

  $client = new Client($this->appId, $this->appKey, $this->sandbox);

  $detail = $client
    ->payment()
    ->cancel($id);

Capturar uma transação

  
  $appId = "***";
  $appKey = "D5***DA";
  $sandbox = true;
  $id = "020001409102281247420000012620420000000000";

  $client = new Client($this->appId, $this->appKey, $this->sandbox);

  $detail = $client
    ->payment()
    ->capture($id);


Requisição de Seller

Para fazer a requisição de transação.


Store Seller

  $appId = "***";
  $appKey = "D5***DA";
  $sandbox = true;

  $client = new Client($this->appId, $this->appKey, $this->sandbox);

  $address = new Address();
  $address->setStreet('Rua')
      ->setNumber('1A')
      ->setDistrict('Bairro')
      ->setComplement('Apto')
      ->setCity('Belo Horizonte')
      ->setState('BH')
      ->setZipcode('30190-050');
  
  $owner = new Owner();
  $owner->setName('João')
      ->setEmail('Joao@mail.com')
      ->setPhone('(77) 98845-5689')
      ->setCPF('012.345.678-90')
      ->setBirthdate('01/01/2001');

  $bank = new Bank();
  $bank->setCode('290')
      ->setAgency('0001')
      ->setAccount('100500')
      ->setType('checkings')
      ->setExternalId('joao@mail.com');

  $address = $address->getAddressData();
  $owner = $owner->getOwnerData();
  $bank = $bank->getBankData();

  $dataSeller = new SellerData();
  $dataSeller->setLogin('username')
      ->setPassword('senha')
      ->setName('joao')
      ->setCpfCnpj('012.345.678-90')
      ->setEmail('joao@mail.com')
      ->setPhone('(77) 98845-5689')
      ->setDescription("description seller")
      ->addAddress($address)
      ->addOwner($owner)
      ->addBank($bank);

  $dataSeller = $dataSeller->getSellersStoreData();
  $seller = $client
      ->seller()
      ->create($dataSeller);

Update Seller

  $appId = "***";
  $appKey = "D5***DA";
  $sandbox = true;

  $client = new Client($this->appId, $this->appKey, $this->sandbox);

  $address = new Address();
  $address->setStreet('Rua')
      ->setNumber('1A')
      ->setDistrict('Bairro')
      ->setComplement('Apto')
      ->setCity('Belo Horizonte')
      ->setState('BH')
      ->setZipcode('30190-050');
  
  $owner = new Owner();
  $owner->setName('João')
      ->setEmail('Joao@mail.com')
      ->setPhone('(77) 98845-5689')
      ->setCPF('012.345.678-90')
      ->setBirthdate('01/01/2001');

  $bank = new Bank();
  $bank->setCode('290')
      ->setAgency('0001')
      ->setAccount('100500')
      ->setType('checkings')
      ->setExternalId('joao@mail.com');

  $address = $address->getAddressData();
  $owner = $owner->getOwnerData();
  $bank = $bank->getBankData();

  $dataSeller = new SellerData();
  $dataSeller->setId('123456789')
      ->setLogin('username')
      ->setPassword('senha')
      ->setName('joao')
      ->setCpfCnpj('012.345.678-90')
      ->setEmail('joao@mail.com')
      ->setPhone('(77) 98845-5689')
      ->setDescription("description seller")
      ->addAddress($address)
      ->addOwner($owner)
      ->addBank($bank);

  $dataSeller = $dataSeller->getSellersUpdateData();
  $seller = $client
      ->seller()
      ->update($dataSeller);

List Sellers

  $appId = "***";
  $appKey = "D5***DA";
  $sandbox = true;

  $client = new Client($this->appId, $this->appKey, $this->sandbox);

  $seller = $client
      ->seller()
      ->list();

Query Sellers

  $appId = "***";
  $appKey = "D5***DA";
  $sandbox = true;

  $client = new Client($this->appId, $this->appKey, $this->sandbox);

  $payload = array(
    'id' => '123456789'
    'cpf_cnpj' => '23589642596'
    'email' => 'joao@mail.com'
  );
  $seller = $client
    ->seller()
    ->query($payload);


randler/ipag-php 适用场景与选型建议

randler/ipag-php 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 952 次下载、GitHub Stars 达 1, 最近一次更新时间为 2022 年 06 月 21 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「api」 「gateway」 「ipag」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 randler/ipag-php 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 randler/ipag-php 我们能提供哪些服务?
定制开发 / 二次开发

基于 randler/ipag-php 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

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

GitHub 信息

  • Stars: 1
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2022-06-21