Quickstart
Get started with RevKeen in under 5 minutes
This guide will walk you through the essential steps to start accepting payments with RevKeen. By the end, you will have created a customer, product, and checkout session.
1. Get Your API Key
First, you will need an API key to authenticate your requests. You can find your API keys in the RevKeen dashboard.
Go to Settings
Navigate to Settings > API Keys in your dashboard.
Copy your key
Copy your rk_live_* or rk_test_* key.
Store securely
Store your API key in an environment variable -- never commit it to version control.
Use rk_test_* keys for development and rk_live_* keys for production.
2. Make Your First API Call
Test your API key by listing customers. If you are new, this will return an empty list.
curl -X GET "https://api.revkeen.com/v1/customers" \
-H "Authorization: Bearer rk_test_your_api_key"import RevKeen from '@revkeen/sdk';
const client = new RevKeen({
apiKey: process.env.REVKEEN_API_KEY,
});
const customers = await client.customers.list();
console.log(customers.data);from revkeen import RevKeen
import os
client = RevKeen(api_key=os.environ["REVKEEN_API_KEY"])
customers = client.customers.list()
print(customers.data)3. Create a Customer
Customers are the core of your billing operations. Create one with at least an email address.
curl -X POST "https://api.revkeen.com/v1/customers" \
-H "Authorization: Bearer rk_test_your_api_key" \
-H "Content-Type: application/json" \
-d '{
"email": "john@example.com",
"name": "John Doe",
"companyName": "Acme Inc"
}'const customer = await client.customers.create({
email: 'john@example.com',
name: 'John Doe',
companyName: 'Acme Inc',
});
console.log(customer.data.id); // cus_xxxxxxxxcustomer = client.customers.create(
email="john@example.com",
name="John Doe",
company_name="Acme Inc"
)
print(customer.data.id) # cus_xxxxxxxx4. Create a Product
Define what you are selling. Products can be one-time purchases or recurring subscriptions.
curl -X POST "https://api.revkeen.com/v1/products" \
-H "Authorization: Bearer rk_test_your_api_key" \
-H "Content-Type: application/json" \
-d '{
"productId": "pro_monthly",
"name": "Pro Plan",
"kind": "subscription",
"pricingModel": "recurring",
"amountMinor": 2900,
"currency": "USD",
"interval": "month",
"intervalCount": 1
}'const product = await client.products.create({
productId: 'pro_monthly',
name: 'Pro Plan',
kind: 'subscription',
pricingModel: 'recurring',
amountMinor: 2900, // $29.00
currency: 'USD',
interval: 'month',
intervalCount: 1,
});
console.log(product.data.id); // prod_xxxxxxxxproduct = client.products.create(
product_id="pro_monthly",
name="Pro Plan",
kind="subscription",
pricing_model="recurring",
amount_minor=2900, # $29.00
currency="USD",
interval="month",
interval_count=1
)
print(product.data.id) # prod_xxxxxxxx5. Create a Checkout Session
Checkout Sessions provide a hosted payment page. Redirect your customer to complete payment.
curl -X POST "https://api.revkeen.com/v1/checkout/sessions" \
-H "Authorization: Bearer rk_test_your_api_key" \
-H "Content-Type: application/json" \
-d '{
"customerId": "cus_xxxxxxxx",
"lineItems": [
{
"productId": "prod_xxxxxxxx",
"quantity": 1
}
],
"successUrl": "https://yourapp.com/success",
"cancelUrl": "https://yourapp.com/cancel"
}'const session = await client.checkout.sessions.create({
customerId: customer.data.id,
lineItems: [
{
productId: product.data.id,
quantity: 1,
},
],
successUrl: 'https://yourapp.com/success',
cancelUrl: 'https://yourapp.com/cancel',
});
// Redirect to session.data.urlsession = client.checkout.sessions.create(
customer_id=customer.data.id,
line_items=[
{"product_id": product.data.id, "quantity": 1}
],
success_url="https://yourapp.com/success",
cancel_url="https://yourapp.com/cancel"
)
# Redirect to session.data.url6. Set Up Webhooks
Webhooks notify your application when events occur. Set up an endpoint to handle payment confirmations.
curl -X POST "https://api.revkeen.com/v1/webhooks" \
-H "Authorization: Bearer rk_test_your_api_key" \
-H "Content-Type: application/json" \
-d '{
"url": "https://yourapp.com/webhooks/revkeen",
"events": [
"checkout.session.completed",
"invoice.paid",
"subscription.created"
]
}'const webhook = await client.webhooks.create({
url: 'https://yourapp.com/webhooks/revkeen',
events: [
'checkout.session.completed',
'invoice.paid',
'subscription.created',
],
});
// Store webhook.data.secret securely for verificationwebhook = client.webhooks.create(
url="https://yourapp.com/webhooks/revkeen",
events=[
"checkout.session.completed",
"invoice.paid",
"subscription.created"
]
)
# Store webhook.data.secret securely for verificationNext Steps
- Authentication -- Learn about API key scopes and security best practices
- Webhooks -- Handle webhook events and verify signatures
- Subscriptions -- Manage recurring billing with subscriptions
- API Reference -- Explore the complete API documentation