...
Code Block |
---|
curl -d "secret=input_your_secret&pbtoken=input_your_token&order=1234567890&payment_method=D&product_name=Product+Test+(1+license)&customer_name=José+da+Silva&customer_taxid=91051605962&customer_email=josedasilva@myemail.com.br&customer_phone=11+3328.9999&address_street=Av.Paulista,+100&address_zip=01311100&address_city=São+Paulo&address_state=SP&amount_brl=39.50&cc_installments=1&cc_brand=V&cc_holder=joao+da+silva&cc_number=4984123412341234&cc_expiration=12/29&cc_cvv=123&soft_descriptor=TEST&auth3ds_type=success&auth3ds_cavv=kCMfNfPIZcdJYgDHzEW+fZhh4wsU&auth3ds_version=2&auth3ds_eci=02&auth3ds_reference_id=fe5969fc-2c4b-4b7c-862f-7a5ac9edfd04&auth3ds_xid=kCMfNfPIZcdJYgDHzEW+fZhh4wsU" -X POST "https://sandbox.pagbrasil.com/api/order/add" |
Response:
Code Block | ||
---|---|---|
| ||
<?xml version="1.0" encoding="ISO-8859-1"?>
<request>
<order>1234567890</order>
<payment_method>D</payment_method>
<submission_date>10/12/2010</submission_date>
<order_status>PC</order_status>
<authorization_code>493578680</authorization_code>
<payment_date>10/12/2010</payment_date>
<product_name>Product Test (1 license)</product_name>
<customer_name>José da Silva</customer_name>
<customer_taxid>91051605962</customer_taxid>
<customer_email>josedasilva@myemail.com.br</customer_email>
<customer_phone>11 3328.9999</customer_phone>
<address_street>Av.Paulista, 100</address_street>
<address_zip>01311100</address_zip>
<address_city>São Paulo</address_city>
<address_state>SP</address_state>
<amount_brl>39.50</amount_brl>
<amount_paid>39.50</amount_paid>
<cc_installments>1</cc_installments>
<cc_brand>V</cc_brand>
<cc_holder>joao da silva</cc_holder>
<cc_number>498412******1234</cc_number>
<cc_expiration>12/29</cc_expiration>
<soft_descriptor>TEST</soft_descriptor>
<signature>9c1fe6cac5521f0b09413ae61e6d1b31</signature>
</request> |
...
8.2. PHP
Request:
Code Block | ||
---|---|---|
| ||
<?php $servidor = "https://sandbox.pagbrasil.com/api/order/add"; $content = http_build_query( array( "secret" => 'input_your_secret', "pbtoken" => 'input_your_token', "order" => '1234567890', "payment_method" => 'D', "product_name" => 'Product Test (1 license)', "customer_name" => 'José da Silva', "customer_taxid" => '91051605962', "customer_email" => 'josedasilva@myemail.com.br', "customer_phone" => '11 3328.9999', "address_street" => 'Av.Paulista, 100', "address_zip" => '01311100', "address_city" => 'São Paulo', "address_state" => 'SP', "amount_brl" => '39.50', "cc_installments" => '1', "cc_brand" => 'V', "cc_holder" => 'joao da silva', "cc_number" => '4984123412341234', "cc_expiration" => '12/29', "cc_cvv" => '123', "soft_descriptor" => 'TEST' "auth3ds_type" => 'success' "auth3ds_cavv" => 'kCMfNfPIZcdJYgDHzEW+fZhh4wsU' "auth3ds_version" => '2' "auth3ds_eci" => '02' "auth3ds_reference_id" => 'fe5969fc-2c4b-4b7c-862f-7a5ac9edfd04' "auth3ds_xid" => 'kCMfNfPIZcdJYgDHzEW+fZhh4wsU' ) ); $context = stream_context_create(array( 'http' => array( 'method' => 'POST', 'header' => "Connection: close\r\n". "Content-type: application/x-www-form-urlencoded\r\n". "Content-Length: ".strlen($content)."\r\n", 'content' => $content ) )); $contents = file_get_contents($servidor, null, $context); ?> |
Response:
Code Block | |
---|---|
language | xml|
<?xml version="1.0" encoding="ISO-8859-1"?>
<request>
<order>1234567890</order>
<payment_method>D</payment_method>
<submission_date>10/12/2010</submission_date>
<order_status>PC</order_status>
<authorization_code>493578680</authorization_code>
<payment_date>10/12/2010</payment_date>
<product_name>Product Test (1 license)</product_name>
<customer_name>José da Silva</customer_name>
<customer_taxid>91051605962</customer_taxid>
<customer_email>josedasilva@myemail.com.br</customer_email>
<customer_phone>11 3328.9999</customer_phone>
<address_street>Av.Paulista, 100</address_street>
<address_zip>01311100</address_zip>
<address_city>São Paulo</address_city>
<address_state>SP</address_state>
<amount_brl>39.50</amount_brl>
<amount_paid>39.50</amount_paid>
<cc_installments>1</cc_installments>
<cc_brand>V</cc_brand>
<cc_holder>joao da silva</cc_holder>
<cc_number>498412******1234</cc_number>
<cc_expiration>12/29</cc_expiration>
<soft_descriptor>TEST</soft_descriptor>
<signature>9c1fe6cac5521f0b09413ae61e6d1b31</signature>
</request> |
...
8.3. .NET
Request:
Code Block |
---|
using System.Net; using System.Collections.Specialized; using (var client = new WebClient()) { var values = new NameValueCollection(); values["secret"] = "input_your_secret"; values["pbtoken"] = "input_your_token"; values["order"] = "1234567890"; values["payment_method"] = "D"; values["product_name"] = "Product Test (1 license)"; values["customer_name"] = "José da Silva"; values["customer_taxid"] = "91051605962"; values["customer_email"] = "josedasilva@myemail.com.br"; values["customer_phone"] = "11 3328.9999"; values["address_street"] = "Av.Paulista, 100"; values["address_zip"] = "01311100"; values["address_city"] = "São Paulo"; values["address_state"] = "SP"; values["amount_brl"] = "39.50"; values["cc_installments"] = "1"; values["cc_brand"] = "V"; values["cc_holder"] = "joao da silva"; values["cc_number"] = "4984123412341234"; values["cc_expiration"] = "12/29"; values["cc_cvv"] = "123"; values["soft_descriptor"] = "TEST"; values["auth3ds_type"] = "success"; values["auth3ds_cavv"] = "kCMfNfPIZcdJYgDHzEW+fZhh4wsU"; values["auth3ds_version"] = "2"; values["auth3ds_eci"] = "02"; values["auth3ds_reference_id"] = "fe5969fc-2c4b-4b7c-862f-7a5ac9edfd04"; values["auth3ds_xid"] = "kCMfNfPIZcdJYgDHzEW+fZhh4wsU"; var response = client.UploadValues("https://sandbox.pagbrasil.com/api/order/add", values); var responseString = Encoding.Default.GetString(response); } |
Response:
Code Block | ||
---|---|---|
| ||
<?xml version="1.0" encoding="ISO-8859-1"?>
<request>
<order>1234567890</order>
<payment_method>D</payment_method>
<submission_date>10/12/2010</submission_date>
<order_status>PC</order_status>
<authorization_code>493578680</authorization_code>
<payment_date>10/12/2010</payment_date>
<product_name>Product Test (1 license)</product_name>
<customer_name>José da Silva</customer_name>
<customer_taxid>91051605962</customer_taxid>
<customer_email>josedasilva@myemail.com.br</customer_email>
<customer_phone>11 3328.9999</customer_phone>
<address_street>Av.Paulista, 100</address_street>
<address_zip>01311100</address_zip>
<address_city>São Paulo</address_city>
<address_state>SP</address_state>
<amount_brl>39.50</amount_brl>
<amount_paid>39.50</amount_paid>
<cc_installments>1</cc_installments>
<cc_brand>V</cc_brand>
<cc_holder>joao da silva</cc_holder>
<cc_number>498412******1234</cc_number>
<cc_expiration>12/29</cc_expiration>
<soft_descriptor>TEST</soft_descriptor>
<signature>9c1fe6cac5521f0b09413ae61e6d1b31</signature>
</request> |
...
8.4. Node.js
Request:
Code Block |
---|
var request = require('request'); request({ url: 'https://sandbox.pagbrasil.com/api/order/add', method: 'POST', form: { secret: 'input_your_secret', pbtoken: 'input_your_token', order: '1234567890', payment_method: 'D', product_name: 'Product Test (1 license)', customer_name: 'José da Silva', customer_taxid: '91051605962', customer_email: 'josedasilva@myemail.com.br', customer_phone: '11 3328.9999', address_street: 'Av.Paulista, 100', address_zip: '01311100', address_city: 'São Paulo', address_state: 'SP', amount_brl: '39.50', cc_installments: '1', cc_brand: 'V', cc_holder: 'joao da silva', cc_number: '4984123412341234', cc_expiration: '12/29', cc_cvv: '123', soft_descriptor: 'TEST' auth3ds_type: 'success' auth3ds_cavv: 'kCMfNfPIZcdJYgDHzEW+fZhh4wsU' auth3ds_version: '2' auth3ds_eci: '02' auth3ds_reference_id: 'fe5969fc-2c4b-4b7c-862f-7a5ac9edfd04' auth3ds_xid: 'kCMfNfPIZcdJYgDHzEW+fZhh4wsU' }}, function (error, response, body) { if (!error && response.statusCode == 200) { console.log(body); } } ); |
...
8.5. Reponse
Code Block | ||
---|---|---|
| ||
<?xml version="1.0" encoding="ISO-8859-1"?> <request> <order>1234567890</order> <payment_method>D</payment_method> <submission_date>10/12/2010</submission_date> <order_status>PC</order_status> <authorization_code>493578680</authorization_code> <payment_date>10/12/2010</payment_date> <product_name>Product Test (1 license)</product_name> <customer_name>José da Silva</customer_name> <customer_taxid>91051605962</customer_taxid> <customer_email>josedasilva@myemail.com.br</customer_email> <customer_phone>11 3328.9999</customer_phone> <address_street>Av.Paulista, 100</address_street> <address_zip>01311100</address_zip> <address_city>São Paulo</address_city> <address_state>SP</address_state> <amount_brl>39.50</amount_brl> <amount_paid>39.50</amount_paid> <cc_installments>1</cc_installments> <cc_brand>V</cc_brand> <cc_holder>joao da silva</cc_holder> <cc_number>498412******1234</cc_number> <cc_expiration>12/29</cc_expiration> <soft_descriptor>TEST</soft_descriptor> <signature>9c1fe6cac5521f0b09413ae61e6d1b31</signature> </request> |