Transactions API

Copper provides an API for all major CRUD operations related to Transactions.

Retrieve a Transaction

GET /transactions/{id}

Retrieves an existing Transaction resource.

Parameters

This API method only accepts a single parameter, the id, via the URL path.

Returns

A Transaction resource if a valid id was provided.

Example

curl https://api.usecopper.com/next/transactions/someid \
    -u sk_test_XXXXXXXXXXXXXXXXXXXXXXXXXX:

Create a Transaction

POST /transactions

Creates a new Transaction resource.

Parameters

This is one of the few Copper APIs that do not require providing an API key.

This API requires several parameters and provides a plethora of different optional parameters that may be provided:

Parameter Type Required? Description
ticket string Required The Ticket id associated with this Transaction.
payment_type string Required The form of payment used to settle this Transaction. Acceptable values include card, apple_pay, google_pay, emv, external, paypal and vip.
bank_account object Optional Object specifying a bank account number to use for this Transaction. String sub-properties that can be provided include bank_name, account_number and routing_number. Only used when payment_type of vip is used.
card object Optional Object specifying payment card details to use for this Transaction. String sub-properties that can be provided include brand, last4, number, expiry, csc and token.
payload string Optional Depending on the payment_type, this field would contain further data used to validate and process Transactions.
currency string Optional The three-letter ISO code for currency, lower case.
adjustment_number number Optional TODO: ???
amount integer Optional The amount to settle for this Transaction, in the smallest sub-unit allowed in the specified currency.
donation_amount integer Optional TODO: ???
tip_amount integer Optional The tip amount to include in this Transaction.
customer object Optional Object specifying further information about the customer being charged with this Transaction. Can include sub-properties email, name and phone. The use of payment_type of vip requires that you provide customer.phone, while apple_pay requires customer.email.

Returns

A Transaction resource if object creation was successful.

Example

curl https://api.usecopper.com/next/transactions \
    -d ticket=tkt_XXXXXXXXXXXXXXXXXXXXXXXXXX \
    -d payment_type=card \
    -d "card[brand]"=Visa \
    -d "card[last4]"=1111 \
    -d "card[number]"=4444333322221111 \
    -d "card[expiry]"=1222 \
    -d "card[csc]"=123 \
    -d "amounts[currency]"=USD \
    -d "amounts[transaction_amount]"=17518 \
    -d "amounts[payment_amount]"=14599 \
    -d "amounts[tip_amount]"=2919

List Transactions

GET /transactions

Returns one or more Transaction resources.

Parameters

This API accepts the base pagination parameters. In addition, you may provide the following parameters to further refine your query:

Parameter Type Required? Description
location string Optional A Location id to filter the response list to only Transactions at the specified Location.
search_query string Optional Filters returned Transactions to those matching Transaction's payment_method.card.last4 property to the value of the search_query parameter. NOTE: this parameter is a post-hoc filter operation, that is, database query results' payment_method.card.last4 property is filtered after retrieved from the database. As a result, depending on the volume of Transactions generated for your account, you may need to issue several of these queries before obtaining results. Please make sure to pay attention to the has_more result property to determine if you need to issue more queries using the pagination parameters. It is recommended to use post-hoc filtering as a last resort; it is more efficient to first narrow down your query using the location and created parameters this API provides.
created[gte] string Optional Retrieves Transactions that have a created property that is greater-than-or-equal-to the specified ISO 8601-formatted value.
created[gt] string Optional Retrieves Transactions that have a created property that is greater-than the specified ISO 8601-formatted value.
created[lte] string Optional Retrieves Transactions that have a created property that is less-than-or-equal-to the specified ISO 8601-formatted value.
created[lt] string Optional Retrieves Transactions that have a created property that is less-than the specified ISO 8601-formatted value.

Returns

An object containing the matching Transactions, if any. The response data format is described in more detail in the pagination list response format documentation.

Example

curl https://api.usecopper.com/next/transactions \
    -u sk_test_XXXXXXXXXXXXXXXXXXXXXXXXXX: \
    -d limit=3 \
    -d location=loc_XXXXXXXXXXXXXXXXXXXXXXXXXX \
    -G