Skip to main content

Payment Sale

Overview

A payment sale will result in a bank account debit for payment methods with bank account type, and a credit card authorization and capture for payment methods with credit card type.

Prerequisite Resources

There are multiple prerequisite resources depending on the call method that must be created before requesting a payment sale.

           Object           Definition
AccountSalesforce standard Account object.
Chargent OrderChargent Orders are central objects to payments lifecycle management.
Payment MethodPayment Methods are instruments that may be used to make or take payment.
Payment GatewayPayment Gateways track all the configuration settings that Chargent will use to proccess the payments and send requests to the gateway.

Create Methods

There are multiple methods available using input data to create a payment sale. A payment gateway must exist for all create payment sale methods.

PrerequisitesInputOutput
Chargent Order, Payment Method (Assigned)chargentOrderIDChargent Transaction
Chargent OrderchargentOrderID, paymentGatewayIdPayment Method Tokenization, Chargent Transaction
Chargent Order, Payment MethodchargentOrderID, paymentMethodId, paymentGatewayIdChargent Transaction
Chargent Order, Payment MethodchargentOrderID, paymentMethodIdChargent Transaction
AccountaccountId, paymentGatewayIdPayment Method Tokenization, Chargent Transaction
Account, Payment MethodaccountId, paymentMethodId, paymentGatewayIdChargent Transaction

Transaction Fields

Learn more about Chargent Transaction Fields.

Create Payment Sale

Resource URL

HTTP RequestURL
POST/services/apexrest/ChargentBase/payments/sales

chargentOrderId

Request

JSON Example
{
"amount": 800.00, // optional
"chargentOrderId": "{{orderId}}"
}

Response

JSON Example
{
"logs": [],
"gatewayResponse": {
"gatewayToken": "{{token}}",
"gatewayResultCodeDescription": "",
"gatewayResultCode": "200",
"gatewayMessage": "",
"gatewayDate": "2023-12-07T17:23:13.380Z",
"gatewayAuthorizationCode": "{{authCode}}"
},
"payment": {
"status": "Approved",
"requestDate": "2023-12-07T17:23:13.379Z",
"id": "{{transactionId}}",
"effectiveDate": "2023-12-07T17:23:13.379Z",
"chargentOrderId": "{{orderId}}",
"amount": 800.0
}
}

chargentOrderId, paymentGatewayId

Request

JSON Example
{
"amount": 900.00, // optional
"chargentOrderId": "{{orderId}}",
"paymentGatewayId": "{{gatewayId}}",
"paymentMethod": {
"address": { // optional
"city": "San Francisco",
"companyName": "AppFrontier",
"country": "USA",
"postalcode": "94105",
"state": "California",
"street": "415 Mission Street"
},
"cardPaymentMethod": {
"cardHolderFirstName": "Chargent",
"cardHolderLastName": "Sale Test",
"cardNumber": "{{cardNumber}}",
"cardType": "{{cardType}}",
"cvv": "{{cvv}}",
"expiryMonth": "{{expiryMonth}}",
"expiryYear": "{{expiryYear}}"
}
},
"email": "{{$randomEmail}}", // optional
"phone": "{{$randomPhoneNumber}}" // optional
}

Response

JSON Example
{
"paymentMethod": {
"tokens": [
{
"token": "{{token}}",
"id": "{{tokenId}}",
"gatewayId": "{{gatewayId}}"
}
],
"status": "Created",
"id": "{{paymentMethodId}}"
},
"logs": [
{
"interactionStatus": "APPROVED",
"id": "{{logId}}",
"gatewayResultCode": "200",
"gatewayId": "{{gatewayId}}",
"createdDate": "2023-12-07T17:27:28.000Z"
}
],
"gatewayResponse": {
"gatewayToken": "{{token}}",
"gatewayResultCodeDescription": "",
"gatewayResultCode": "200",
"gatewayMessage": "",
"gatewayDate": "2023-12-07T17:27:29.557Z",
"gatewayAuthorizationCode": "{{authCode}}"
},
"payment": {
"status": "Approved",
"requestDate": "2023-12-07T17:27:29.557Z",
"id": "{{transactionId}}",
"effectiveDate": "2023-12-07T17:27:29.557Z",
"chargentOrderId": "{{orderId}}",
"amount": 900.0
}
}

chargentOrderId, paymentMethodId, paymentGatewayId

Request

JSON Example
{
"amount": 1000.00, // optional
"chargentOrderId": "{{orderId}}",
"paymentMethod": {
"id": "{{paymentMethodId}}"
},
"paymentGatewayId": "{{gatewayId}}"
}

Response

JSON Example
{
"paymentMethod": {
"tokens": [
{
"token": "{{token}}",
"id": "{{tokenId}}",
"gatewayId": "{{gatewayId}}"
}
],
"status": "Applied",
"id": "{{paymentMethodId}}"
},
"logs": [
{
"interactionStatus": "APPROVED",
"id": "{{logId}}",
"gatewayResultCode": "200",
"gatewayId": "{{gatewayId}}",
"createdDate": "2023-12-07T18:53:17.000Z"
}
],
"gatewayResponse": {
"gatewayToken": "{{token}}",
"gatewayResultCodeDescription": "",
"gatewayResultCode": "200",
"gatewayMessage": "",
"gatewayDate": "2023-12-07T18:53:17.858Z",
"gatewayAuthorizationCode": "1701975196"
},
"payment": {
"status": "Approved",
"requestDate": "2023-12-07T18:53:17.858Z",
"id": "{{transactionId}}",
"effectiveDate": "2023-12-07T18:53:17.858Z",
"chargentOrderId": "{{orderId}}",
"amount": 1000.0
}
}

chargentOrderId, paymentMethodId

Request

JSON Example
{
"amount": 1100, // optional
"chargentOrderId": "{{orderId}}",
"paymentMethod": {
"id": "{{paymentMethodId}}"
}
}

Response

JSON Example
{
"paymentMethod": {
"tokens": [
{
"token": "{{token}}",
"id": "{{tokenId}}",
"gatewayId": "{{gatewayId}}"
}
],
"status": "Applied",
"id": "{{paymentMethodId}}"
},
"logs": [
{
"interactionStatus": "APPROVED",
"id": "{{logId}}",
"gatewayResultCode": "200",
"gatewayId": "{{gatewayId}}",
"createdDate": "2023-12-07T19:28:21.000Z"
}
],
"gatewayResponse": {
"gatewayToken": "{{token}}",
"gatewayResultCodeDescription": "",
"gatewayResultCode": "200",
"gatewayMessage": "",
"gatewayDate": "2023-12-07T19:28:21.901Z",
"gatewayAuthorizationCode": "{{authCode}}"
},
"payment": {
"status": "Approved",
"requestDate": "2023-12-07T19:28:21.901Z",
"id": "{{transactionId}}",
"effectiveDate": "2023-12-07T19:28:21.901Z",
"chargentOrderId": "{{orderId}}",
"amount": 1100.0
}
}

accountId, paymentGatewayId

Request

JSON Example
{
"accountId": "{{accountId}}",
"amount": 1200.00,
"comments": "Sale for $1,200.00.",
"paymentGatewayId": "{{gatewayId}}",
"paymentMethod": {
"address": { // optional
"city": "San Francisco",
"companyName": "AppFrontier",
"country": "USA",
"postalcode": "94105",
"state": "California",
"street": "415 Mission Street"
},
"cardPaymentMethod": {
"cardHolderFirstName": "Chargent",
"cardHolderLastName": "Sale Test",
"cardNumber": "{{cardNumber}}",
"cardType": "{{cardType}}",
"cvv": "{{cvv}}",
"expiryMonth": "{{expiryMonth}}",
"expiryYear": "{{expiryYear}}"
}
},
"email": "{{$randomEmail}}", // optional
"phone": "{{$randomPhoneNumber}}" // optional
}

Response

JSON Example
{
"paymentMethod": {
"tokens": [
{
"token": "{{token}}",
"id": "{{tokenId}}",
"gatewayId": "{{gatewayId}}"
}
],
"status": "Created",
"id": "{{paymentMethodId}}",
"accountId": "{{accountId}}"
},
"logs": [
{
"interactionStatus": "APPROVED",
"id": "{{logId}}",
"gatewayResultCode": "200",
"gatewayId": "{{gatewayId}}",
"createdDate": "2023-12-07T19:43:47.000Z"
}
],
"gatewayResponse": {
"gatewayToken": "{{token}}",
"gatewayResultCodeDescription": "",
"gatewayResultCode": "200",
"gatewayMessage": "",
"gatewayDate": "2023-12-07T19:43:47.838Z",
"gatewayAuthorizationCode": "{{authCode}}"
},
"payment": {
"status": "Approved",
"requestDate": "2023-12-07T19:43:47.838Z",
"id": "{{transactionId}}",
"effectiveDate": "2023-12-07T19:43:47.838Z",
"chargentOrderId": "{{orderId}}",
"amount": 1200.0,
"accountId": "{{accountId}}"
}
}

accountId, paymentMethodId, paymentGatewayId

Request

JSON Example
{
"accountId": "{{accountId}}",
"amount": 1300.00,
"comments": "Sale for $1,300.00.",
"paymentMethod": {
"id": "{{paymentMethodId}}"
},
"paymentGatewayId": "{{gatewayId}}"
}

Response

JSON Example
{
"paymentMethod": {
"tokens": [
{
"token": "{{token}}",
"id": "{{tokenId}}",
"gatewayId": "{{gatewayId}}"
}
],
"status": "Applied",
"id": "{{paymentMethodId}}",
"accountId": "{{accountId}}"
},
"logs": [
{
"interactionStatus": "APPROVED",
"id": "{{logId}}",
"gatewayResultCode": "200",
"gatewayId": "{{gatewayId}}",
"createdDate": "2023-12-07T19:48:27.000Z"
}
],
"gatewayResponse": {
"gatewayToken": "{{token}}",
"gatewayResultCodeDescription": "",
"gatewayResultCode": "200",
"gatewayMessage": "",
"gatewayDate": "2023-12-07T19:48:27.489Z",
"gatewayAuthorizationCode": "{{authCode}}"
},
"payment": {
"status": "Approved",
"requestDate": "2023-12-07T19:48:27.489Z",
"id": "{{transactionId}}",
"effectiveDate": "2023-12-07T19:48:27.489Z",
"chargentOrderId": "{{orderId}}",
"amount": 1300.0,
"accountId": "{{accountId}}"
}
}

Headless Sale

Headless mode may be used with all of the create payment sale methods. When in headless mode Chargent will not store any of the data that results from the request to the payment gateway in Salesforce.

HTTP Header

HTTP HeaderValue
Chargent-Headlesstrue

chargentOrderId

Request

JSON Example
{
"amount": 800, // optional
"chargentOrderId": "{{orderId}}"
}

Response

JSON Example
{
"logs": [],
"gatewayResponse": {
"gatewayToken": "{{token}}",
"gatewayResultCodeDescription": "",
"gatewayResultCode": "200",
"gatewayMessage": "",
"gatewayDate": "2023-12-07T19:58:29.664Z",
"gatewayAuthorizationCode": "{{authCode}}"
}
}

chargentOrderId, paymentGatewayId

Request

JSON Example
{
"amount": "900", // optional
"chargentOrderId": "{{orderId}}",
"paymentGatewayId": "{{gatewayId}}",
"paymentMethod": {
"address": {
"city": "San Francisco",
"companyName": "AppFrontier",
"country": "USA",
"postalcode": "94105",
"state": "California",
"street": "415 Mission Street"
},
"cardPaymentMethod": {
"cardHolderFirstName": "Chargent",
"cardHolderLastName": "Sale Test",
"cardNumber": "{{cardNumber}}",
"cardType": "{{cardType}}",
"cvv": "{{cvv}}",
"expiryMonth": "{{expiryMonth}}",
"expiryYear": "{{expiryYear}}"
}
},
"email": "{{$randomEmail}}", // optional
"phone": "{{$randomPhoneNumber}}" // optional
}

Response

JSON Example
{
"logs": [],
"gatewayResponse": {
"gatewayToken": "{{token}}",
"gatewayResultCodeDescription": "",
"gatewayResultCode": "200",
"gatewayMessage": "",
"gatewayDate": "2023-12-07T20:10:49.824Z",
"gatewayAuthorizationCode": "{{authCode}}"
}
}

chargentOrderId, paymentMethodId, paymentGatewayId

Request

JSON Example
{
"amount": "1000.00", // optional
"chargentOrderId": "{{orderId}}",
"paymentMethod": {
"id": "{{paymentMethodId}}"
},
"paymentGatewayId": "{{gatewayId}}"
}

Response

JSON Example
{
"logs": [],
"gatewayResponse": {
"gatewayToken": "{{token}}",
"gatewayResultCodeDescription": "",
"gatewayResultCode": "200",
"gatewayMessage": "",
"gatewayDate": "2023-12-07T20:11:30.276Z",
"gatewayAuthorizationCode": "{{authCode}}"
}
}

chargentOrderId, paymentMethodId

Request

JSON Example
{
"amount": 1100, // optional
"chargentOrderId": "{{orderId}}",
"paymentMethod": {
"id": "{{paymentMethodId}}"
}
}

Response

JSON Example
{
"logs": [],
"gatewayResponse": {
"gatewayToken": "{{token}}",
"gatewayResultCodeDescription": "",
"gatewayResultCode": "200",
"gatewayMessage": "",
"gatewayDate": "2023-12-07T20:12:10.496Z",
"gatewayAuthorizationCode": "{{authCode}}"
}
}

accountId, paymentGatewayId

Request

JSON Example
{
"accountId": "{{accountId}}",
"amount": 1200,
"comments": "Sale for $1,200",
"paymentGatewayId": "{{gatewayId}}",
"paymentMethod": {
"address": {
"city": "San Francisco",
"companyName": "AppFrontier",
"country": "USA",
"postalcode": "94105",
"state": "California",
"street": "415 Mission Street"
},
"cardPaymentMethod": {
"cardHolderFirstName": "Chargent",
"cardHolderLastName": "Authorization Test",
"cardNumber": "{{cardNumber}}",
"cardType": "{{cardType}}",
"cvv": "{{cvv}}",
"expiryMonth": "{{expiryMonth}}",
"expiryYear": "{{expiryYear}}"
}
},
"email": "{{$randomEmail}}", // optional
"phone": "{{$randomPhoneNumber}}" // optional
}

Response

JSON Example
{
"logs": [],
"gatewayResponse": {
"gatewayToken": "{{token}}",
"gatewayResultCodeDescription": "",
"gatewayResultCode": "200",
"gatewayMessage": "",
"gatewayDate": "2023-12-07T20:12:43.100Z",
"gatewayAuthorizationCode": "{{authCode}}"
}
}

accountId, paymentMethodId, paymentGatewayId

Request

JSON Example
{
"accountId": "{{accountId}}",
"amount": 1300,
"comments": "Sale for $1,300",
"paymentMethod": {
"id": "{{paymentMethodId}}"
},
"paymentGatewayId": "{{gatewayId}}"
}

Response

JSON Example
{
"logs": [],
"gatewayResponse": {
"gatewayToken": "{{token}}",
"gatewayResultCodeDescription": "",
"gatewayResultCode": "200",
"gatewayMessage": "",
"gatewayDate": "2023-12-07T20:13:10.872Z",
"gatewayAuthorizationCode": "{{authCode}}"
}
}