Validar cupom no checkout do link
curl --request GET \
--url https://v4pay-api.vercel.app/checkout/link/{slug}/couponimport requests
url = "https://v4pay-api.vercel.app/checkout/link/{slug}/coupon"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://v4pay-api.vercel.app/checkout/link/{slug}/coupon', 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://v4pay-api.vercel.app/checkout/link/{slug}/coupon",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$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://v4pay-api.vercel.app/checkout/link/{slug}/coupon"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://v4pay-api.vercel.app/checkout/link/{slug}/coupon")
.asString();require 'uri'
require 'net/http'
url = URI("https://v4pay-api.vercel.app/checkout/link/{slug}/coupon")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body{
"data": {
"code": "BEMVINDO10",
"type": "percent",
"value": 10,
"discount": 49.99,
"total": 449.91
}
}{
"error": {
"message": "<string>",
"codigo": "VALOR_MINIMO",
"valor_minimo": 5
}
}{
"error": {
"message": "<string>"
}
}Checkout (público)
Validar cupom no checkout do link
Rota pública: valida um cupom do dono do link e retorna o desconto e o total a pagar. O resgate só é contado quando a cobrança é paga.
GET
/
checkout
/
link
/
{slug}
/
coupon
Validar cupom no checkout do link
curl --request GET \
--url https://v4pay-api.vercel.app/checkout/link/{slug}/couponimport requests
url = "https://v4pay-api.vercel.app/checkout/link/{slug}/coupon"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://v4pay-api.vercel.app/checkout/link/{slug}/coupon', 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://v4pay-api.vercel.app/checkout/link/{slug}/coupon",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$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://v4pay-api.vercel.app/checkout/link/{slug}/coupon"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://v4pay-api.vercel.app/checkout/link/{slug}/coupon")
.asString();require 'uri'
require 'net/http'
url = URI("https://v4pay-api.vercel.app/checkout/link/{slug}/coupon")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body{
"data": {
"code": "BEMVINDO10",
"type": "percent",
"value": 10,
"discount": 49.99,
"total": 449.91
}
}{
"error": {
"message": "<string>",
"codigo": "VALOR_MINIMO",
"valor_minimo": 5
}
}{
"error": {
"message": "<string>"
}
}