These docs are for v1.0. Click to read the latest docs for v4.1.

Exemplos de Implementação

O que você encontrará aqui:

Nesta seção você encontrará exemplos de chamadas para as formas de pagamento disponíveis, como boleto, débito online e cartão de crédito.

Cenário 1

Objetivo: Realizar split de uma transação de Boleto

https://ws.pagseguro.uol.com.br/transactions
Content-Type: application/{xml or x-www-form-urlencoded};charset={ISO-8859-1 or UTF-8}
Accept: application/vnd.pagseguro.com.br.v3+xml
&payment.mode=default
&payment.method=boleto
&currency=BRL
&item[1].id=0001
&item[1].description=Product 1 Description
&item[1].amount=100.00
&item[1].quantity=1
&notificationURL=https://yourstore.com.br/notification
&reference=ORDER123
&sender.name=Customer Name
&sender.CPF=22111944785
&sender.areaCode=11
&sender.phone=56273440
&[email protected]
&sender.hash=c162e6131dbb9696e8b49147a9c5eacabac0cdca91458ee5177819d0a3c9d565
&shipping.address.street=Av. Brig. Faria Lima
&shipping.address.number=1384
&shipping.address.complement=5o andar
&shipping.address.district=Jardim Paulistano
&shipping.address.postalCode=01452002
&shipping.address.city=Sao Paulo
&shipping.address.state=SP
&shipping.address.country=BRA
&shipping.type=3
&shipping.cost=0.00
&primaryReceiver.publicKey:PUBCF30546BDF334CC3A59D772E3636D8D3
&receiver[1].publicKey:PUBCF30546BDF334CC3A59D772E3636D8D4
&receiver[1].split.amount=20.00
&receiver[2].publicKey=PUBCF30546BDF334CC3A59D772E3636D8D5
&receiver[2].split.amount=30.00"
<?xml version="1.0" encoding="ISO-8859-1" standalone="yes"?>
<payment>
    <mode>default</mode>
    <method>boleto</method>
    <sender>
        <name>Customer Name</name>
        <email>[email protected]</email>
        <phone>
            <areaCode>11</areaCode>
            <number>30380000</number>
        </phone>
        <documents>
            <document>
                <type>CPF</type>
                <value>11475714734</value>
            </document>
        </documents>
        <hash>c162e6131dbb9696e8b49147a9c5eacabac0cdca91458ee5177819d0a3c9d565</hash>
    </sender>
    <currency>BRL</currency>
    <notificationURL>https://yourstore.com.br/notification</notificationURL>
    <items>
        <item>
            <id>1</id>
            <description>Product 1 Description</description>
            <quantity>2</quantity>
            <amount>100.00</amount>
        </item>
    </items>
    <extraAmount>0.00</extraAmount>
    <reference>ORDER123</reference>
    <shipping>
        <address>
            <street>Av. Brigadeiro Faria Lima</street>
            <number>1384</number>
            <complement>1 andar</complement>
            <district>Jardim Paulistano</district>
            <city>Sao Paulo</city>
            <state>SP</state>
            <country>BRA</country>
            <postalCode>01452002</postalCode>
        </address>
        <type>3</type>
        <cost>0.00</cost>
    </shipping>
    <primaryReceiver>
        <publicKey>PUBCF30546BDF334CC3A59D772E3636D8D3</publicKey>
    </primaryReceiver>
    <receivers>
        <receiver>
            <publicKey>PUBCF30546BDF334CC3A59D772E3636D8D4</publicKey>
            <split>
                <amount>20.00</amount>
                <ratePercent>50.00</ratePercent>
                <feePercent>50.00</feePercent>
            </split>
        </receiver>
        <receiver>
            <publicKey>PUBCF30546BDF334CC3A59D772E3636D8D5</publicKey>
            <split>
                <amount>30.00</amount>
                <ratePercent>50.00</ratePercent>
                <feePercent>50.00</feePercent>
            </split>
        </receiver>
    </receivers>
</payment>

Response da chamada de boleto:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<transaction>
    <date>2019-08-16T17:31:06.000-03:00</date>
    <code>80273EF4-7597-42FA-8229-71600373C576</code>
    <reference>ORDER123</reference>
    <type>1</type>
    <status>3</status>
    <lastEventDate>2019-08-16T17:31:08.000-03:00</lastEventDate>
    <paymentMethod>
        <type>2</type>
        <code>202</code>
    </paymentMethod>
    <paymentLink>https://sandbox.pagseguro.uol.com.br/checkout/payment/booklet/print.jhtml?c=afcf30553e6f4038a910c8b898bb4d5cb7bbe3e4ea6eab40c1ad66032d7a65ee87b12a8dac034b79</paymentLink>
    <grossAmount>300.00</grossAmount>
    <discountAmount>0.00</discountAmount>
    <creditorFees>
        <intermediationRateAmount>0.40</intermediationRateAmount>
        <intermediationFeeAmount>14.97</intermediationFeeAmount>
    </creditorFees>
    <netAmount>284.63</netAmount>
    <extraAmount>0.00</extraAmount>
    <escrowEndDate>2019-08-30T17:31:08.000-03:00</escrowEndDate>
    <installmentCount>1</installmentCount>
    <itemCount>1</itemCount>
    <items>
        <item>
            <id>12345</id>
            <description>Product 1 Description</description>
            <quantity>3</quantity>
            <amount>100.00</amount>
        </item>
    </items>
    <sender>
        <name>Customer Name</name>
        <email>[email protected]</email>
        <phone>
            <areaCode>11</areaCode>
            <number>56273440</number>
        </phone>
        <documents>
            <document>
                <type>CPF</type>
                <value>22111944785</value>
            </document>
        </documents>
    </sender>
    <shipping>
        <address>
            <street>Av. Brig. Faria Lima</street>
            <number>1384</number>
            <complement></complement>
            <district>Jardim Paulistano</district>
            <city>Sao Paulo</city>
            <state>SP</state>
            <country>BRA</country>
            <postalCode>01452002</postalCode>
        </address>
        <type>3</type>
        <cost>0.00</cost>
    </shipping>
    <applications>
        <application>
            <id>app4281418834</id>
            <name>app4281418834</name>
            <role>INTERMEDIATION</role>
        </application>
    </applications>
    <primaryReceiver>
        <publicKey>PUBEF59C49334354C298236E2FBABC96305</publicKey>
    </primaryReceiver>
    <secondaryTransactions>
        <secondaryTransaction>
            <code>9311DCEF-1BA3-4FDF-A551-6E339731F331</code>
            <receiver>
                <publicKey>PUB2FDDBF130F1140A6AEE16BB24FBFF7B4</publicKey>
            </receiver>
        </secondaryTransaction>
    </secondaryTransactions>
</transaction>

Cenário 2

Objetivo: Split com débito online

&payment.mode=default
&payment.method=eft
&bank.name=itau
&currency=BRL
&item[1].description=Product 1 Description
&item[1].amount=100.00
&item[1].quantity=1
&notificationURL=https://yourstore.com.br/notification
&reference=ORDER123
&sender.name=Customer Name
&sender.CPF=22111944785
&sender.areaCode=11
&sender.phone=56273440
&[email protected]
&sender.hash=c162e6131dbb9696e8b49147a9c5eacabac0cdca91458ee5177819d0a3c9d565
&shipping.address.street=Av. Brig. Faria Lima
&shipping.address.number=1384
&shipping.address.complement=5o andar
&shipping.address.district=Jardim Paulistano
&shipping.address.postalCode=01452002
&shipping.address.city=Sao Paulo
&shipping.address.state=SP
&shipping.address.country=BRA
&shipping.type=3
&shipping.cost=0.00
&primaryReceiver.publicKey=PUBCF30546BDF334CC3A59D772E3636D8D3
&receiver[1].publicKey=PUBCF30546BDF334CC3A59D772E3636D8D4
&receiver[1].split.amount=20.00
&receiver[2].publicKey=PUBCF30546BDF334CC3A59D772E3636D8D5
&receiver[2].split.amount=30.00"
<?xml version="1.0" encoding="UTF-8"?>
<payment>
   <mode>default</mode>
   <method>eft</method>
   <bank>
      <name>itau</name>
   </bank>
   <sender>
      <name>Fulano Silva</name>
      <email>[email protected]</email>
      <phone>
         <areaCode>11</areaCode>
         <number>30380000</number>
      </phone>
      <documents>
         <document>
            <type>CPF</type>
            <value>11475714734</value>
         </document>
      </documents>
      <hash>{{hash_do_comprador}}</hash>
   </sender>
   <currency>BRL</currency>
   <notificationURL>https://sualoja.com.br/notificacao</notificationURL>
   <items>
      <item>
         <id>1</id>
         <description>Descricao do item a ser vendido</description>
         <quantity>1</quantity>
         <amount>1.00</amount>
      </item>
   </items>
   <extraAmount>0.00</extraAmount>
   <reference>R123456</reference>
   <shippingAddressRequired>true</shippingAddressRequired>
   <shipping>
      <address>
         <street>Av. Brigadeiro Faria Lima</street>
         <number>1384</number>
         <complement>1 andar</complement>
         <district>Jardim Paulistano</district>
         <city>Sao Paulo</city>
         <state>SP</state>
         <country>BRA</country>
         <postalCode>01452002</postalCode>
      </address>
      <type>3</type>
      <cost>0.00</cost>
   </shipping>
   <primaryReceiver>
      <publicKey>PUBCF30546BDF334CC3A59D772E3636D8D3</publicKey>
   </primaryReceiver>
   <receiver>
      <publicKey>PUBCF30546BDF334CC3A59D772E3636D8D5</publicKey>
      <split>
         <amount>30.00</amount>
         <ratePercent>50.00</ratePercent>
         <feePercent>50.00</feePercent>
      </split>
   </receiver>
</payment>

Response da chamada de débito online:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<transaction>
    <date>2019-08-16T17:44:22.000-03:00</date>
    <code>408B9661-1ACF-427D-8262-CF35A3FF0A0F</code>
    <reference>ORDER123</reference>
    <type>1</type>
    <status>3</status>
    <lastEventDate>2019-08-16T17:44:23.000-03:00</lastEventDate>
    <paymentMethod>
        <type>3</type>
        <code>302</code>
    </paymentMethod>
    <paymentLink>https://sandbox.pagseguro.uol.com.br/checkout/payment/eft/print.jhtml?c=9bc2265ece7fcd8b8dece20366fc4c2f851e30719c4182d77fc1428fcd0bba7dfd6c0934a94c013f</paymentLink>
    <grossAmount>100.00</grossAmount>
    <discountAmount>0.00</discountAmount>
    <creditorFees>
        <intermediationRateAmount>0.40</intermediationRateAmount>
        <intermediationFeeAmount>4.99</intermediationFeeAmount>
    </creditorFees>
    <netAmount>94.61</netAmount>
    <extraAmount>0.00</extraAmount>
    <escrowEndDate>2019-08-30T17:44:23.000-03:00</escrowEndDate>
    <installmentCount>1</installmentCount>
    <itemCount>1</itemCount>
    <items>
        <item>
            <id>123</id>
            <description>Product 1 Description</description>
            <quantity>1</quantity>
            <amount>100.00</amount>
        </item>
    </items>
    <sender>
        <name>Customer Name</name>
        <email>[email protected]</email>
        <phone>
            <areaCode>11</areaCode>
            <number>56273440</number>
        </phone>
        <documents>
            <document>
                <type>CPF</type>
                <value>22111944785</value>
            </document>
        </documents>
    </sender>
    <shipping>
        <address>
            <street>Av. Brig. Faria Lima</street>
            <number>1384</number>
            <complement>5o andar</complement>
            <district>Jardim Paulistano</district>
            <city>Sao Paulo</city>
            <state>SP</state>
            <country>BRA</country>
            <postalCode>01452002</postalCode>
        </address>
        <type>3</type>
        <cost>0.00</cost>
    </shipping>
    <applications>
        <application>
            <id>app4281418834</id>
            <name>app4281418834</name>
            <role>INTERMEDIATION</role>
        </application>
    </applications>
    <primaryReceiver>
        <publicKey>PUBCF30546BDF334CC3A59D772E3636D8D3</publicKey>
    </primaryReceiver>
</transaction>

Cenário 3

Objetivo: Split com cartão de crédito

&payment.mode=default
&payment.method=creditCard
&currency=BRL
&item[1].description=Product 1 Description
&item[1].amount=100.00
&item[1].quantity=1
&notificationURL=https://yourstore.com.br/notification
&reference=ORDER123
&sender.name=Customer Name
&sender.CPF=22111944785
&sender.areaCode=11
&sender.phone=56273440
&[email protected]
&sender.hash=c162e6131dbb9696e8b49147a9c5eacabac0cdca91458ee5177819d0a3c9d565
&shipping.address.street=Av. Brig. Faria Lima
&shipping.address.number=1384
&shipping.address.complement=5o andar
&shipping.address.district=Jardim Paulistano
&shipping.address.postalCode=01452002
&shipping.address.city=Sao Paulo
&shipping.address.state=SP
&shipping.address.country=BRA
&shipping.type=3
&shipping.cost=0.00
&installment.quantity=2
&installment.value=50.00
&installment.noInterestInstallmentQuantity=2
&creditCard.token=4as56d4a56d456as456dsa
&creditCard.holder.name=Customer Name
&creditCard.holder.CPF=22111944785
&creditCard.holder.birthDate=27/10/1987
&creditCard.holder.areaCode=11
&creditCard.holder.phone=56273440
&billingAddress.street=Av. Brig. Faria Lima
&billingAddress.number=1384
&billingAddress.complement=5o andar
&billingAddress.district=Jardim Paulistano
&billingAddress.postalCode=01452002
&billingAddress.city=Sao Paulo
&billingAddress.state=SP
&billingAddress.country=BRA
&primaryReceiver.publicKey=PUBCF30546BDF334CC3A59D772E3636D8D3
&receiver[1].publicKey=PUBCF30546BDF334CC3A59D772E3636D8D5
&receiver[1].split.amount=30.00"
<?xml version="1.0" encoding="ISO-8859-1" standalone="yes"?>
<payment>
	<mode>default</mode>
	<method>creditCard</method>
	<sender>
		<name>Customer Name</name>
		<email>[email protected]</email>
		<phone>
			<areaCode>11</areaCode>
			<number>30380000</number>
		</phone>
		<documents>
			<document>
				<type>CPF</type>
				<value>11475714734</value>
			</document>
		</documents>
		<hash>c162e6131dbb9696e8b49147a9c5eacabac0cdca91458ee5177819d0a3c9d565</hash>
	</sender>
	<currency>BRL</currency>
	<notificationURL>https://yourstore.com.br/notification</notificationURL>
	<items>
		<item>
			<id>1</id>
			<description>Product 1 Description</description>
			<quantity>2</quantity>
			<amount>100.00</amount>
		</item>
	</items>
	<extraAmount>0.00</extraAmount>
	<reference>ORDER123</reference>
	<shipping>
		<address>
			<street>Av. Brigadeiro Faria Lima</street>
			<number>1384</number>
			<complement>1 andar</complement>
			<district>Jardim Paulistano</district>
			<city>Sao Paulo</city>
			<state>SP</state>
			<country>BRA</country>
			<postalCode>01452002</postalCode>
		</address>
		<type>3</type>
		<cost>0.00</cost>
	</shipping>
	<creditCard>
		<token>4a56sd456a4d54asd65as4d56a4sd564</token>
		<installment>
			<quantity>2</quantity>
			<value>100.00</value>
		</installment>
		<holder>
			<name>Credit Card Holder Name</name>
			<documents>
				<document>
					<type>CPF</type>
					<value>00722333665</value>
				</document>
			</documents>
			<birthDate>20/10/1980</birthDate>
			<phone>
				<areaCode>11</areaCode>
				<number>999991111</number>
			</phone>
		</holder>
		<billingAddress>
			<street>Av. Brigadeiro Faria Lima</street>
			<number>1384</number>
			<complement>1 andar</complement>
			<district>Jardim Paulistano</district>
			<city>Sao Paulo</city>
			<state>SP</state>
			<country>BRA</country>
			<postalCode>01452002</postalCode>
		</billingAddress>
	</creditCard>
	<primaryReceiver>
		<publicKey>PUBCF30546BDF334CC3A59D772E3636D8D3</publicKey>
	</primaryReceiver>
	<receivers>
		<receiver>
			<publicKey>PUBCF30546BDF334CC3A59D772E3636D8D4</publicKey>
			<split>
				<amount>20.00</amount>
			</split>
		</receiver>
	</receivers>
</payment>

Response da chamada de cartão de crédito:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<transaction>
    <date>2019-08-16T18:02:42.000-03:00</date>
    <code>6ED5D7B1-6F59-4E1F-AA1E-198F13817E98</code>
    <reference>ORDER123</reference>
    <type>1</type>
    <status>3</status>
    <lastEventDate>2019-08-16T18:02:43.000-03:00</lastEventDate>
    <paymentMethod>
        <type>1</type>
        <code>101</code>
    </paymentMethod>
    <grossAmount>100.00</grossAmount>
    <discountAmount>0.00</discountAmount>
    <creditorFees>
        <installmentFeeAmount>3.61</installmentFeeAmount>
        <intermediationRateAmount>0.40</intermediationRateAmount>
        <intermediationFeeAmount>4.99</intermediationFeeAmount>
    </creditorFees>
    <netAmount>91.00</netAmount>
    <extraAmount>0.00</extraAmount>
    <escrowEndDate>2019-08-30T18:02:43.000-03:00</escrowEndDate>
    <installmentCount>2</installmentCount>
    <itemCount>1</itemCount>
    <items>
        <item>
            <id>123</id>
            <description>Product 1 Description</description>
            <quantity>1</quantity>
            <amount>100.00</amount>
        </item>
    </items>
    <sender>
        <name>Customer Name</name>
        <email>[email protected]</email>
        <phone>
            <areaCode>11</areaCode>
            <number>56273440</number>
        </phone>
        <documents>
            <document>
                <type>CPF</type>
                <value>22111944785</value>
            </document>
        </documents>
    </sender>
    <shipping>
        <address>
            <street>Av. Brig. Faria Lima</street>
            <number>1384</number>
            <complement>5o andar</complement>
            <district>Jardim Paulistano</district>
            <city>Sao Paulo</city>
            <state>SP</state>
            <country>BRA</country>
            <postalCode>01452002</postalCode>
        </address>
        <type>3</type>
        <cost>0.00</cost>
    </shipping>
    <applications>
        <application>
            <id>app4281418834</id>
            <name>app4281418834</name>
            <role>INTERMEDIATION</role>
        </application>
    </applications>
    <gatewaySystem>
        <type>cielo</type>
        <rawCode xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
        <rawMessage xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
        <normalizedCode xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
        <normalizedMessage xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
        <authorizationCode>0</authorizationCode>
        <nsu>0</nsu>
        <tid>0</tid>
        <establishmentCode>1056784170</establishmentCode>
        <acquirerName>CIELO</acquirerName>
    </gatewaySystem>
    <primaryReceiver>
        <publicKey>PUBCF30546BDF334CC3A59D772E3636D8D3</publicKey>
    </primaryReceiver>
    <secondaryTransactions>
        <secondaryTransaction>
            <code>96A42D4A-93E8-49E7-A0E9-C09EACC90624</code>
            <receiver>
                <publicKey>PUBCF30546BDF334CC3A59D772E3636D8D5</publicKey>
            </receiver>
        </secondaryTransaction>
    </secondaryTransactions>
</transaction>

Estorno

curl -X POST \
  'https://ws.pagseguro.uol.com.br/v2/transactions/[email protected]&token=token' \
  -H 'Content-Type: application/x-www-form-urlencoded' \
  -d transactionCode=BB32071D-6665-43F4-9860-EBDD69562D74

O response da chamada de estorno

<?xml version="1.0" encoding="ISO-8859-1" standalone="yes"?>
<result>OK</result>

© 1996- Todos os direitos reservados.

PAGSEGURO INTERNET INSTITUIÇÃO DE PAGAMENTO S/A - CNPJ/MF 08.561.701/0001-01

Av. Brigadeiro Faria Lima, 1.384, São Paulo - SP - CEP 01451-001