curl --request POST \
--url https://api.eddy.engineer/hooks/payments/{provider} \
--header 'Content-Type: application/json' \
--header 'Stripe-Signature: <stripe-signature>' \
--data '{}'import requests
url = "https://api.eddy.engineer/hooks/payments/{provider}"
payload = {}
headers = {
"Stripe-Signature": "<stripe-signature>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Stripe-Signature': '<stripe-signature>', 'Content-Type': 'application/json'},
body: JSON.stringify({})
};
fetch('https://api.eddy.engineer/hooks/payments/{provider}', 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.eddy.engineer/hooks/payments/{provider}",
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([
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"Stripe-Signature: <stripe-signature>"
],
]);
$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.eddy.engineer/hooks/payments/{provider}"
payload := strings.NewReader("{}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Stripe-Signature", "<stripe-signature>")
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.eddy.engineer/hooks/payments/{provider}")
.header("Stripe-Signature", "<stripe-signature>")
.header("Content-Type", "application/json")
.body("{}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.eddy.engineer/hooks/payments/{provider}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Stripe-Signature"] = '<stripe-signature>'
request["Content-Type"] = 'application/json'
request.body = "{}"
response = http.request(request)
puts response.read_body{
"granted": [
{}
],
"ignored": "<string>",
"received": true,
"refused": [
"<string>"
]
}{
"error": {
"code": "INVALID_GEOMETRY",
"message": "<string>"
}
}{
"error": {
"code": "INVALID_GEOMETRY",
"message": "<string>"
}
}{
"error": {
"code": "INVALID_GEOMETRY",
"message": "<string>"
}
}The payment provider's signed webhook (CR4)
Called by the provider (Stripe), not by people. The Stripe-Signature header (t=<unix>,v1=<hex HMAC-SHA256 of "<t>.<raw body>" under the endpoint secret>) is verified over the raw body, the timestamp within 300 s, before anything is read; an unsigned, mis-signed or stale event is refused 400 PAYMENT_WEBHOOK_INVALID. A paid checkout (checkout.session.completed / async_payment_succeeded) or a paid auto top-up invoice (invoice.paid) the engine itself opened grants its credits into the ledger once, keyed by the payment: a replayed event, or a second event about the same payment, grants nothing more. The subtotal before tax must equal the credits’ price in cents, or nothing is granted. payment_intent.succeeded with a card saved off-session records the method for auto top-up; invoice.payment_failed turns auto top-up off. A grant the ledger or the store cannot take now is answered 503 PAYMENT_GRANT_RETRY, so the provider delivers the event again (the grant is idempotent by the payment); one that can never land (the amount, the account) is answered 200 with the reason. Other events are acknowledged. 404 PAYMENTS_UNCONFIGURED for a provider this deployment does not have.
curl --request POST \
--url https://api.eddy.engineer/hooks/payments/{provider} \
--header 'Content-Type: application/json' \
--header 'Stripe-Signature: <stripe-signature>' \
--data '{}'import requests
url = "https://api.eddy.engineer/hooks/payments/{provider}"
payload = {}
headers = {
"Stripe-Signature": "<stripe-signature>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Stripe-Signature': '<stripe-signature>', 'Content-Type': 'application/json'},
body: JSON.stringify({})
};
fetch('https://api.eddy.engineer/hooks/payments/{provider}', 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.eddy.engineer/hooks/payments/{provider}",
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([
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"Stripe-Signature: <stripe-signature>"
],
]);
$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.eddy.engineer/hooks/payments/{provider}"
payload := strings.NewReader("{}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Stripe-Signature", "<stripe-signature>")
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.eddy.engineer/hooks/payments/{provider}")
.header("Stripe-Signature", "<stripe-signature>")
.header("Content-Type", "application/json")
.body("{}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.eddy.engineer/hooks/payments/{provider}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Stripe-Signature"] = '<stripe-signature>'
request["Content-Type"] = 'application/json'
request.body = "{}"
response = http.request(request)
puts response.read_body{
"granted": [
{}
],
"ignored": "<string>",
"received": true,
"refused": [
"<string>"
]
}{
"error": {
"code": "INVALID_GEOMETRY",
"message": "<string>"
}
}{
"error": {
"code": "INVALID_GEOMETRY",
"message": "<string>"
}
}{
"error": {
"code": "INVALID_GEOMETRY",
"message": "<string>"
}
}