Revenue
Payments API
On this page
Use this for a custom payment system. Stripe and RevenueCat connectors already send their supported payments, so choose one path per purchase.
Send a payment
Set your secret key on the server
Store the site secret as
METRICRAVEN_SECRET_KEY. Call this API only from your backend.POST the payment after it succeeds
terminalcurl --request POST 'https://metricraven.com/api/v1/payments' \ --header "Authorization: Bearer $METRICRAVEN_SECRET_KEY" \ --header 'Content-Type: application/json' \ --data '{ "amount": 29, "currency": "USD", "transaction_id": "order_123", "visitor_id": "0123456789abcdef0123456789abcdef", "user_id": "user_42", "plan": "pro", "renewal": false }'amountis in major currency units:29means $29, not 29 cents. Include the three-letter currency, a unique transaction ID, and a visitor ID or a previously identified user ID for attribution.
Verify it works
The payment appears in Revenue when you select its currency. Repeat deliveries with the same transaction ID don't add a second payment.
Record a refund
Send the original transaction ID with refunded: true and the cumulative amount refunded. For example, a $10 refund followed by another $5 refund means sending amount: 15 on the second request.
curl --request POST 'https://metricraven.com/api/v1/payments' \
--header "Authorization: Bearer $METRICRAVEN_SECRET_KEY" \
--header 'Content-Type: application/json' \
--data '{
"amount": 10,
"currency": "USD",
"transaction_id": "order_123",
"refunded": true
}'Details
- The visitor ID comes from
window.analytics.getVisitorId()in the buyer's browser; pass it through your checkout to your backend.