API Reference
The NextGen Tech API is organized around REST. Our API has predictable resource-oriented URLs, accepts form-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs.
https://api.nextgen.tech/v1
Authentication
Authenticate your API requests by including your secret API key in the request header. You can manage your API keys in the Dashboard.
All API requests must be made over HTTPS. Calls made over plain HTTP will fail. API requests without authentication will also fail.
Official SDKs
While you can make direct HTTP requests to the NextGen API, we highly recommend using our official Server-side SDKs. They provide strongly-typed requests, automatic retries, and simplified error handling across multiple languages.
Node.js
npm install nextgen-node
Python
pip install nextgen-python
Ruby
gem install nextgen-ruby
PHP
composer require nextgen-php
Errors
NextGen uses conventional HTTP response codes to indicate the success or failure of an API request. In general, codes in the 2xx range indicate success. Codes in the 4xx range indicate an error that failed given the information provided (e.g., a required parameter was omitted, a charge failed, etc.). Codes in the 5xx range indicate an error with NextGen's servers.
HTTP Status Codes
Create a charge
To charge a credit card or other payment source, you create a Charge object. If your API key is in test mode, the supplied payment source (e.g., card) won't actually be charged.
Parameters
Required
Required
Optional
Webhooks
NextGen uses webhooks to notify your application when an event happens in your account. Webhooks are particularly useful for asynchronous events like when a customer's bank confirms a payment, a customer disputes a charge, or a recurring billing cycle succeeds.
Verifying Signatures
We include a NextGen-Signature header in every webhook request. You should verify this signature using your webhook endpoint's secret to ensure the event was actually sent by NextGen and not a third party.
Always use the raw request body when verifying signatures. If you are using frameworks like Express, ensure you use the raw body parser for your webhook route.
Create a customer
Creates a new customer object. You can optionally pass a source parameter to attach a payment source to the customer upon creation, making it easy to charge them later without requiring them to re-enter their card details.
Parameters
Optional
Optional
Optional
Create a refund
When you create a new refund, you must specify a charge on which to create it. Creating a new refund will refund a charge that has previously been created but not yet refunded. Funds will be refunded to the credit or debit card that was originally charged.
Parameters
Required
Optional
Optional
duplicate, fraudulent, or requested_by_customer.