Skip to content
Last updated

Process a credit card sale

Prerequisites

Step 1: Build the request

Set type to sale and include the full card details in payment_method.

FieldRequiredDescription
typeYessale
amountYesAmount in cents (for example, 1999 = 19.99 USD)
tipNoTip amount in cents (minimum 50 if provided)
payment_method.typeYescard
payment_method.panYesFull card number
payment_method.expiry.monthYesTwo-digit expiry month
payment_method.expiry.yearYesFour-digit expiry year
payment_method.cardholder_nameYesName on card
payment_method.cvvRecommended3- or 4-digit verification value
payment_method.address_line1RecommendedBilling street address (for AVS)
payment_method.zipRecommendedBilling ZIP code (for AVS)
recurringNotrue if this is a recurring charge
purchase_descriptionNoDescription of the purchase

Step 2: Send the request

Loading...

Step 3: Handle the response

A successful sale returns 200 with transaction_state: authorized.

{
  "id": "TRANSACTION-01JMRSPCK7XVNP3KS8F2W4T6Y",
  "object": "transaction",
  "type": "card_sale",
  "transaction_state": "authorized",
  "response_status": "Approved",
  "response_code": "00",
  "response_message": "The API request is approved.",
  "batch_id": "BATCH-01JMRSPCK7XVNP3KS8F2W4T6Y",
  "amount": 15000,
  "tip": 1000,
  "avs_result_code": "y",
  "cvv_result": "M",
  "authorization_code": "847293",
  "payment_method": {
    "type": "card",
    "payment_token": "PAYMENT_TOKEN-01JMRSPCK8WLXDPRMW3SNPVQEA",
    "brand": "visa",
    "last_four": "1234",
    "bin": "411111",
    "funding": "credit"
  },
  "correlation_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890"
}

Save the id for any future operations (cancel, refund). Note the payment_token — you can reuse it for future transactions without collecting card details again.

Step 4: Check fraud signals

Review the avs_result_code and cvv_result in the response before fulfilling the order.

FieldGood valuesAction on mismatch
avs_result_codey, xPartial match: review. No match (n): consider declining.
cvv_resultM (Visa), 2 (Mastercard)No match: high risk — consider declining.

For more information, see About fraud prevention.

Next steps