Create a loan
Creates a loan based on a previously approved proposal
curl --request POST \
--url https://api.paymee.com.br/v1.1/loans/create \
--header 'Content-Type: application/json' \
--header 'x-api-key: <x-api-key>' \
--header 'x-api-token: <x-api-token>' \
--data @- <<EOF
{
"proposal_id": "abc1234",
"reference_code": "ref01234",
"max_age": 60,
"discriminator": "John's transaction",
"final_amount": 10,
"customer": {
"name": "John Doe",
"birth": "1970-01-01",
"email": "foo@bar.com",
"mobile_number": "11999999999",
"document": {
"type": "CPF",
"number": "00000000000"
},
"address": {
"zipcode": "12345678",
"street": "Main Street",
"number": "123",
"complement": "Apt 4",
"neighborhood": "Downtown",
"city": "City",
"state": "ST"
}
}
}
EOFimport requests
url = "https://api.paymee.com.br/v1.1/loans/create"
payload = {
"proposal_id": "abc1234",
"reference_code": "ref01234",
"max_age": 60,
"discriminator": "John's transaction",
"final_amount": 10,
"customer": {
"name": "John Doe",
"birth": "1970-01-01",
"email": "foo@bar.com",
"mobile_number": "11999999999",
"document": {
"type": "CPF",
"number": "00000000000"
},
"address": {
"zipcode": "12345678",
"street": "Main Street",
"number": "123",
"complement": "Apt 4",
"neighborhood": "Downtown",
"city": "City",
"state": "ST"
}
}
}
headers = {
"x-api-key": "<x-api-key>",
"x-api-token": "<x-api-token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'x-api-key': '<x-api-key>',
'x-api-token': '<x-api-token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
proposal_id: 'abc1234',
reference_code: 'ref01234',
max_age: 60,
discriminator: 'John\'s transaction',
final_amount: 10,
customer: {
name: 'John Doe',
birth: '1970-01-01',
email: 'foo@bar.com',
mobile_number: '11999999999',
document: {type: 'CPF', number: '00000000000'},
address: {
zipcode: '12345678',
street: 'Main Street',
number: '123',
complement: 'Apt 4',
neighborhood: 'Downtown',
city: 'City',
state: 'ST'
}
}
})
};
fetch('https://api.paymee.com.br/v1.1/loans/create', 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.paymee.com.br/v1.1/loans/create",
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([
'proposal_id' => 'abc1234',
'reference_code' => 'ref01234',
'max_age' => 60,
'discriminator' => 'John\'s transaction',
'final_amount' => 10,
'customer' => [
'name' => 'John Doe',
'birth' => '1970-01-01',
'email' => 'foo@bar.com',
'mobile_number' => '11999999999',
'document' => [
'type' => 'CPF',
'number' => '00000000000'
],
'address' => [
'zipcode' => '12345678',
'street' => 'Main Street',
'number' => '123',
'complement' => 'Apt 4',
'neighborhood' => 'Downtown',
'city' => 'City',
'state' => 'ST'
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <x-api-key>",
"x-api-token: <x-api-token>"
],
]);
$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.paymee.com.br/v1.1/loans/create"
payload := strings.NewReader("{\n \"proposal_id\": \"abc1234\",\n \"reference_code\": \"ref01234\",\n \"max_age\": 60,\n \"discriminator\": \"John's transaction\",\n \"final_amount\": 10,\n \"customer\": {\n \"name\": \"John Doe\",\n \"birth\": \"1970-01-01\",\n \"email\": \"foo@bar.com\",\n \"mobile_number\": \"11999999999\",\n \"document\": {\n \"type\": \"CPF\",\n \"number\": \"00000000000\"\n },\n \"address\": {\n \"zipcode\": \"12345678\",\n \"street\": \"Main Street\",\n \"number\": \"123\",\n \"complement\": \"Apt 4\",\n \"neighborhood\": \"Downtown\",\n \"city\": \"City\",\n \"state\": \"ST\"\n }\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<x-api-key>")
req.Header.Add("x-api-token", "<x-api-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.paymee.com.br/v1.1/loans/create")
.header("x-api-key", "<x-api-key>")
.header("x-api-token", "<x-api-token>")
.header("Content-Type", "application/json")
.body("{\n \"proposal_id\": \"abc1234\",\n \"reference_code\": \"ref01234\",\n \"max_age\": 60,\n \"discriminator\": \"John's transaction\",\n \"final_amount\": 10,\n \"customer\": {\n \"name\": \"John Doe\",\n \"birth\": \"1970-01-01\",\n \"email\": \"foo@bar.com\",\n \"mobile_number\": \"11999999999\",\n \"document\": {\n \"type\": \"CPF\",\n \"number\": \"00000000000\"\n },\n \"address\": {\n \"zipcode\": \"12345678\",\n \"street\": \"Main Street\",\n \"number\": \"123\",\n \"complement\": \"Apt 4\",\n \"neighborhood\": \"Downtown\",\n \"city\": \"City\",\n \"state\": \"ST\"\n }\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.paymee.com.br/v1.1/loans/create")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<x-api-key>'
request["x-api-token"] = '<x-api-token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"proposal_id\": \"abc1234\",\n \"reference_code\": \"ref01234\",\n \"max_age\": 60,\n \"discriminator\": \"John's transaction\",\n \"final_amount\": 10,\n \"customer\": {\n \"name\": \"John Doe\",\n \"birth\": \"1970-01-01\",\n \"email\": \"foo@bar.com\",\n \"mobile_number\": \"11999999999\",\n \"document\": {\n \"type\": \"CPF\",\n \"number\": \"00000000000\"\n },\n \"address\": {\n \"zipcode\": \"12345678\",\n \"street\": \"Main Street\",\n \"number\": \"123\",\n \"complement\": \"Apt 4\",\n \"neighborhood\": \"Downtown\",\n \"city\": \"City\",\n \"state\": \"ST\"\n }\n }\n}"
response = http.request(request)
puts response.read_body{
"amount": 800,
"appliedRate": 0,
"chosen_term": {
"amount": 800,
"final_amount": 845.31,
"interest_rate": 7.17,
"label": "03x",
"monthly_interest_rate": 2.39,
"quotas": 281.77,
"times": 3
},
"creation": "2021-03-17 10:43:49",
"currency": "BRL",
"discounts": 0,
"id": 43863,
"maxAge": "2021-03-19 02:40:49",
"message": "success",
"referenceCode": "5077AXC",
"shipping": 0,
"shopper": {
"bankDetails": {},
"document": {
"number": "00000000000",
"type": "CPF"
},
"email": "foo@bar.com",
"name": "JOHN DOE",
"phone": {
"number": "+5511999999999",
"type": "MOBILE"
}
},
"situation": "PENDING",
"status": 0,
"total": 800,
"type": "SALE",
"uuid": "d7113995-e683-35b6-bf4f-7846ebc63819"
}Headers
API authentication key
"your-api-key-here"
API authentication token
"your-api-token-here"
Body
Proposal ID from a previous loan simulation
"abc1234"
Merchant reference code for tracking
"ref01234"
Validity period in minutes
60
Optional field for categorization
"John's transaction"
Final amount to be paid
10
Show child attributes
Show child attributes
Response
Loan creation response
- Option 1
- Option 2
Principal loan amount
800
Applied rate
0
Selected payment term details
Loan creation date and time
Currency code
Applied discounts
Internal loan ID
Loan expiration date and time
Response message
"success"
Merchant reference code
Shipping costs if applicable
Customer information
Loan status
"PENDING"
Response status code
0
Total loan amount
Transaction type
"SALE"
Unique loan identifier
curl --request POST \
--url https://api.paymee.com.br/v1.1/loans/create \
--header 'Content-Type: application/json' \
--header 'x-api-key: <x-api-key>' \
--header 'x-api-token: <x-api-token>' \
--data @- <<EOF
{
"proposal_id": "abc1234",
"reference_code": "ref01234",
"max_age": 60,
"discriminator": "John's transaction",
"final_amount": 10,
"customer": {
"name": "John Doe",
"birth": "1970-01-01",
"email": "foo@bar.com",
"mobile_number": "11999999999",
"document": {
"type": "CPF",
"number": "00000000000"
},
"address": {
"zipcode": "12345678",
"street": "Main Street",
"number": "123",
"complement": "Apt 4",
"neighborhood": "Downtown",
"city": "City",
"state": "ST"
}
}
}
EOFimport requests
url = "https://api.paymee.com.br/v1.1/loans/create"
payload = {
"proposal_id": "abc1234",
"reference_code": "ref01234",
"max_age": 60,
"discriminator": "John's transaction",
"final_amount": 10,
"customer": {
"name": "John Doe",
"birth": "1970-01-01",
"email": "foo@bar.com",
"mobile_number": "11999999999",
"document": {
"type": "CPF",
"number": "00000000000"
},
"address": {
"zipcode": "12345678",
"street": "Main Street",
"number": "123",
"complement": "Apt 4",
"neighborhood": "Downtown",
"city": "City",
"state": "ST"
}
}
}
headers = {
"x-api-key": "<x-api-key>",
"x-api-token": "<x-api-token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'x-api-key': '<x-api-key>',
'x-api-token': '<x-api-token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
proposal_id: 'abc1234',
reference_code: 'ref01234',
max_age: 60,
discriminator: 'John\'s transaction',
final_amount: 10,
customer: {
name: 'John Doe',
birth: '1970-01-01',
email: 'foo@bar.com',
mobile_number: '11999999999',
document: {type: 'CPF', number: '00000000000'},
address: {
zipcode: '12345678',
street: 'Main Street',
number: '123',
complement: 'Apt 4',
neighborhood: 'Downtown',
city: 'City',
state: 'ST'
}
}
})
};
fetch('https://api.paymee.com.br/v1.1/loans/create', 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.paymee.com.br/v1.1/loans/create",
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([
'proposal_id' => 'abc1234',
'reference_code' => 'ref01234',
'max_age' => 60,
'discriminator' => 'John\'s transaction',
'final_amount' => 10,
'customer' => [
'name' => 'John Doe',
'birth' => '1970-01-01',
'email' => 'foo@bar.com',
'mobile_number' => '11999999999',
'document' => [
'type' => 'CPF',
'number' => '00000000000'
],
'address' => [
'zipcode' => '12345678',
'street' => 'Main Street',
'number' => '123',
'complement' => 'Apt 4',
'neighborhood' => 'Downtown',
'city' => 'City',
'state' => 'ST'
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <x-api-key>",
"x-api-token: <x-api-token>"
],
]);
$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.paymee.com.br/v1.1/loans/create"
payload := strings.NewReader("{\n \"proposal_id\": \"abc1234\",\n \"reference_code\": \"ref01234\",\n \"max_age\": 60,\n \"discriminator\": \"John's transaction\",\n \"final_amount\": 10,\n \"customer\": {\n \"name\": \"John Doe\",\n \"birth\": \"1970-01-01\",\n \"email\": \"foo@bar.com\",\n \"mobile_number\": \"11999999999\",\n \"document\": {\n \"type\": \"CPF\",\n \"number\": \"00000000000\"\n },\n \"address\": {\n \"zipcode\": \"12345678\",\n \"street\": \"Main Street\",\n \"number\": \"123\",\n \"complement\": \"Apt 4\",\n \"neighborhood\": \"Downtown\",\n \"city\": \"City\",\n \"state\": \"ST\"\n }\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<x-api-key>")
req.Header.Add("x-api-token", "<x-api-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.paymee.com.br/v1.1/loans/create")
.header("x-api-key", "<x-api-key>")
.header("x-api-token", "<x-api-token>")
.header("Content-Type", "application/json")
.body("{\n \"proposal_id\": \"abc1234\",\n \"reference_code\": \"ref01234\",\n \"max_age\": 60,\n \"discriminator\": \"John's transaction\",\n \"final_amount\": 10,\n \"customer\": {\n \"name\": \"John Doe\",\n \"birth\": \"1970-01-01\",\n \"email\": \"foo@bar.com\",\n \"mobile_number\": \"11999999999\",\n \"document\": {\n \"type\": \"CPF\",\n \"number\": \"00000000000\"\n },\n \"address\": {\n \"zipcode\": \"12345678\",\n \"street\": \"Main Street\",\n \"number\": \"123\",\n \"complement\": \"Apt 4\",\n \"neighborhood\": \"Downtown\",\n \"city\": \"City\",\n \"state\": \"ST\"\n }\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.paymee.com.br/v1.1/loans/create")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<x-api-key>'
request["x-api-token"] = '<x-api-token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"proposal_id\": \"abc1234\",\n \"reference_code\": \"ref01234\",\n \"max_age\": 60,\n \"discriminator\": \"John's transaction\",\n \"final_amount\": 10,\n \"customer\": {\n \"name\": \"John Doe\",\n \"birth\": \"1970-01-01\",\n \"email\": \"foo@bar.com\",\n \"mobile_number\": \"11999999999\",\n \"document\": {\n \"type\": \"CPF\",\n \"number\": \"00000000000\"\n },\n \"address\": {\n \"zipcode\": \"12345678\",\n \"street\": \"Main Street\",\n \"number\": \"123\",\n \"complement\": \"Apt 4\",\n \"neighborhood\": \"Downtown\",\n \"city\": \"City\",\n \"state\": \"ST\"\n }\n }\n}"
response = http.request(request)
puts response.read_body{
"amount": 800,
"appliedRate": 0,
"chosen_term": {
"amount": 800,
"final_amount": 845.31,
"interest_rate": 7.17,
"label": "03x",
"monthly_interest_rate": 2.39,
"quotas": 281.77,
"times": 3
},
"creation": "2021-03-17 10:43:49",
"currency": "BRL",
"discounts": 0,
"id": 43863,
"maxAge": "2021-03-19 02:40:49",
"message": "success",
"referenceCode": "5077AXC",
"shipping": 0,
"shopper": {
"bankDetails": {},
"document": {
"number": "00000000000",
"type": "CPF"
},
"email": "foo@bar.com",
"name": "JOHN DOE",
"phone": {
"number": "+5511999999999",
"type": "MOBILE"
}
},
"situation": "PENDING",
"status": 0,
"total": 800,
"type": "SALE",
"uuid": "d7113995-e683-35b6-bf4f-7846ebc63819"
}
