installment value Invalid Pagseguro

Asked

Viewed 3,572 times

3

Opa, I’m using the transparent checkout of Pagseguro, but, if I report an amount of installments greater than 1, in a sale with credit card, I get the error: installment value invalid value:

My upload xml:

<?xml version="1.0" encoding="ISO-8859-1" standalone="yes"?>
        <payment>
            <mode>default</mode>
            <method>creditCard</method>
            <sender>
                <name>Leonidas Wander</name>
                <email>*************@sandbox.pagseguro.com.br</email>
                <phone>
                    <areaCode>99</areaCode>
                    <number>999999999</number>
                </phone>
                <documents>
                    <document>
                        <type>CPF</type>
                        <value>99999999999</value>
                    </document>
                </documents>
                <hash>**************************************</hash>
            </sender>
            <currency>BRL</currency>
            <notificationURL>https://www.site.com.br/notificacao</notificationURL>
            <items>
                <item>
                    <id>0001</id>
                    <description>Compra Pacote </description>
                    <quantity>1</quantity>
                    <amount>200.00</amount>
                </item>
            </items>
            <extraAmount>0.00</extraAmount>
            <reference>P2EV2</reference>
            <shipping>
                <address>
                    <street>Rua Santa Maria</street>
                    <number>11</number>
                    <complement></complement>
                    <district>Petrópolis</district>
                    <city>Maceió</city>
                    <state>AL</state>
                    <country>ATA</country>
                    <postalCode>99999999</postalCode>
                </address>
                <type>3</type>
                <cost>0.00</cost>
            </shipping>
            <creditCard>
                <token>********************</token>
                    <installment>
                        <quantity>2</quantity>
                        <value>100.00</value>
                    </installment>
                    <holder>
                        <name>Leonidas Waaa</name>
                        <documents>
                            <document>
                                <type>CPF</type>
                                <value>99999999999</value>
                            </document>
                        </documents>
                        <birthDate>01/01/1900</birthDate>
                        <phone>
                            <areaCode>99</areaCode>
                            <number>999999999</number>
                        </phone>
                    </holder>
                    <billingAddress>
                        <street>Rua Santa Maria</street>
                        <number>11</number>
                        <complement></complement>
                        <district>Petrópolis</district>
                        <city>Maceió</city>
                        <state>AL</state>
                        <country>ATA</country>
                        <postalCode>99999999</postalCode>
                    </billingAddress>
            </creditCard>
        </payment>

These parcel values are returned by Pagseguro itself. When informing only one parcel, that is, the total value, the transaction is performed.

  • Are you sending this XML exactly or just used as an example? Apparently you have a problem with decimals or rounding when you divide the value into plots.

  • Oops buddy, the xml data is fictitious, but, the <installment>and the <item><amount>are the same sent.

2 answers

4


According to the documentation of Pagseguro for installments without accretion, the XML template for installment shall follow the following format.

You must use endpoint https://ws.sandbox.pagseguro.uol.com.br/v2/checkout/

<?xml version="1.0" encoding="ISO-8859-1" standalone="yes"?>
<checkout>
<currency>BRL</currency>
<items>
    <item>
        <id>0001</id>
        <description>Notebook Prata</description>
        <amount>24300.00</amount>
        <quantity>1</quantity>
        <weight>1000</weight>
    </item>
</items>
<reference>REF1234</reference>
<sender>
    <name>José Comprador</name>
    <email>[email protected]</email>
    <phone>
        <areaCode>11</areaCode>
        <number>56273440</number>
    </phone>
</sender>
<shipping>
    <type>1</type>
    <address>
        <street>Av. Brig. Faria Lima</street>
        <number>1384</number>
        <complement>5o andar</complement>
        <district>Jardim Paulistano</district>
        <postalCode>01452002</postalCode>
        <city>Sao Paulo</city>
        <state>SP</state>
        <country>BRA</country>
    </address>
</shipping>
<paymentMethodConfigs>
    <paymentMethodConfig>
        <paymentMethod>
            <group>CREDIT_CARD</group>
        </paymentMethod>
        <configs>
            <config>
                <key>MAX_INSTALLMENTS_NO_INTEREST</key>
                <value>6</value>
            </config>
        </configs>
    </paymentMethodConfig>
</paymentMethodConfigs>

Isolating the part that matters.

<?xml version="1.0" encoding="ISO-8859-1" standalone="yes"?>
<checkout>
    (...)
    <paymentMethodConfigs>
        <paymentMethodConfig>
            <paymentMethod>
                <group>CREDIT_CARD</group>
            </paymentMethod>
            <configs>
                <config>
                    <key>MAX_INSTALLMENTS_NO_INTEREST</key>
                    <value>6</value>
                </config>
            </configs>
        </paymentMethodConfig>
    </paymentMethodConfigs>
</checkout>

There is also a way to parcel by card through the Transparent Payment

  • Opa buddy, just there in the documentation of Transparent has nothing of reference on the paymentMethodConfigs. The funny thing is that the amount of installments and the value of each installment is informed by the paysecure itself in a previous function to that.

  • Brother, I added the line <noInterestInstallmentQuantity>I got back, the transaction was carried out

2

Solved

Correct XML for transparent Pagseguro checkout

<?xml version="1.0" encoding="ISO-8859-1" standalone="yes"?>
    <payment>
        <mode>default</mode>
        <method>creditCard</method>
        <sender>
            <name>Leonidas Wander</name>
            <email>*************@sandbox.pagseguro.com.br</email>
            <phone>
                <areaCode>99</areaCode>
                <number>999999999</number>
            </phone>
            <documents>
                <document>
                    <type>CPF</type>
                    <value>99999999999</value>
                </document>
            </documents>
            <hash>**************************************</hash>
        </sender>
        <currency>BRL</currency>
        <notificationURL>https://www.site.com.br/notificacao</notificationURL>
        <items>
            <item>
                <id>0001</id>
                <description>Compra Pacote </description>
                <quantity>1</quantity>
                <amount>200.00</amount>
            </item>
        </items>
        <extraAmount>0.00</extraAmount>
        <reference>P2EV2</reference>
        <shipping>
            <address>
                <street>Rua Santa Maria</street>
                <number>11</number>
                <complement></complement>
                <district>Petrópolis</district>
                <city>Maceió</city>
                <state>AL</state>
                <country>ATA</country>
                <postalCode>99999999</postalCode>
            </address>
            <type>3</type>
            <cost>0.00</cost>
        </shipping>
        <creditCard>
            <token>********************</token>
                <installment>
                    <quantity>2</quantity>
                    <value>100.00</value>
                    <noInterestInstallmentQuantity>2</noInterestInstallmentQuantity>
                </installment>
                <holder>
                    <name>Leonidas Waaa</name>
                    <documents>
                        <document>
                            <type>CPF</type>
                            <value>99999999999</value>
                        </document>
                    </documents>
                    <birthDate>01/01/1900</birthDate>
                    <phone>
                        <areaCode>99</areaCode>
                        <number>999999999</number>
                    </phone>
                </holder>
                <billingAddress>
                    <street>Rua Santa Maria</street>
                    <number>11</number>
                    <complement></complement>
                    <district>Petrópolis</district>
                    <city>Maceió</city>
                    <state>AL</state>
                    <country>ATA</country>
                    <postalCode>99999999</postalCode>
                </billingAddress>
        </creditCard>
    </payment>

The value that is in noInterestInstallmentQuantityshould be the same that was placed in the maxInstallmentNoInterest in javascript.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.