package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/v1/collections/immediate"
payload := strings.NewReader("{\n \"amount\": \"100.00\",\n \"expirationSeconds\": 3600,\n \"receiverKey\": \"+5511999999999\",\n \"txId\": \"TXabcdefghijklmno123456789\",\n \"additionalInfo\": {\n \"customerId\": \"67890\",\n \"orderId\": \"12345\"\n },\n \"debtorDocument\": \"52998224725\",\n \"debtorName\": \"João da Silva\",\n \"description\": \"Payment for order #12345\",\n \"locationInformation\": {\n \"categoryCode\": \"5411\",\n \"merchantCity\": \"São Paulo\",\n \"merchantName\": \"Loja ABC\",\n \"postalCode\": \"01310-100\"\n },\n \"metadata\": {},\n \"tags\": [\n \"ecommerce\",\n \"subscription\"\n ],\n \"transactionAmount\": \"150.00\",\n \"withdrawalAmount\": \"50.00\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-Account-Id", "<x-account-id>")
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))
}