API: Transaction
Sale
Charge a credit card for a payment amount. You can also associate a customer profile with the sale and charge a stored credit card.
To encrypt your credit card information, use our Payfirma Card Encryption Javascript library to generate a secure and encrypted card token to be used with any of our transaction methods.
BASE URI
https://apigateway.payfirma.com/transaction-service
Create a sale
Request a credit card payment
HTTPS POST
/sale
Request Arguments |
|
|---|---|
amount REQUIRED | Transaction amount, in dollars, e.g. 10.99 = 10 dollars and 99 cents. |
currency | Transaction currency, in currency type, e.g. USD, CAD. |
card_expiry_month REQUIRED | The double-digit month the card expires, e.g. for August, use 08. |
card_expiry_year REQUIRED | Expiry year - in double digits - of the associated credit card number, e.g. for 2017, use 17. |
card_number REQUIRED | The credit card number (16 digits for most card brands and 15 digits for American Express). |
cvv2 REQUIRED | A credit card’s verification code, otherwise known as CVC or CVV; the three or four-digit number on the back of most major cards, and the four digit number found on the front of American Express cards. We strongly recommend that you utilize the cvv2 field to help protect against fraud and charge-backs. |
token | Secure and encrypted card token. You can use this instead of card_expiry_month, card_expiry_year, card_number and cvv2. If used with a credit card, 400 BAD_REQUEST is returned. |
The email address associated with the customer that will receive the receipt, if that attribute is set to true. | |
first_name | The first name of the customer. |
last_name | The customers last name. |
company | Business name associated with customer. |
bcc_emails | Additional email the receipt should be sent to for expense tracking or accounting needs. |
telephone | Customer’s telephone number. |
address1 | First line of the customer address. |
address2 | Second line of the customer address. |
city | The city where the customer is. |
province | The province where Canadian customer reside. For US Customers, this would be the State of residence. |
country | The country where the customer is. All country codes should be in ISO 3166 Alpha 2. For Canada, use CA. For United States, use US. |
postal_code | The 6 digit address code for Canadian customer. US customers will use a 5-9 digit Zip Code. |
custom_id | A description field to record any general customer identifying information. |
invoice_id | An open description field to help with transaction tracking and reporting. If the Payfirma invoicing service is used, this number will be generated by the invoicing system. |
sending_receipt | Whether or not a transaction will send a receipt to the customer email provided. Is set as true as the default option. |
Response Attributes |
|
|---|---|
amount number | Transaction amount, in dollars, e.g. 10.99 = 10 dollars and 99 cents. |
captured bolean | - |
card_type string | The brand of the credit card, e.g. Visa, Mastercard, Amex |