GithubHelp home page GithubHelp logo

luannsr12 / picpay-php Goto Github PK

View Code? Open in Web Editor NEW
33.0 8.0 15.0 35 KB

Simples integração com API do PicPay utilizando PHP

PHP 100.00%
picpay-php picpay-gateway link-picpay pedido gateway-api picpay

picpay-php's Introduction

PicPay PHP Simple

Efetuando Pagamento (payment.php)

Adicione seu x-picpay-token e x-seller-token | Clique aqui para pegar as credenciais

<?php
 require_once 'src/paymentPicPay.php';
 $picpay = new PicPay("x-picpay-token", "x-seller-token");
 
  //Dados do produto
 
   $prod['ref']    = uniqid();			
   $prod['nome']  = "Trono de ferro";
   $prod['valor'] = 100.00;
   
   // Dados do cliente
   $cli['nome']      = "Daenerys";
   $cli['sobreNome'] = "Targaryen";
   $cli['cpf']       = "000.000.000-00";
   $cli['email']     = "[email protected]";
   $cli['telefone']  = "11999999999";
   
   $produto = (object)$prod;
   $cliente = (object)$cli;
   
   $payment = $picpay->requestPayment($produto,$cliente);
  
	if(isset($payment->message)):
		echo $payment->message;
	else:
 	   $link   = $payment->paymentUrl;
	   $qrCode = $payment->qrcode->base64;
	 
	   echo '<a href="'.$link.'">Pagar com PicPay</a>';
	   echo '<br />';
	   echo '<img src="'.$qrCode.'" />';
	   
    endif;
 ?>

Recebendo Notificação do PicPay (notification.php)

<?php
  require_once 'src/paymentPicPay.php'; 
  $picpay = new PicPay("x-picpay-token", "x-seller-token");
  
  // função que verifica a requisição do PicPay
  $notification = $picpay->notificationPayment();
  
	  if($notification){
		  
		  $status	   = $notification->status;
		  $authorizationId = $notification->authorizationId;
		  $referenceId     = $notification->referenceId;
		  
		  
		  /* -- Tratar dados -- */
	  }
 ?>

A função notificationPayment retorna com os seguintes dados:

  • referenceId (Referencia do pedido no seu sistema)
  • status (Confira as respostas de status na documentação do picpay)
  • authorizationId (Usado para estornar o pedido)

Documentação PicPay API: https://ecommerce.picpay.com/doc/

picpay-php's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

picpay-php's Issues

Como processar múltiplos produtos no carrinho?

Utilizando a API não diz sobre múltiplos produtos no carrinho, apenas diz sobre um Identificador único do seu pedido.

Como processar mais de um produto, gerando um valor total, como saber quais produtos foram pedidos?

teste de notificacao

Bom dia, voce conhece alguma forma de se fazer um teste de notificacao na picpay?

Erro de objetos

Versão do PHP: v5.6.0

Notice: Trying to get property of non-object in D:\wwwroot\picpay-php-master\payment.php on line 41
Notice: Trying to get property of non-object in D:\wwwroot\picpay-php-master\payment.php on line 42
Notice: Trying to get property of non-object in D:\wwwroot\picpay-php-master\payment.php on line 42
Pagar com PicPay

As linhas com erro: payment.php

$link = $payment->paymentUrl; $qrCode = $payment->qrcode->base64;

Obrigado desde já.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.