Reference

Payment gateway functions

qualpay.authorize(**kwargs)

An authorization message is used to send cardholder data to the issuing bank for approval. An approved transaction will continue to be open until it expires or a capture message is received. Authorizations are automatically voided if they are not captured within 28 days, although most issuing banks will release the hold after 24 hours in retail environments or 7 days in card not present environments.

qualpay.verify(**kwargs)

A verify message is used to send cardholder data to the issuing bank for validation. A verify message will return success if the cardholder information was verified by the issuer. If the AVS or CVV2 field is included in the message, then the AVS or CVV2 result code will be returned in the response message.

qualpay.capture(**kwargs)

A capture message is used to capture a previously authorized transaction using the payment gateway identifier returned by the authorization message. A capture may be completed for any amount up to the authorized amount.

qualpay.sale(**kwargs)

A sale message is used to perform the function of an authorization and a capture in a single message. This message is used in retail and card not present environments where no physical goods are being shipped.

qualpay.void(**kwargs)

A void message is used to void a previously authorized transaction. Authorizations can be voided at any time. Captured transactions can be voided until the batch is closed. The batch close time is configurable and by default is 11 PM Eastern Time.

qualpay.refund(**kwargs)

A refund message is used to issue a partial or full refund of a previously captured transaction using the payment gateway identifier. Multiple refunds are allowed per captured transaction provided that the sum of all refunds does not exceed the original captured transaction amount.

Authorizations that have not been captured are not eligible for refund.

qualpay.credit(**kwargs)

A credit message is used to issue a non-referenced credit to a cardholder. A nonreferenced credit requires the cardholder data be provided in the message. The credit message is enabled during the first 30 days of production activity.

After 30 days, the credit message is disabled to prevent fraudulent use of the message. If a credit is necessary after 30 days, it is recommended that the merchant make use of the Qualpay web based business platform to issue the credit. If the merchant requires non-referenced credits to be enabled on the payment gateway beyond 30 days they can request this by contacting Qualpay.

qualpay.tokenize(**kwargs)

A tokenization message is used to securely store cardholder data on the Qualpay system. Once stored, a unique card identifier is returned for use in future transactions. Optionally, tokenization can be requested in an authorization, verification or sale message by sending the tokenize field set to “true”.

qualpay.force(**kwargs)

A force message is used to force a declined transaction into the system. This would occur when the online authorization was declined and the merchant received an authorization from a voice or automated response (ARU) system. The required fields are the same as a sale or authorization message with the following exceptions: the cardholder expiration date (exp_date) is not required, and the 6-character authorization code received from the issuer (auth_code) is required.

qualpay.Card

class qualpay.Card(number, exp_month, exp_year, cvv2)[source]

A credit card that may be valid or invalid.

brand

Returns the brand of the card, if applicable, else an “unknown” brand.

is_expired

Returns whether or not the card is expired.

is_luhn_valid

Returns whether or not the card’s number validates against the luhn algorithm, automatically returning False on an empty value.

is_valid

Returns whether or not the card is a valid card for making payments.

mask

Returns the credit card number with each of the number’s digits but the first six and the last four digits replaced by an X, formatted the way they appear on their respective brands’ cards.

qualpay.PaymentGateway

class qualpay.PaymentGateway(merchant_id=None, security_key=None, base_endpoint=None)[source]
authorize(**kwargs)[source]

An authorization message is used to send cardholder data to the issuing bank for approval. An approved transaction will continue to be open until it expires or a capture message is received. Authorizations are automatically voided if they are not captured within 28 days, although most issuing banks will release the hold after 24 hours in retail environments or 7 days in card not present environments.

capture(pg_id, **kwargs)[source]

A capture message is used to capture a previously authorized transaction using the payment gateway identifier returned by the authorization message. A capture may be completed for any amount up to the authorized amount.

credit(**kwargs)[source]

A credit message is used to issue a non-referenced credit to a cardholder. A nonreferenced credit requires the cardholder data be provided in the message. The credit message is enabled during the first 30 days of production activity.

After 30 days, the credit message is disabled to prevent fraudulent use of the message. If a credit is necessary after 30 days, it is recommended that the merchant make use of the Qualpay web based business platform to issue the credit. If the merchant requires non-referenced credits to be enabled on the payment gateway beyond 30 days they can request this by contacting Qualpay.

force(**kwargs)[source]

A force message is used to force a declined transaction into the system. This would occur when the online authorization was declined and the merchant received an authorization from a voice or automated response (ARU) system. The required fields are the same as a sale or authorization message with the following exceptions: the cardholder expiration date (exp_date) is not required, and the 6-character authorization code received from the issuer (auth_code) is required.

refund(pg_id, **kwargs)[source]

A refund message is used to issue a partial or full refund of a previously captured transaction using the payment gateway identifier. Multiple refunds are allowed per captured transaction provided that the sum of all refunds does not exceed the original captured transaction amount.

Authorizations that have not been captured are not eligible for refund.

sale(**kwargs)[source]

A sale message is used to perform the function of an authorization and a capture in a single message. This message is used in retail and card not present environments where no physical goods are being shipped.

tokenize(**kwargs)[source]

A tokenization message is used to securely store cardholder data on the Qualpay system. Once stored, a unique card identifier is returned for use in future transactions. Optionally, tokenization can be requested in an authorization, verification or sale message by sending the tokenize field set to “true”.

verify(**kwargs)[source]

A verify message is used to send cardholder data to the issuing bank for validation. A verify message will return success if the cardholder information was verified by the issuer. If the AVS or CVV2 field is included in the message, then the AVS or CVV2 result code will be returned in the response message.

void(pg_id, **kwargs)[source]

A void message is used to void a previously authorized transaction. Authorizations can be voided at any time. Captured transactions can be voided until the batch is closed. The batch close time is configurable and by default is 11 PM Eastern Time.

Exceptions

exception qualpay.APIError[source]

Base exception from which all other Qualpay exceptions inherit.

exception qualpay.GatewayError(code, response)[source]

Raised when the payment gateway returns a non-success code.

exception qualpay.HttpError(code, response)[source]

Raised when the payment gateway returns a non-200 response.