Payments: Sale

Modified on Wed, 12 Apr 2023 at 01:05 PM

 

Sale Transaction

This API endpoint is called in order to charge a customer for a set amount.  ACME requires tokenized transactions to remain PCI compliant, so know how to generate or reference a Token.  

You will need your MerchantID {mid} and  PaymentKey {x-acme-payment-key} to run sales, if you do not have these, please contact your ACME account manager.



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 Body:


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 Request

POST https://sandX-api.acmepayments.net/v1/payment/12345/sale

 

Response

Returns a SaleResponse object or an error for the failed transaction.

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"
}

  

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. 

 



Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select atleast one of the reasons

Feedback sent

We appreciate your effort and will try to fix the article