PagSeguro
PagSeguro integration
Description
Integration with PagSeguro API.
Use PagSeguro to receive money and sell products to your users.
Requires string-replace utility.
XSLT
View Raw
<?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:import href="../utilities/string-replace.xsl"/> <xsl:output method="xml" encoding="UTF-8" indent="yes" omit-xml-declaration="yes"/> <!-- TO USE, CALL TEMPLATE LIKE SO... <xsl:call-template name="pagseguro"> <xsl:with-param name="email_cobranca" select="'seuemail@dominio.com'"/> <xsl:with-param name="item_id" select="ID_UNICO"/> <xsl:with-param name="item_descr" select="Descrição do produto"/> <xsl:with-param name="item_valor" select="VALOR_DO_PRODUTO"/> </xsl:call-template> --> <xsl:template name="pagseguro"> <xsl:param name="email_cobranca"/> <xsl:param name="item_id"/> <xsl:param name="item_descr"/> <xsl:param name="tipo" select="'CBR'"/> <xsl:param name="moeda" select="'BRL'"/> <xsl:param name="item_quant" select="'1'"/> <xsl:param name="peso" select="'0'"/> <xsl:param name="frete" select="'0'"/> <xsl:param name="item_valor" /> <xsl:param name="valor"> <xsl:call-template name="string-replace"> <xsl:with-param name="haystack"> <xsl:call-template name="string-replace"> <xsl:with-param name="haystack"> <xsl:call-template name="string-replace"> <xsl:with-param name="haystack"> <xsl:call-template name="string-replace"> <xsl:with-param name="haystack" select="$item_valor" /> <xsl:with-param name="search" select="' '" /> <xsl:with-param name="replace" select="''" /> </xsl:call-template> </xsl:with-param> <xsl:with-param name="search" select="'R$'" /> <xsl:with-param name="replace" select="''" /> </xsl:call-template> </xsl:with-param> <xsl:with-param name="search" select="'.'" /> <xsl:with-param name="replace" select="''" /> </xsl:call-template> </xsl:with-param> <xsl:with-param name="search" select="','" /> <xsl:with-param name="replace" select="''" /> </xsl:call-template> </xsl:param> <xsl:variable name="select_count" select="'0'" /> <div class="pagseguro-form"> <!-- INICIO FORMULARIO BOTAO PAGSEGURO --> <form target="pagseguro" class="pagseguro" id="pagseguro_{$item_id}" method="post" action="https://pagseguro.uol.com.br/checkout/checkout.jhtml"> <input type="hidden" name="email_cobranca" value="{$email_cobranca}" /> <input type="hidden" name="tipo" value="{$tipo}" /> <input type="hidden" name="moeda" value="{$moeda}" /> <input type="hidden" name="item_id" value="{$item_id}" /> <input type="hidden" name="value_item_quant" class="value_item_quant" value="{$item_quant}" /> <select name="item_quant" class="item_quant"> <option value="1">Quantidade</option> </select> <input type="hidden" name="item_valor" value="{$valor}" /> <input type="hidden" name="frete" value="{$frete}" /> <input type="hidden" name="peso" value="{$peso}" /> <input type="hidden" name="item_descr" value="{$item_descr}" maxlength="90" /> <input type="hidden" name="encoding" value="utf-8" /> </form> <!-- FINAL FORMULARIO BOTAO PAGSEGURO --> </div> </xsl:template> </xsl:stylesheet>