JavaScript SDK || Charging a Card

Process transactions from a website using the card token returned in the registration call.


Description

The sale call uses a provided amount and card token to process a transaction.

atpay.sale(amount, callback, options)

Attribute Description
amount A numeric amount of the transaction in dollars
callback A function to call when the sale has succeeded or failed.
options A Javascript Object with additional parameters, ‘card’ is a required value, and ‘referrer_context’ is a value you wish to store with the transaction data

On a transaction success, you will receive the following information in the response argument to your callback function.

1
2
3
4
5
6
7
8
{
  id:   "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX",
  balance:   10.0,
  fee:  0.0,
  signature:  "a5ac216fd6d43c424da4e743291ac01e87b9a414",
  created_at: "2013-03-15T14:19:35-06:00",
  updated_at: "2013-03-15T14:19:35-06:00"
}
Attribute Description
id The @Pay identifier for this transaction
balance The final amount for the transaction
fee The fee amount taken for this transaction
created_at The timestamp when the transaction was created
updated_at The timestamp when the transaction was updated