SDK
API ReferenceSdkServer Setup
Server Setup
Create a payment on your server to get a client secret for the SDK.
Step 1: Create a Payment Intent
Create a payment with confirm: false on your server:
curl -X POST 'https://api.v2.paychtec.com/payments' \ -H "Content-Type: application/json" \ -H "api-key: snd_YOUR_API_KEY" \ -d '{ "amount": 5000, "currency": "USD", "profile_id": "YOUR_PROFILE_ID", "confirm": false}'Step 2: Return the Client Secret
The response includes a client_secret — pass this to your frontend:
{
"payment_id": "pay_1234567890abcdef",
"client_secret": "pay_1234_secret_abcdef...",
"status": "requires_payment_method"
}Step 3: Server Endpoint Example
app.post('/create-payment', async (req, res) => {const { amount, currency } = req.body;const response = await fetch('https://api.v2.paychtec.com/payments', { method: 'POST', headers: { 'Content-Type': 'application/json', 'api-key': process.env.API_KEY, }, body: JSON.stringify({ amount, currency, profile_id: process.env.PROFILE_ID, confirm: false, }),});const payment = await response.json();res.json({ clientSecret: payment.client_secret });});