Skip to main content

Chargent Order

Overview​

Chargent Orders contain information related to the order such as billing information, total amount, due balance, and charge amount. They are central objects to payments lifecycle management.

Order Types​

There are multiple types of Chargent Orders.

TypeDefinition
Recurring BillingRecurring Billing takes payment according to a schedule. Learn more about Recurring Billing
One-time PaymentThis order configuration may be used for processing payment an order one of more times.
CreditFor Payment Methods with bank account type, and a Chargent Order with a Credit Amount, credits may be sent to the bank account. Note: Must be supported by the Payment Gateway.

Order Fields​

Learn more about Chargent Order Fields.

Create Recurring Chargent Order​

Resource URL​

HTTP RequestURL
POST/services/apexrest/ChargentBase/orders/chargent-orders

Request List​

JSON Example
[
{
"title": "Chargent Order Test",
"paymentGatewayId": "{{gatewayId}}",
"amount": 5.00,
"paymentMethod": {
"id": "{{paymentMethodId}}"
},
"description": "Test Order",
"recurringBilling": {
"paymentFrequency": "Weekly",
"paymentStatus": "Recurring",
"paymentStop": "Count",
"paymentCount": 1,
"chargeDate": "02",
"paymentStartDate": "2023-06-15",
"paymentEndDate": ""
}
},
{
"title": "Chargent Order Test",
"paymentGatewayId": "{{gatewayId}}",
"amount": 5.00,
"paymentMethod": {
"id": "{{paymentMethodId}}"
},
"description": "Test Order",
"recurringBilling": {
"paymentFrequency": "Weekly",
"paymentStatus": "Recurring",
"paymentStop": "Count",
"paymentCount": 1,
"chargeDate": "02",
"paymentStartDate": "2023-06-15",
"paymentEndDate": ""
}
}
]

Response List​

JSON Example
{
"chargentOrdersResponse": {
"totalSuccess": 2,
"totalErrors": 0,
"records": [
{
"message": "Chargent Order 1 was created;",
"chargentOrderId": "{{orderId}}"
},
{
"message": "Test Order 2 was created;",
"chargentOrderId": "{{orderId}}"
}
],
"message": "Imported chargent orders successfully"
}
}

Create One-Time Chargent Order​

Resource URL​

HTTP RequestURL
POST/services/data/{{apiVersion}}/sobjects/ChargentOrders__ChargentOrder__c/

Request​

JSON Example
{
"ChargentOrders__Account__c": "{{accountId}}",
"ChargentOrders__Gateway__c" : "{{gatewayId}}",
"ChargentOrders__Charge_Amount__c": "100.00",
"ChargentOrders__Manual_Charge__c" : true
}

Response​

JSON Example
{
"id": "{{orderId}}",
"success": true,
"errors": []
}

Create Credit Chargent Order​

Resource URL​

HTTP RequestURL
POST/services/data/{{apiVersion}}/sobjects/ChargentOrders__ChargentOrder__c/

Request​

JSON Example
{
"ChargentOrders__Account__c": "{{accountId}}",
"ChargentOrders__Gateway__c" : "{{gatewayId}}",
"ChargentOrders__Credit_Amount__c": "100.00",
"ChargentOrders__Currency__c" : 'USD',
"ChargentOrders__Payment_Descriptor__c" : 'Chargent Test Credit Order'
}

Response​

JSON Example
{
"id": "{{orderId}}",
"success": true,
"errors": []
}

JSForce Example​

Node.js Example
function createChargentOrder(conn, accountId, paymentMethodId) {

const relativeUrl = "/services/data/v54.0/sobjects/ChargentOrders__ChargentOrder__c/"

var chargentOrder = {
ChargentOrders__Account__c: accountId,
ChargentOrders__Payment_Method_Default__c: paymentMethodId,
ChargentOrders__Charge_Amount__c: "100.00",
ChargentOrders__Manual_Charge__c: true,
}
console.log(JSON.stringify(chargentOrder))

return new Promise((resolve, reject) => {
conn.request({
method: 'POST',
url: relativeUrl,
body: JSON.stringify(chargentOrder),
headers: { 'Content-Type': 'application/json' }
}, function(error, result) {
if (error) {
reject(error)
} else {
resolve(result)
}
})
})
}

module.exports = createChargentOrder

Learn More​

Learn more about Chargent Orders.