Demo¶
This guide walks through a complete integration test using the development environment: creating a payment link, triggering a payment, and receiving the webhook and callback notifications.
Prerequisites¶
- A development API key (use the demo key
u06AuLfBhQdQDtYGVcbGQtUNgIO1wrFNor contact support for your own). - A publicly reachable URL for your webhook/callback (use webhook.site or ngrok for local testing).
Step 1 — Configure Your Endpoints¶
In your SecPaid account settings:
- Set your Callback URL to your test URL (e.g.
https://webhook.site/your-unique-id). - Set your Payment Endpoint to the same or a different test URL.
- Save and re-login to apply the changes.
Step 2 — Create a Payment Link¶
curl --location 'https://app.dev.secpaid.com/api/v2/createLink' \
--header 'token: u06AuLfBhQdQDtYGVcbGQtUNgIO1wrFN' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'amount=10.00' \
--data-urlencode 'recipient_note=Demo payment test'
The response contains pay_link — open this URL in a browser.
Step 3 — Complete or Cancel the Demo Payment¶
On the payment page you will see a Stripe sandbox checkout. Use a test card to authorize the payment, or press Cancel.
Step 4 — Inspect the Notifications¶
Callback URL receives a browser redirect with query parameters:
https://your-test-url.com?pay_id=1466&user_id=<your-user-id>&status=success
Payment Endpoint receives a POST with a JSON body:
{
"ResponseCode": 1,
"data[pay_id]": 1466,
"data[amount]": 10,
"data[user_id]": "<your-user-id>",
"data[status]": "success"
}
For a cancellation, data[Status] is "cancel".
Step 5 — Verify via API¶
Cross-check the payment status using getPayInTransactions:
curl --location 'https://app.dev.secpaid.com/api/v2/getPayInTransactions' \
--header 'token: u06AuLfBhQdQDtYGVcbGQtUNgIO1wrFN' \
--data-urlencode 'pay_id=1466'
Key Points¶
- The Callback URL is a browser redirect — the customer must complete the redirect for it to fire.
- The Payment Endpoint is a direct server-to-server POST — more reliable for business logic.
- Always use
getPayInTransactionsto confirm payment status in critical flows. - The demo key does not process real money.