TABLE OF CONTENTS
- Sale Transaction
- SaleRequest Object
- Charge Object
- SaleResponse Object
- Sample Request Body
- Sample Response Body
Sale Transaction
This API is used in order to charge a customer for a set amount. This API depends on having a Token.
Once you have a token, you can use the sale API to charge the customer. After completing the sale you can use the Refund API in order to refund the transaction.
POST v1/payment/{mid}/sale
Request Parameters
The merchant ID of the seller performing the sale.
Request Body
Include a SaleRequest object as the body of the request.
Sample Request
POST https://sandX-api.acmeticketing.net/v1/payment/987-654-321/sale
Response
Returns a SaleResponse object or an error for the failed transaction.
SaleRequest Object
Name | Type | Description | Required |
---|---|---|---|
token | string | Either a single use or a multi use token | Token or externalPaymentMethodId Required |
externalPaymentMethodId | string | Plain text value provided during token creation which represents the token. | Token or externalPaymentMethodId Required |
charge | Charge object | The charge object for this sale. The amount is required | Required |
externalId | string | Plain text value provided for this sale. Max 255 char. Cannot contain %, <, >, http:, https:, /, \\ | Optional |
Charge Object
Name | Type | Description | Required |
---|---|---|---|
amount | number | The amount of money the sale or refund is for. 2 decimal places are supported | Required |
SaleResponse Object
Name | Type | Description |
---|---|---|
saleId | string | Unique identifier for this transaction |
card | Card Object › | The details of the credit card |
externalId | string | Plain text value provided for this sale. |
Sample Request Body
Sale by Token
{ "token" : "123-456-789", "charge": { "amount" : 50.00 }, "externalId": "BSYE623048" }
Sale by External Payment Method
{ "externalPaymentMethodId" : "PMID-123", "charge": { "amount" : 50.00 }, "externalId": "BSYE623048" }
Sample Response Body
Successful Sale Transaction
{ "saleId": "sale_123-abc-456", "externalId": "BSYE623048", "card": { "lastFour": "4242", "brand": "Visa", "firstName": "John", "lastName": "Smith" } }
Failed Sale Transaction
If the error happens at ACME there will not be a processor or issuing error code. If the error happens at the issuing bank then both of those should be available. If it happens at the payment processor, then there will probably not be an issuing error but there will be a processor error.
{ "timestamp": "2023-02-02T10:44:21-08:00", "message": "Please enter the correct ZIP / Postal Code for your credit card", "errorCode": 6107, "type": "INCORRECT_ZIP", "processorErrorCode": "incorrect_zip", "processorErrorMessage": "The zip code you supplied failed validation.", "issuingErrorCode": "incorrect_zip", "issuingErrorMessage": "The zip code you supplied failed validation.", "requestId": "04b7ae82-a0a4-11ec-ab96-064a412857e4", "path": "/v1/payment/123456789/tokens/singleuse" }