Transaction Examples: Sale

Sale

A Sale transaction is used by merchants for the immediate purchase of goods or services. This transaction completes both the authorization and capture in a single transaction request. The Sale transaction is an Authorization and Capture transaction that, if approved, is automatically included in the open batch for settlement.

Request sample with all fields

XML

JSON

{
"type":"SALE",
"card": "4111111111111111",
"amount": "1.00",
"csc": "999",
"exp-date": "1215",
"purchase-order": "124",
"invoice": "457",
"email-address": "abc@abcdef.com",
"customer-id": "789",
"order-id": "140",
"client-ip": "192.168.1.1",
"description": "A small boat",
"comments": "Handle with care.",
"billing":{
"first-name": "John",
"last-name": "Smith",
"company": "Smith Enterprises",
"street": "100 Industrial Drive",
"street2": "Suite 1",
"city": "Albany",
"state": "NY",
"zip": "12222",
"country": "USA",
"phone": "5184567788"
},
"billing-is-shipping": "false",
"shipping":{
"first-name": "Mary",
"last-name": "Smith",
"company": "Smith Garden Supplies",
"street": "500 Garden Drive",
"street2": "Suite 5",
"city": "Albany",
"state": "NY",
"zip": "12222",
"country": "USA",
"phone": "5181234444"
}
}

PHP (JSON)

https://github.com/Clearent-Gateway/API-Examples/tree/php

Python (JSON)

https://github.com/Clearent-Gateway/API-Examples/tree/python

Go (XML)

https://github.com/Clearent-Gateway/API-Examples/tree/go

C# (JSON)

https://github.com/Clearent-Gateway/API-Examples/tree/C#

Java (JSON)

https://github.com/Clearent-Gateway/API-Examples/tree/java

VB.net (JSON)

https://github.com/Clearent-Gateway/API-Examples/tree/vbnet

Response sample with all fields

XML

JSON

{ "code": "200", "status": "success", "exchange-id": "ID-CLADEVDOCKER-smx01-39717-1418080195075-1-2549", "payload": { "transaction": { "amount": "1.00", "id": "111058", "invoice": "457", "description": "A small boat", "comments": "Handle with care.", "type": "SALE", "result": "Approved", "billing": { "company": "Smith Enterprises", "street": "100 Industrial Drive", "street2": "Suite 1", "city": "Albany", "state": "NY", "zip": "12222", "country": "USA", "phone": "5184567788", "first-name": "John", "last-name": "Smith" }, "shipping": { "company": "Smith Garden Supplies", "street": "500 Garden Drive", "street2": "Suite 5", "city": "Albany", "state": "NY", "zip": "12222", "country": "USA", "phone": "5181234444", "first-name": "Mary", "last-name": "Smith" }, "card": "XXXXXXXXXXXX1111", "csc": "999", "authorization-code": "TAS371", "avs-result-code": "N", "batch-string-id": "297", "order-id": "140", "purchase-order": "124", "customer-id": "789", "email-address": "abc@abcdef.com", "display-message": "Transaction approved", "result-code": "0000", "billing-is-shipping": "false", "exp-date": "1215", "client-ip": "192.168.1.1" }, "payloadType": "transaction" }, "links": [ { "rel": "transaction", "href": "/rest/v2/transactions?id=111058", "id": "111058" } ] }

Sale Approved

Sale Request with minimal fields.

XML

JSON

{ "type":"SALE", "card": "4111111111111111", "exp-date": "1219", "amount": "25.00" }

PHP (JSON)

https://github.com/Clearent-Gateway/API-Examples/tree/php

Python (JSON)

https://github.com/Clearent-Gateway/API-Examples/tree/python

Go (XML)

https://github.com/Clearent-Gateway/API-Examples/tree/go

C# (JSON)

https://github.com/Clearent-Gateway/API-Examples/tree/C#

Java (JSON)

https://github.com/Clearent-Gateway/API-Examples/tree/java

VB.net (JSON)

https://github.com/Clearent-Gateway/API-Examples/tree/vbnet

Sale Response.

XML

JSON

{ "code": "200", "status": "success", "exchange-id": "ID-CLADEVDOCKER-smx01-39717-1418080195075-1-2513", "payload": { "transaction": { "amount": "25.00", "id": "111054", "type": "SALE", "result": "Approved", "card": "XXXXXXXXXXXX1111", "authorization-code": "TAS215", "batch-string-id": "297", "display-message": "Transaction approved", "result-code": "0000", "exp-date": "1219" }, "payloadType": "transaction" }, "links": [ { "rel": "transaction", "href": "/rest/v2/transactions?id=111054", "id": "111054" } ] }

Sale Declined

Sale Declined Request.

XML

JSON

{ "type":"SALE", "card": "4111111111111111", "exp-date": "1212", "amount": "25.00" }

PHP (JSON)

https://github.com/Clearent-Gateway/API-Examples/tree/php

Python (JSON)

https://github.com/Clearent-Gateway/API-Examples/tree/python

Go (XML)

https://github.com/Clearent-Gateway/API-Examples/tree/go

C# (JSON)

https://github.com/Clearent-Gateway/API-Examples/tree/C#

Java (JSON)

https://github.com/Clearent-Gateway/API-Examples/tree/java

VB.net (JSON)

https://github.com/Clearent-Gateway/API-Examples/tree/vbnet

Sale Declined Response.

XML

JSON

{ "code": "402", "status": "fail", "exchange-id": "ID-CLADEVDOCKER-smx01-39717-1418080195075-1-2525", "payload": { "transaction": { "amount": "0.20", "id": "111056", "type": "SALE", "result": "Declined", "card": "XXXXXXXXXXXX1111", "display-message": "Transaction Declined by Card Issuer", "result-code": "1800", "exp-date": "1215" }, "error": { "error-message": "Declined , DECLINED", "result-code": "023" }, "payloadType": "error" }, "links": [ { "rel": "transaction", "href": "/rest/v2/transactions?id=111056", "id": "111056" } ] }

Sale Error

Sale Error Request.

XML

JSON

{ "type":"SALE", "card": "4111111111111111", "exp-date": "1212", "amount": "25.00" }

PHP (JSON)

https://github.com/Clearent-Gateway/API-Examples/tree/php

Python (JSON)

https://github.com/Clearent-Gateway/API-Examples/tree/python

Go (XML)

https://github.com/Clearent-Gateway/API-Examples/tree/go