Giter VIP home page Giter VIP logo

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

Contributors

luannsr12 avatar

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.