Capturar pagamento
curl --request POST \
--url https://api.example.com/v1/payments/{paymentId}/capture \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"amount": {
"value": 1000
},
"additional": {
"reference": "69d0f79e-d524-45d9-92d0-a3d44aa75731"
}
}
'import requests
url = "https://api.example.com/v1/payments/{paymentId}/capture"
payload = {
"amount": { "value": 1000 },
"additional": { "reference": "69d0f79e-d524-45d9-92d0-a3d44aa75731" }
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
amount: {value: 1000},
additional: {reference: '69d0f79e-d524-45d9-92d0-a3d44aa75731'}
})
};
fetch('https://api.example.com/v1/payments/{paymentId}/capture', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/v1/payments/{paymentId}/capture",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'amount' => [
'value' => 1000
],
'additional' => [
'reference' => '69d0f79e-d524-45d9-92d0-a3d44aa75731'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/v1/payments/{paymentId}/capture"
payload := strings.NewReader("{\n \"amount\": {\n \"value\": 1000\n },\n \"additional\": {\n \"reference\": \"69d0f79e-d524-45d9-92d0-a3d44aa75731\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.example.com/v1/payments/{paymentId}/capture")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"amount\": {\n \"value\": 1000\n },\n \"additional\": {\n \"reference\": \"69d0f79e-d524-45d9-92d0-a3d44aa75731\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/v1/payments/{paymentId}/capture")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"amount\": {\n \"value\": 1000\n },\n \"additional\": {\n \"reference\": \"69d0f79e-d524-45d9-92d0-a3d44aa75731\"\n }\n}"
response = http.request(request)
puts response.read_body{
"data": {
"orderId": "89f02752-acc9-4a1d-84c7-cdedd61a7a6c",
"merchant": {
"title": "Pedir Gás",
"name": "Pedir Gás",
"categoryCode": "5172",
"url": "https://www.supergasbras.com.br",
"id": "4b3f7d9d-2d1d-48dc-987c-7c74baf16ff2",
"attributes": {
"externalId": "123456"
}
},
"merchantProvider": {
"provider": {
"id": "e71f2762-e4c4-4ef6-8764-02b97f347ec4",
"name": "Getnet SEP",
"code": "getnetSep",
"type": "Gateway",
"environment": "Digital",
"resolutionKey": "<string>"
},
"name": "Getnet SEP",
"id": "13ef8495-8815-49c8-84fc-382e2cf7a441"
},
"methodResolved": {
"name": "Dinheiro",
"type": "Cash",
"environment": "Physical"
},
"amount": {
"value": 1000,
"currency": "BRL"
},
"descriptor": "SUPER",
"note": "Pagamento do pedido 123456",
"capture": {
"type": "Automatic"
},
"state": "Created",
"status": "Pending",
"method": {
"type": "Credit"
},
"operations": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"type": "Authorization",
"amount": {
"value": 1000,
"currency": "BRL"
},
"idempotencyKey": "f8347c15-57b7-4213-9c96-00942597b72b",
"status": "Created",
"external": {
"id": "4acebcae92674de18aab02f7a2df2c3c"
},
"reason": {
"code": "invalidCredentials",
"message": "Credenciais inválidas"
},
"attributes": {
"externalId": "123456"
},
"createdAt": "2023-11-07T05:31:56Z",
"modifiedAt": "2023-11-07T05:31:56Z"
}
],
"errors": [
{
"code": "<string>",
"target": "<string>",
"message": "<string>"
}
],
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"customer": {
"name": "João Silva",
"phoneNumber": "+5511999999999",
"id": "71ddf226-fd85-4256-b91e-c9419777e4b9",
"email": "joao.silva@test.com",
"document": {
"type": "Cpf",
"number": "22380370044",
"country": "BR"
},
"billingAddress": {
"street": "Avenida Paulista",
"number": "1111",
"apartment": "Sala 100",
"neighborhood": "Bela Vista",
"city": "São Paulo",
"state": "SP",
"country": "BR",
"postalCode": "01311-200",
"longitude": -46.653408,
"latitude": -23.56475
},
"attributes": {
"externalId": "123456"
}
},
"environment": "Digital",
"expiryAt": "2030-06-05T23:59:59-03:00",
"link": {
"url": "https://pagseguro.com.br/v2/checkout/payment.html?code=123456789",
"external": {
"id": "4acebcae92674de18aab02f7a2df2c3c"
}
},
"external": {
"id": "4acebcae92674de18aab02f7a2df2c3c"
},
"items": [
{
"name": "Botijão P13",
"description": "Botijão GLP P13",
"quantity": 3,
"price": {
"value": 1000,
"currency": "BRL"
}
}
],
"source": {
"type": "customer",
"customerId": "71ddf226-fd85-4256-b91e-c9419777e4b9"
},
"attributes": {
"externalId": "123456"
},
"createdAt": "2023-11-07T05:31:56Z",
"modifiedAt": "2023-11-07T05:31:56Z"
}
}{
"data": {
"orderId": "89f02752-acc9-4a1d-84c7-cdedd61a7a6c",
"merchant": {
"title": "Pedir Gás",
"name": "Pedir Gás",
"categoryCode": "5172",
"url": "https://www.supergasbras.com.br",
"id": "4b3f7d9d-2d1d-48dc-987c-7c74baf16ff2",
"attributes": {
"externalId": "123456"
}
},
"merchantProvider": {
"provider": {
"id": "e71f2762-e4c4-4ef6-8764-02b97f347ec4",
"name": "Getnet SEP",
"code": "getnetSep",
"type": "Gateway",
"environment": "Digital",
"resolutionKey": "<string>"
},
"name": "Getnet SEP",
"id": "13ef8495-8815-49c8-84fc-382e2cf7a441"
},
"methodResolved": {
"name": "Dinheiro",
"type": "Cash",
"environment": "Physical"
},
"amount": {
"value": 1000,
"currency": "BRL"
},
"descriptor": "SUPER",
"note": "Pagamento do pedido 123456",
"capture": {
"type": "Automatic"
},
"state": "Created",
"status": "Pending",
"method": {
"type": "Credit"
},
"operations": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"type": "Authorization",
"amount": {
"value": 1000,
"currency": "BRL"
},
"idempotencyKey": "f8347c15-57b7-4213-9c96-00942597b72b",
"status": "Created",
"external": {
"id": "4acebcae92674de18aab02f7a2df2c3c"
},
"reason": {
"code": "invalidCredentials",
"message": "Credenciais inválidas"
},
"attributes": {
"externalId": "123456"
},
"createdAt": "2023-11-07T05:31:56Z",
"modifiedAt": "2023-11-07T05:31:56Z"
}
],
"errors": [
{
"code": "<string>",
"target": "<string>",
"message": "<string>"
}
],
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"customer": {
"name": "João Silva",
"phoneNumber": "+5511999999999",
"id": "71ddf226-fd85-4256-b91e-c9419777e4b9",
"email": "joao.silva@test.com",
"document": {
"type": "Cpf",
"number": "22380370044",
"country": "BR"
},
"billingAddress": {
"street": "Avenida Paulista",
"number": "1111",
"apartment": "Sala 100",
"neighborhood": "Bela Vista",
"city": "São Paulo",
"state": "SP",
"country": "BR",
"postalCode": "01311-200",
"longitude": -46.653408,
"latitude": -23.56475
},
"attributes": {
"externalId": "123456"
}
},
"environment": "Digital",
"expiryAt": "2030-06-05T23:59:59-03:00",
"link": {
"url": "https://pagseguro.com.br/v2/checkout/payment.html?code=123456789",
"external": {
"id": "4acebcae92674de18aab02f7a2df2c3c"
}
},
"external": {
"id": "4acebcae92674de18aab02f7a2df2c3c"
},
"items": [
{
"name": "Botijão P13",
"description": "Botijão GLP P13",
"quantity": 3,
"price": {
"value": 1000,
"currency": "BRL"
}
}
],
"source": {
"type": "customer",
"customerId": "71ddf226-fd85-4256-b91e-c9419777e4b9"
},
"attributes": {
"externalId": "123456"
},
"createdAt": "2023-11-07T05:31:56Z",
"modifiedAt": "2023-11-07T05:31:56Z"
}
}{
"errors": [
{
"code": "<string>",
"target": "<string>",
"message": "<string>"
}
]
}{
"errors": [
{
"code": "<string>",
"target": "<string>",
"message": "<string>"
}
]
}{
"errors": [
{
"code": "<string>",
"target": "<string>",
"message": "<string>"
}
]
}{
"errors": [
{
"code": "<string>",
"target": "<string>",
"message": "<string>"
}
]
}{
"errors": [
{
"code": "<string>",
"target": "<string>",
"message": "<string>"
}
]
}Payments
Capturar pagamento
Captura um pagamento confirmado e não capturado.
POST
/
v1
/
payments
/
{paymentId}
/
capture
Capturar pagamento
curl --request POST \
--url https://api.example.com/v1/payments/{paymentId}/capture \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"amount": {
"value": 1000
},
"additional": {
"reference": "69d0f79e-d524-45d9-92d0-a3d44aa75731"
}
}
'import requests
url = "https://api.example.com/v1/payments/{paymentId}/capture"
payload = {
"amount": { "value": 1000 },
"additional": { "reference": "69d0f79e-d524-45d9-92d0-a3d44aa75731" }
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
amount: {value: 1000},
additional: {reference: '69d0f79e-d524-45d9-92d0-a3d44aa75731'}
})
};
fetch('https://api.example.com/v1/payments/{paymentId}/capture', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/v1/payments/{paymentId}/capture",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'amount' => [
'value' => 1000
],
'additional' => [
'reference' => '69d0f79e-d524-45d9-92d0-a3d44aa75731'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/v1/payments/{paymentId}/capture"
payload := strings.NewReader("{\n \"amount\": {\n \"value\": 1000\n },\n \"additional\": {\n \"reference\": \"69d0f79e-d524-45d9-92d0-a3d44aa75731\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.example.com/v1/payments/{paymentId}/capture")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"amount\": {\n \"value\": 1000\n },\n \"additional\": {\n \"reference\": \"69d0f79e-d524-45d9-92d0-a3d44aa75731\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/v1/payments/{paymentId}/capture")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"amount\": {\n \"value\": 1000\n },\n \"additional\": {\n \"reference\": \"69d0f79e-d524-45d9-92d0-a3d44aa75731\"\n }\n}"
response = http.request(request)
puts response.read_body{
"data": {
"orderId": "89f02752-acc9-4a1d-84c7-cdedd61a7a6c",
"merchant": {
"title": "Pedir Gás",
"name": "Pedir Gás",
"categoryCode": "5172",
"url": "https://www.supergasbras.com.br",
"id": "4b3f7d9d-2d1d-48dc-987c-7c74baf16ff2",
"attributes": {
"externalId": "123456"
}
},
"merchantProvider": {
"provider": {
"id": "e71f2762-e4c4-4ef6-8764-02b97f347ec4",
"name": "Getnet SEP",
"code": "getnetSep",
"type": "Gateway",
"environment": "Digital",
"resolutionKey": "<string>"
},
"name": "Getnet SEP",
"id": "13ef8495-8815-49c8-84fc-382e2cf7a441"
},
"methodResolved": {
"name": "Dinheiro",
"type": "Cash",
"environment": "Physical"
},
"amount": {
"value": 1000,
"currency": "BRL"
},
"descriptor": "SUPER",
"note": "Pagamento do pedido 123456",
"capture": {
"type": "Automatic"
},
"state": "Created",
"status": "Pending",
"method": {
"type": "Credit"
},
"operations": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"type": "Authorization",
"amount": {
"value": 1000,
"currency": "BRL"
},
"idempotencyKey": "f8347c15-57b7-4213-9c96-00942597b72b",
"status": "Created",
"external": {
"id": "4acebcae92674de18aab02f7a2df2c3c"
},
"reason": {
"code": "invalidCredentials",
"message": "Credenciais inválidas"
},
"attributes": {
"externalId": "123456"
},
"createdAt": "2023-11-07T05:31:56Z",
"modifiedAt": "2023-11-07T05:31:56Z"
}
],
"errors": [
{
"code": "<string>",
"target": "<string>",
"message": "<string>"
}
],
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"customer": {
"name": "João Silva",
"phoneNumber": "+5511999999999",
"id": "71ddf226-fd85-4256-b91e-c9419777e4b9",
"email": "joao.silva@test.com",
"document": {
"type": "Cpf",
"number": "22380370044",
"country": "BR"
},
"billingAddress": {
"street": "Avenida Paulista",
"number": "1111",
"apartment": "Sala 100",
"neighborhood": "Bela Vista",
"city": "São Paulo",
"state": "SP",
"country": "BR",
"postalCode": "01311-200",
"longitude": -46.653408,
"latitude": -23.56475
},
"attributes": {
"externalId": "123456"
}
},
"environment": "Digital",
"expiryAt": "2030-06-05T23:59:59-03:00",
"link": {
"url": "https://pagseguro.com.br/v2/checkout/payment.html?code=123456789",
"external": {
"id": "4acebcae92674de18aab02f7a2df2c3c"
}
},
"external": {
"id": "4acebcae92674de18aab02f7a2df2c3c"
},
"items": [
{
"name": "Botijão P13",
"description": "Botijão GLP P13",
"quantity": 3,
"price": {
"value": 1000,
"currency": "BRL"
}
}
],
"source": {
"type": "customer",
"customerId": "71ddf226-fd85-4256-b91e-c9419777e4b9"
},
"attributes": {
"externalId": "123456"
},
"createdAt": "2023-11-07T05:31:56Z",
"modifiedAt": "2023-11-07T05:31:56Z"
}
}{
"data": {
"orderId": "89f02752-acc9-4a1d-84c7-cdedd61a7a6c",
"merchant": {
"title": "Pedir Gás",
"name": "Pedir Gás",
"categoryCode": "5172",
"url": "https://www.supergasbras.com.br",
"id": "4b3f7d9d-2d1d-48dc-987c-7c74baf16ff2",
"attributes": {
"externalId": "123456"
}
},
"merchantProvider": {
"provider": {
"id": "e71f2762-e4c4-4ef6-8764-02b97f347ec4",
"name": "Getnet SEP",
"code": "getnetSep",
"type": "Gateway",
"environment": "Digital",
"resolutionKey": "<string>"
},
"name": "Getnet SEP",
"id": "13ef8495-8815-49c8-84fc-382e2cf7a441"
},
"methodResolved": {
"name": "Dinheiro",
"type": "Cash",
"environment": "Physical"
},
"amount": {
"value": 1000,
"currency": "BRL"
},
"descriptor": "SUPER",
"note": "Pagamento do pedido 123456",
"capture": {
"type": "Automatic"
},
"state": "Created",
"status": "Pending",
"method": {
"type": "Credit"
},
"operations": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"type": "Authorization",
"amount": {
"value": 1000,
"currency": "BRL"
},
"idempotencyKey": "f8347c15-57b7-4213-9c96-00942597b72b",
"status": "Created",
"external": {
"id": "4acebcae92674de18aab02f7a2df2c3c"
},
"reason": {
"code": "invalidCredentials",
"message": "Credenciais inválidas"
},
"attributes": {
"externalId": "123456"
},
"createdAt": "2023-11-07T05:31:56Z",
"modifiedAt": "2023-11-07T05:31:56Z"
}
],
"errors": [
{
"code": "<string>",
"target": "<string>",
"message": "<string>"
}
],
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"customer": {
"name": "João Silva",
"phoneNumber": "+5511999999999",
"id": "71ddf226-fd85-4256-b91e-c9419777e4b9",
"email": "joao.silva@test.com",
"document": {
"type": "Cpf",
"number": "22380370044",
"country": "BR"
},
"billingAddress": {
"street": "Avenida Paulista",
"number": "1111",
"apartment": "Sala 100",
"neighborhood": "Bela Vista",
"city": "São Paulo",
"state": "SP",
"country": "BR",
"postalCode": "01311-200",
"longitude": -46.653408,
"latitude": -23.56475
},
"attributes": {
"externalId": "123456"
}
},
"environment": "Digital",
"expiryAt": "2030-06-05T23:59:59-03:00",
"link": {
"url": "https://pagseguro.com.br/v2/checkout/payment.html?code=123456789",
"external": {
"id": "4acebcae92674de18aab02f7a2df2c3c"
}
},
"external": {
"id": "4acebcae92674de18aab02f7a2df2c3c"
},
"items": [
{
"name": "Botijão P13",
"description": "Botijão GLP P13",
"quantity": 3,
"price": {
"value": 1000,
"currency": "BRL"
}
}
],
"source": {
"type": "customer",
"customerId": "71ddf226-fd85-4256-b91e-c9419777e4b9"
},
"attributes": {
"externalId": "123456"
},
"createdAt": "2023-11-07T05:31:56Z",
"modifiedAt": "2023-11-07T05:31:56Z"
}
}{
"errors": [
{
"code": "<string>",
"target": "<string>",
"message": "<string>"
}
]
}{
"errors": [
{
"code": "<string>",
"target": "<string>",
"message": "<string>"
}
]
}{
"errors": [
{
"code": "<string>",
"target": "<string>",
"message": "<string>"
}
]
}{
"errors": [
{
"code": "<string>",
"target": "<string>",
"message": "<string>"
}
]
}{
"errors": [
{
"code": "<string>",
"target": "<string>",
"message": "<string>"
}
]
}Parâmetros de caminho
Identificador do pagamento
Corpo
application/json
Dados de captura
Resposta
A captura do pagamento é automática ou já foi efetuada anteriormente
Dados de pagamento
Show child attributes
Show child attributes
Esta página foi útil?
⌘I