Criar cobrança da subconta
curl --request POST \
--url https://api.mingopay.com.br/v1/subaccounts/{id}/payment-intents \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'Idempotency-Key: <idempotency-key>' \
--data '
{
"externalReference": "pedido_1024",
"amountCents": 14990,
"method": "pix",
"description": "Pedido 1024",
"expiresInSeconds": 1800,
"payer": {
"name": "Cliente Exemplo",
"taxId": "52998224725",
"email": "cliente@example.com"
},
"metadata": {
"orderId": "1024"
}
}
'import requests
url = "https://api.mingopay.com.br/v1/subaccounts/{id}/payment-intents"
payload = {
"externalReference": "pedido_1024",
"amountCents": 14990,
"method": "pix",
"description": "Pedido 1024",
"expiresInSeconds": 1800,
"payer": {
"name": "Cliente Exemplo",
"taxId": "52998224725",
"email": "cliente@example.com"
},
"metadata": { "orderId": "1024" }
}
headers = {
"Idempotency-Key": "<idempotency-key>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'Idempotency-Key': '<idempotency-key>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
externalReference: 'pedido_1024',
amountCents: 14990,
method: 'pix',
description: 'Pedido 1024',
expiresInSeconds: 1800,
payer: {name: 'Cliente Exemplo', taxId: '52998224725', email: 'cliente@example.com'},
metadata: {orderId: '1024'}
})
};
fetch('https://api.mingopay.com.br/v1/subaccounts/{id}/payment-intents', 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.mingopay.com.br/v1/subaccounts/{id}/payment-intents",
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([
'externalReference' => 'pedido_1024',
'amountCents' => 14990,
'method' => 'pix',
'description' => 'Pedido 1024',
'expiresInSeconds' => 1800,
'payer' => [
'name' => 'Cliente Exemplo',
'taxId' => '52998224725',
'email' => 'cliente@example.com'
],
'metadata' => [
'orderId' => '1024'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"Idempotency-Key: <idempotency-key>"
],
]);
$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.mingopay.com.br/v1/subaccounts/{id}/payment-intents"
payload := strings.NewReader("{\n \"externalReference\": \"pedido_1024\",\n \"amountCents\": 14990,\n \"method\": \"pix\",\n \"description\": \"Pedido 1024\",\n \"expiresInSeconds\": 1800,\n \"payer\": {\n \"name\": \"Cliente Exemplo\",\n \"taxId\": \"52998224725\",\n \"email\": \"cliente@example.com\"\n },\n \"metadata\": {\n \"orderId\": \"1024\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Idempotency-Key", "<idempotency-key>")
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.mingopay.com.br/v1/subaccounts/{id}/payment-intents")
.header("Idempotency-Key", "<idempotency-key>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"externalReference\": \"pedido_1024\",\n \"amountCents\": 14990,\n \"method\": \"pix\",\n \"description\": \"Pedido 1024\",\n \"expiresInSeconds\": 1800,\n \"payer\": {\n \"name\": \"Cliente Exemplo\",\n \"taxId\": \"52998224725\",\n \"email\": \"cliente@example.com\"\n },\n \"metadata\": {\n \"orderId\": \"1024\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.mingopay.com.br/v1/subaccounts/{id}/payment-intents")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Idempotency-Key"] = '<idempotency-key>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"externalReference\": \"pedido_1024\",\n \"amountCents\": 14990,\n \"method\": \"pix\",\n \"description\": \"Pedido 1024\",\n \"expiresInSeconds\": 1800,\n \"payer\": {\n \"name\": \"Cliente Exemplo\",\n \"taxId\": \"52998224725\",\n \"email\": \"cliente@example.com\"\n },\n \"metadata\": {\n \"orderId\": \"1024\"\n }\n}"
response = http.request(request)
puts response.read_body{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"organizationId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"amountCents": 123,
"feeCents": 123,
"netCents": 123,
"currency": "BRL",
"method": "pix",
"status": "created",
"metadata": {},
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"environment": "sandbox",
"providerFeeCents": 123,
"platformFeeCents": 123,
"commissionCents": 1,
"mingoFeeCents": 1,
"pix": {
"copyPasteCode": "<string>",
"expiresAt": "2023-11-07T05:31:56Z"
},
"customerId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"externalReference": "<string>",
"provider": "<string>",
"providerReference": "<string>",
"description": "<string>",
"expiresAt": "2023-11-07T05:31:56Z",
"paidAt": "2023-11-07T05:31:56Z",
"subaccountId": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}{
"error": "<string>",
"message": "<string>",
"requestId": "<string>",
"details": [
{
"path": "<string>",
"message": "<string>"
}
]
}{
"error": "<string>",
"message": "<string>",
"requestId": "<string>",
"details": [
{
"path": "<string>",
"message": "<string>"
}
]
}{
"error": "<string>",
"message": "<string>",
"requestId": "<string>",
"details": [
{
"path": "<string>",
"message": "<string>"
}
]
}{
"error": "<string>",
"message": "<string>",
"requestId": "<string>",
"details": [
{
"path": "<string>",
"message": "<string>"
}
]
}{
"error": "<string>",
"message": "<string>",
"requestId": "<string>",
"details": [
{
"path": "<string>",
"message": "<string>"
}
]
}{
"error": "<string>",
"message": "<string>",
"requestId": "<string>",
"details": [
{
"path": "<string>",
"message": "<string>"
}
]
}{
"error": "<string>",
"message": "<string>",
"requestId": "<string>",
"details": [
{
"path": "<string>",
"message": "<string>"
}
]
}Criar cobrança da subconta
Exige subaccounts:read e payment_intents:write. UUID da MingoPay, organização e ambiente isolados. Idempotency-Key de 16 a 128 caracteres. Comissão e tarifa são registradas na criação.
POST
/
v1
/
subaccounts
/
{id}
/
payment-intents
Criar cobrança da subconta
curl --request POST \
--url https://api.mingopay.com.br/v1/subaccounts/{id}/payment-intents \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'Idempotency-Key: <idempotency-key>' \
--data '
{
"externalReference": "pedido_1024",
"amountCents": 14990,
"method": "pix",
"description": "Pedido 1024",
"expiresInSeconds": 1800,
"payer": {
"name": "Cliente Exemplo",
"taxId": "52998224725",
"email": "cliente@example.com"
},
"metadata": {
"orderId": "1024"
}
}
'import requests
url = "https://api.mingopay.com.br/v1/subaccounts/{id}/payment-intents"
payload = {
"externalReference": "pedido_1024",
"amountCents": 14990,
"method": "pix",
"description": "Pedido 1024",
"expiresInSeconds": 1800,
"payer": {
"name": "Cliente Exemplo",
"taxId": "52998224725",
"email": "cliente@example.com"
},
"metadata": { "orderId": "1024" }
}
headers = {
"Idempotency-Key": "<idempotency-key>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'Idempotency-Key': '<idempotency-key>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
externalReference: 'pedido_1024',
amountCents: 14990,
method: 'pix',
description: 'Pedido 1024',
expiresInSeconds: 1800,
payer: {name: 'Cliente Exemplo', taxId: '52998224725', email: 'cliente@example.com'},
metadata: {orderId: '1024'}
})
};
fetch('https://api.mingopay.com.br/v1/subaccounts/{id}/payment-intents', 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.mingopay.com.br/v1/subaccounts/{id}/payment-intents",
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([
'externalReference' => 'pedido_1024',
'amountCents' => 14990,
'method' => 'pix',
'description' => 'Pedido 1024',
'expiresInSeconds' => 1800,
'payer' => [
'name' => 'Cliente Exemplo',
'taxId' => '52998224725',
'email' => 'cliente@example.com'
],
'metadata' => [
'orderId' => '1024'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"Idempotency-Key: <idempotency-key>"
],
]);
$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.mingopay.com.br/v1/subaccounts/{id}/payment-intents"
payload := strings.NewReader("{\n \"externalReference\": \"pedido_1024\",\n \"amountCents\": 14990,\n \"method\": \"pix\",\n \"description\": \"Pedido 1024\",\n \"expiresInSeconds\": 1800,\n \"payer\": {\n \"name\": \"Cliente Exemplo\",\n \"taxId\": \"52998224725\",\n \"email\": \"cliente@example.com\"\n },\n \"metadata\": {\n \"orderId\": \"1024\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Idempotency-Key", "<idempotency-key>")
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.mingopay.com.br/v1/subaccounts/{id}/payment-intents")
.header("Idempotency-Key", "<idempotency-key>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"externalReference\": \"pedido_1024\",\n \"amountCents\": 14990,\n \"method\": \"pix\",\n \"description\": \"Pedido 1024\",\n \"expiresInSeconds\": 1800,\n \"payer\": {\n \"name\": \"Cliente Exemplo\",\n \"taxId\": \"52998224725\",\n \"email\": \"cliente@example.com\"\n },\n \"metadata\": {\n \"orderId\": \"1024\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.mingopay.com.br/v1/subaccounts/{id}/payment-intents")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Idempotency-Key"] = '<idempotency-key>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"externalReference\": \"pedido_1024\",\n \"amountCents\": 14990,\n \"method\": \"pix\",\n \"description\": \"Pedido 1024\",\n \"expiresInSeconds\": 1800,\n \"payer\": {\n \"name\": \"Cliente Exemplo\",\n \"taxId\": \"52998224725\",\n \"email\": \"cliente@example.com\"\n },\n \"metadata\": {\n \"orderId\": \"1024\"\n }\n}"
response = http.request(request)
puts response.read_body{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"organizationId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"amountCents": 123,
"feeCents": 123,
"netCents": 123,
"currency": "BRL",
"method": "pix",
"status": "created",
"metadata": {},
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"environment": "sandbox",
"providerFeeCents": 123,
"platformFeeCents": 123,
"commissionCents": 1,
"mingoFeeCents": 1,
"pix": {
"copyPasteCode": "<string>",
"expiresAt": "2023-11-07T05:31:56Z"
},
"customerId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"externalReference": "<string>",
"provider": "<string>",
"providerReference": "<string>",
"description": "<string>",
"expiresAt": "2023-11-07T05:31:56Z",
"paidAt": "2023-11-07T05:31:56Z",
"subaccountId": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}{
"error": "<string>",
"message": "<string>",
"requestId": "<string>",
"details": [
{
"path": "<string>",
"message": "<string>"
}
]
}{
"error": "<string>",
"message": "<string>",
"requestId": "<string>",
"details": [
{
"path": "<string>",
"message": "<string>"
}
]
}{
"error": "<string>",
"message": "<string>",
"requestId": "<string>",
"details": [
{
"path": "<string>",
"message": "<string>"
}
]
}{
"error": "<string>",
"message": "<string>",
"requestId": "<string>",
"details": [
{
"path": "<string>",
"message": "<string>"
}
]
}{
"error": "<string>",
"message": "<string>",
"requestId": "<string>",
"details": [
{
"path": "<string>",
"message": "<string>"
}
]
}{
"error": "<string>",
"message": "<string>",
"requestId": "<string>",
"details": [
{
"path": "<string>",
"message": "<string>"
}
]
}{
"error": "<string>",
"message": "<string>",
"requestId": "<string>",
"details": [
{
"path": "<string>",
"message": "<string>"
}
]
}Autorizações
Cabeçalhos
Corpo
application/json
Resposta
Cobrança criada.
