Criar cobrança PIX
curl --request POST \
--url https://api.swytchpay.app/v1/deposits \
--header 'Content-Type: application/json' \
--data '
{
"amount_cents": 1,
"external_id": "<string>",
"expires_in_sec": 44100,
"callback_url": "<string>",
"metadata": {}
}
'import requests
url = "https://api.swytchpay.app/v1/deposits"
payload = {
"amount_cents": 1,
"external_id": "<string>",
"expires_in_sec": 44100,
"callback_url": "<string>",
"metadata": {}
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
amount_cents: 1,
external_id: '<string>',
expires_in_sec: 44100,
callback_url: '<string>',
metadata: {}
})
};
fetch('https://api.swytchpay.app/v1/deposits', 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.swytchpay.app/v1/deposits",
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_cents' => 1,
'external_id' => '<string>',
'expires_in_sec' => 44100,
'callback_url' => '<string>',
'metadata' => [
]
]),
CURLOPT_HTTPHEADER => [
"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.swytchpay.app/v1/deposits"
payload := strings.NewReader("{\n \"amount_cents\": 1,\n \"external_id\": \"<string>\",\n \"expires_in_sec\": 44100,\n \"callback_url\": \"<string>\",\n \"metadata\": {}\n}")
req, _ := http.NewRequest("POST", url, payload)
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.swytchpay.app/v1/deposits")
.header("Content-Type", "application/json")
.body("{\n \"amount_cents\": 1,\n \"external_id\": \"<string>\",\n \"expires_in_sec\": 44100,\n \"callback_url\": \"<string>\",\n \"metadata\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.swytchpay.app/v1/deposits")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"amount_cents\": 1,\n \"external_id\": \"<string>\",\n \"expires_in_sec\": 44100,\n \"callback_url\": \"<string>\",\n \"metadata\": {}\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"object": "deposit",
"external_id": "<string>",
"amount_cents": 123,
"fee_cents": 123,
"net_cents": 123,
"pix": {
"emv": "<string>",
"qr_url": "<string>"
}
}{
"id": "<string>",
"object": "deposit",
"external_id": "<string>",
"amount_cents": 123,
"fee_cents": 123,
"net_cents": 123,
"pix": {
"emv": "<string>",
"qr_url": "<string>"
}
}Deposits
Criar cobrança PIX
POST
/
v1
/
deposits
Criar cobrança PIX
curl --request POST \
--url https://api.swytchpay.app/v1/deposits \
--header 'Content-Type: application/json' \
--data '
{
"amount_cents": 1,
"external_id": "<string>",
"expires_in_sec": 44100,
"callback_url": "<string>",
"metadata": {}
}
'import requests
url = "https://api.swytchpay.app/v1/deposits"
payload = {
"amount_cents": 1,
"external_id": "<string>",
"expires_in_sec": 44100,
"callback_url": "<string>",
"metadata": {}
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
amount_cents: 1,
external_id: '<string>',
expires_in_sec: 44100,
callback_url: '<string>',
metadata: {}
})
};
fetch('https://api.swytchpay.app/v1/deposits', 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.swytchpay.app/v1/deposits",
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_cents' => 1,
'external_id' => '<string>',
'expires_in_sec' => 44100,
'callback_url' => '<string>',
'metadata' => [
]
]),
CURLOPT_HTTPHEADER => [
"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.swytchpay.app/v1/deposits"
payload := strings.NewReader("{\n \"amount_cents\": 1,\n \"external_id\": \"<string>\",\n \"expires_in_sec\": 44100,\n \"callback_url\": \"<string>\",\n \"metadata\": {}\n}")
req, _ := http.NewRequest("POST", url, payload)
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.swytchpay.app/v1/deposits")
.header("Content-Type", "application/json")
.body("{\n \"amount_cents\": 1,\n \"external_id\": \"<string>\",\n \"expires_in_sec\": 44100,\n \"callback_url\": \"<string>\",\n \"metadata\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.swytchpay.app/v1/deposits")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"amount_cents\": 1,\n \"external_id\": \"<string>\",\n \"expires_in_sec\": 44100,\n \"callback_url\": \"<string>\",\n \"metadata\": {}\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"object": "deposit",
"external_id": "<string>",
"amount_cents": 123,
"fee_cents": 123,
"net_cents": 123,
"pix": {
"emv": "<string>",
"qr_url": "<string>"
}
}{
"id": "<string>",
"object": "deposit",
"external_id": "<string>",
"amount_cents": 123,
"fee_cents": 123,
"net_cents": 123,
"pix": {
"emv": "<string>",
"qr_url": "<string>"
}
}Body
application/json
Response
external_id repetido — retorna o existente (idempotente)
Available options:
deposit Available options:
PENDING, PAID, EXPIRED, REFUNDED, FAILED Show child attributes
Show child attributes
Available options:
live, test ⌘I