Payment API
Track and attribute revenue from any payment provider using Faurya's Payment API. Perfect for custom payment solutions or unsupported providers.
If you have connected your payment provider, you don't need this endpoint: Faurya already records those payments, and sending them here too would count them twice.
Attribute revenue with custom payment providers
Use Faurya's Payment API to record payments and attribute revenue to your customers and traffic sources. Payments sent through the API appear in your revenue reports and dashboards exactly like payments from a connected provider.
Send amounts in the currency the customer paid; Faurya converts them for reporting.
How it works
When you receive a successful payment, make an API call to Faurya's Payment API. That's it!
// Send payment data to Faurya's API
await fetch("https://api.faurya.com/api/v1/payments", {
method: "POST",
headers: {
Authorization: `Bearer ${FAURYA_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
transaction_id: "txn_98hj",
amount: 29.99,
currency: "USD",
customer_id: user.id, // your own user id
email: user.email,
faurya_visitor_id: request.cookies.faurya_visitor_id,
}),
});Here's a recommended flow:
- Capture Faurya's visitor ID, a unique identifier for each visitor, from the cookie
faurya_visitor_id. Store it with your user, or pass it to your payment provider when creating checkout sessions (metadata). - Send payment data to Faurya using our Payment API when you receive a successful payment (your webhook handler, a success page, etc.). Include your own
customer_idevery time: it keeps all of one user's payments on one customer, including renewals charged without a browser session.
For more details, see the Payment API documentation.