Create Payin with Global Markup
curl --request POST \
--url https://api.sandbox.wepayout.com.br/v2/payin/payments \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.sandbox.wepayout.com.br/v2/payin/payments"
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.sandbox.wepayout.com.br/v2/payin/payments', 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.sandbox.wepayout.com.br/v2/payin/payments",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <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"
"net/http"
"io"
)
func main() {
url := "https://api.sandbox.wepayout.com.br/v2/payin/payments"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
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.sandbox.wepayout.com.br/v2/payin/payments")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sandbox.wepayout.com.br/v2/payin/payments")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"id": 51687,
"merchant": {
"id": 477,
"name": "Merchant Name"
},
"hash": "abc123def456",
"payment_page": "https://payment.wepayments.com.br/abc123def456",
"invoice": "YOUR-CODE1234",
"payment_method": "pix",
"amount": 10000,
"currency": {
"id": 1,
"code": "BRL"
},
"status": "pending",
"markup": {
"mode": "percent",
"amount": 2.5,
"min_charge_value": 0.50,
"max_charge_value": 10.00,
"origin": "sub_merchant"
}
}
{
"status": false,
"message": "Validation error",
"data": {
"markup": [
"O campo markup é obrigatório."
]
}
}
{
"message": "Os dados fornecidos são inválidos.",
"errors": {
"markup": [
"Error verifying markup configuration. Please try again or contact support."
]
}
}
{
"error": "Internal server error"
}
Payin
Create Payin with Global Markup
Create a payin charge using global markup configuration.
POST
/
v2
/
payin
/
payments
Create Payin with Global Markup
curl --request POST \
--url https://api.sandbox.wepayout.com.br/v2/payin/payments \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.sandbox.wepayout.com.br/v2/payin/payments"
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.sandbox.wepayout.com.br/v2/payin/payments', 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.sandbox.wepayout.com.br/v2/payin/payments",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <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"
"net/http"
"io"
)
func main() {
url := "https://api.sandbox.wepayout.com.br/v2/payin/payments"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
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.sandbox.wepayout.com.br/v2/payin/payments")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sandbox.wepayout.com.br/v2/payin/payments")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"id": 51687,
"merchant": {
"id": 477,
"name": "Merchant Name"
},
"hash": "abc123def456",
"payment_page": "https://payment.wepayments.com.br/abc123def456",
"invoice": "YOUR-CODE1234",
"payment_method": "pix",
"amount": 10000,
"currency": {
"id": 1,
"code": "BRL"
},
"status": "pending",
"markup": {
"mode": "percent",
"amount": 2.5,
"min_charge_value": 0.50,
"max_charge_value": 10.00,
"origin": "sub_merchant"
}
}
{
"status": false,
"message": "Validation error",
"data": {
"markup": [
"O campo markup é obrigatório."
]
}
}
{
"message": "Os dados fornecidos são inválidos.",
"errors": {
"markup": [
"Error verifying markup configuration. Please try again or contact support."
]
}
}
{
"error": "Internal server error"
}
Create Payin with Global Markup
When creating a payin charge, you can use the global markup configuration that has been set up for your merchant. With global markup, you do not need to send themarkup object in the request payload.
Global markup is applied automatically: If the merchant has the markup feature enabled (
enable_markup = true), the system will automatically search for and apply the submerchant’s own markup or, if there is none, the global markup configuration.How It Works
-
Validation: The system checks if the
enable_markupflag is active for the submerchant. -
Markup Search: If enabled, the system automatically searches for a markup configuration, first for the submerchant and then for the merchant, based on:
account_id(submerchant ID)product(payin)payment_method(pix, boleto, etc.)
- Application: If the submerchant has its own markup for the payment method, it is applied to the charge. Otherwise, the global markup is applied.
-
Priority: If you send an inline
markupobject, it takes precedence over the submerchant and global markups.
Request Examples
{
"payment_method": "pix",
"invoice": "YOUR-CODE1234",
"currency": "BRL",
"amount": 10000,
"country": "BR",
"buyer": {
"name": "Buyer Name",
"document": {
"type": "CPF",
"number": "34960826312"
},
"email": "buyer-email@wepayments.com.br"
},
"pix": {
"expire_date": "2025-12-31T23:59:59"
}
}
{
"payment_method": "boleto",
"invoice": "YOUR-INVOICE-CODE",
"currency": "BRL",
"amount": 50000,
"country": "BR",
"buyer": {
"name": "Buyer Name",
"email": "buyer@example.com",
"document": {
"type": "CPF",
"number": "12345678901"
},
"address": {
"street": "Street Name",
"number": "123",
"complement": "Apt 456",
"zipcode": "12345000",
"city": "City Name",
"district": "District Name",
"state_code": "SP"
}
},
"originator_legal_entity": {
"name": "Company Name",
"document": "12345678901",
"helpdesk": "company.com"
},
"boleto": {
"expire_date": "2025-12-31"
}
}
curl -X POST "https://api.sandbox.wepayout.com.br/v2/payin/payments" \
-H "Authorization: Bearer YOUR_TOKEN_HERE" \
-H "Content-Type: application/json" \
-d '{
"payment_method": "pix",
"invoice": "YOUR-CODE1234",
"currency": "BRL",
"amount": 10000,
"country": "BR",
"buyer": {
"name": "Buyer Name",
"document": {
"type": "CPF",
"number": "34960826312"
},
"email": "buyer-email@wepayments.com.br"
},
"pix": {
"expire_date": "2025-12-31T23:59:59"
}
}'
Response
integer
WEpayment’s auto generated id, use this id to perform conciliation or perform queries via API / Dashboard.
object
string
WEpayments auto generated hash, use this hash to send your user to the payment page.
string
The WEpayments payment page is the place where you will redirect the end customer to pay the bill.
string
Your identification number.
string
Payment method that will be used in payin.Values:
pix, boletointeger
The payin total amount in cents.
string
Current status of the payin.Example:
pendingobject
Markup configuration applied to this charge (submerchant or global).
Show Markup Object
Show Markup Object
string
Markup mode applied.Values:
fixed, percentnumber
Markup value configured for this charge.
number or null
Minimum markup value when
mode is percent. Will be null when mode is fixed.number or null
Maximum markup value when
mode is percent. Will be null when mode is fixed or when not specified.string or null
Level of the markup that was applied.Values:
sub_merchant, global{
"id": 51687,
"merchant": {
"id": 477,
"name": "Merchant Name"
},
"hash": "abc123def456",
"payment_page": "https://payment.wepayments.com.br/abc123def456",
"invoice": "YOUR-CODE1234",
"payment_method": "pix",
"amount": 10000,
"currency": {
"id": 1,
"code": "BRL"
},
"status": "pending",
"markup": {
"mode": "percent",
"amount": 2.5,
"min_charge_value": 0.50,
"max_charge_value": 10.00,
"origin": "sub_merchant"
}
}
{
"status": false,
"message": "Validation error",
"data": {
"markup": [
"O campo markup é obrigatório."
]
}
}
{
"message": "Os dados fornecidos são inválidos.",
"errors": {
"markup": [
"Error verifying markup configuration. Please try again or contact support."
]
}
}
{
"error": "Internal server error"
}
Business Rules
Markup Required: If
enable_markup = true for the submerchant and there is neither a submerchant markup nor a global markup configuration for the payment method, you must send an inline markup object. Otherwise, the request will fail with a 422 error.Automatic Application: When
enable_markup = true and a submerchant or global markup exists, it is automatically applied without requiring the markup object in the request.Error Scenarios
Scenario 1: enable_markup = true, No Submerchant or Global Markup, No Inline Markup
If the submerchant hasenable_markup = true but:
- No submerchant markup configuration exists for the payment method
- No global markup configuration exists for the payment method
- No inline markup object is sent in the request
Scenario 2: Error Verifying Global Markup
If there is an error while searching for or verifying the global markup configuration. Result: Returns 422 error with message “Error verifying markup configuration. Please try again or contact support.”Related Resources
Create Payin with Inline Markup
Learn how to create payin with inline markup
Create Merchant Markup
Configure global markup for merchants
About Markup
Understand markup types and configuration levels
Create Charge
Complete documentation for creating payin charges
Was this page helpful?

