Get Started: Processing Payments

The get started examples below can be copied and used in your code in the Burton API Demo environment. You will need to replace instances of pa_0***** with the account_id you have been assigned.

These examples are intended to provide the minimum required requests to perform basic payment processing functions. Once you have implemented the minimum requests your implementation will need you can read the full Payment API documentation and begin adding additional functionality.

Minimal Credit Card Charge

Start processing credit card payments by implementing the minimum required request for POST /v2/charges:

{
    "account_id": "pa_0*****",
    "total_amount": 1,
    "payment_method": {
        "method": "card",
        "card_number": "4111111111111111",
        "expiration_date": "2022-02",
        "contact": {
            "first_name": "John",
            "last_name": "Doe"
        }
    }
}

Sample response:

{
    "charge_id": "6206bcbf973c0193850fb6c7",
    "charge_timestamp": "2022-02-11T19:45:03.115Z",
    "authorization_code": "js0ctQFQ",
    "total_amount": 1,
    "reversal_flag": false,
    "payment_method": {
        "method": "card",
        "type": "visa",
        "card_number": "XXXXXXXXXXXX1111",
        "contact": {
            "first_name": "John",
            "last_name": "Doe"
        }
    },
    "processor_messages": {
        "avs_response": "passed",
        "cv_response": "passed"
    },
    "account_id": "pa_0*****",
    "merchant_id": "mt_0*****",
    "status": "success",
    "result_code": "Approved",
    "result_text": "Sandbox transaction success",
    "last_updated_timestamp": "2022-02-11T19:45:03.121Z"
}

Minimal Bank Account Charge

Start processing bank account payments by implementing the minimum required request for POST /v2/charges:

{
    "account_id": "pa_0*****",
    "total_amount": 1,
    "payment_method": {
        "method": "bank_account",
        "type": "checking",
        "routing_number": "021000021",
        "account_number": "111111111111",
        "contact": {
            "first_name": "John",
            "last_name": "Doe"
        }
    }
}

Sample response:

{
    "charge_id": "6206bfad6059c142b511f83f",
    "charge_timestamp": "2022-02-11T19:57:33.900Z",
    "total_amount": 1,
    "reversal_flag": false,
    "payment_method": {
        "method": "bank_account",
        "account_number": "1111",
        "contact": {
            "first_name": "John",
            "last_name": "Doe"
        }
    },
    "processor_messages": {
        "avs_response": "unknown",
        "cv_response": "unknown"
    },
    "account_id": "pa_0*****",
    "merchant_id": "mt_0*****",
    "status": "success",
    "result_code": "ProcessorPendingACHSale",
    "result_text": "Sandbox transaction success",
    "last_updated_timestamp": "2022-02-11T19:57:33.900Z"
}

Create Credit Card Authorization

A credit card authorization checks to make sure a credit card can make a payment for an amount you specify. The authorized amount is placed on hold on the credit card account for a limited time. Once you have successfully authorized a credit card payment you can later complete the sale by capturing the authorization.

The minimum request for an authorization adds the charge_type property set to authorization.

Minimum request for POST /v2/charges:

{
    "account_id": "pa_0*****",
    "total_amount": 1,
    "charge_type": "authorization",
    "payment_method": {
        "method": "card",
        "card_number": "4111111111111111",
        "expiration_date": "2022-02",
        "contact": {
            "first_name": "John",
            "last_name": "Doe"
        }
    }
}

Sample response from which you will want to store the charge_id response field in order to later capture the authorization:

{
    "charge_id": "6206c729c24a39c7f786f5d7",
    "charge_timestamp": "2022-02-11T20:07:40.453Z",
    "authorization_code": "aoeTMFzz",
    "total_amount": 1,
    "reversal_flag": false,
    "payment_method": {
        "method": "card",
        "type": "visa",
        "card_number": "XXXXXXXXXXXX1111",
        "contact": {
            "first_name": "John",
            "last_name": "Doe"
        }
    },
    "processor_messages": {
        "avs_response": "passed",
        "cv_response": "passed"
    },
    "account_id": "pa_0*****",
    "merchant_id": "mt_0*****",
    "status": "success",
    "result_code": "Authorized",
    "result_text": "Processing CreditCardAuth",
    "last_updated_timestamp": "2022-02-11T20:07:40.461Z"
}

Capture Credit Card Authorization

You capture a credit card authorization by doing a POST /v2/charges/{charge_id}/capture request:

POST /v2/charges/6206c729c24a39c7f786f5d7/capture

{}

Sample response:

{
    "charge_id": "6206c72ac24a39c7f786f5da",
    "charge_timestamp": "2022-02-11T20:29:30.183Z",
    "authorization_code": "dDEZkzHU",
    "original_charge_id": "6206c729c24a39c7f786f5d7",
    "total_amount": 1,
    "reversal_flag": false,
    "payment_method": {
        "method": "card",
        "type": "visa",
        "card_number": "XXXXXXXXXXXX1111",
        "contact": {
            "first_name": "John",
            "last_name": "Doe"
        }
    },
    "processor_messages": {
        "avs_response": "unknown",
        "cv_response": "unknown"
    },
    "account_id": "pa_0*****",
    "merchant_id": "mt_0*****",
    "status": "success",
    "result_code": "Approved",
    "last_updated_timestamp": "2022-02-11T20:29:30.193Z"
}

Tokenize Credit Card

Tokenization allows you to securely store a payment account and later process one or more payments by referencing a token_id. As a result you can store payment accounts securely without storing them in your own system.

POST /v2/tokens

{
    "account_id": "pa_0*****",
    "payment_method": {
        "reason": "on_file",
        "method": "card",
        "card_number": "4111111111111111",
        "expiration_date": "2022-02",
        "contact": {
            "first_name": "John",
            "last_name": "Doe"
        }
    }
}

Sample response from which you will want to store the token_id response field in order to use it in processing payments in the future:

{
    "token_id": "ct_06206cab63e7904e363f8cb11vEffOKkiSqx3E2aqtzKJa",
    "payment_method": {
        "method": "card",
        "card_number": "XXXXXXXXXXXX1111",
        "expiration_date": "2022-02",
        "contact": {
            "first_name": "John",
            "last_name": "Doe",
            "country": "USA"
        }
    },
    "fraud_score": 0,
    "reason": "on_file",
    "token_expiration_date": "2022-03-01T05:59:59.999Z",
    "processor_messages": {
        "cv_response": "passed",
        "avs_response": "passed"
    }
}

Minimal Token Credit Card Charge

The minimum required request to charge a credit card token using a POST /v2/charges.

{
    "account_id": "pa_05cd2d06e04180939c046ca7eKebdXfdOMYykaBwEJ9Krm",
    "total_amount": 1,
    "payment_method": {
        "token_id": "ct_06206cab63e7904e363f8cb11vEffOKkiSqx3E2aqtzKJa"
    }
}

Sample response:

{
    "charge_id": "6206cab73e7904e363f8cb15",
    "charge_timestamp": "2022-02-11T20:44:39.332Z",
    "authorization_code": "yhdN2guH",
    "total_amount": 1,
    "reversal_flag": false,
    "payment_method": {
        "method": "card",
        "type": "visa",
        "card_number": "XXXXXXXXXXXX1111",
        "contact": {
            "first_name": "John",
            "last_name": "Doe"
        }
    },
    "processor_messages": {
        "avs_response": "passed",
        "cv_response": "passed"
    },
    "account_id": "pa_0*****",
    "merchant_id": "mt_0*****",
    "status": "success",
    "result_code": "Approved",
    "result_text": "Sandbox transaction success",
    "last_updated_timestamp": "2022-02-11T20:44:39.337Z"
}