Functions
Function | Description |
---|---|
authorize |
Authorizes a credit card and returns the transaction ID for later capture. |
capture |
Captures a previously authorized transaction. |
cardType |
Returns the type of credit card based on the number. |
charge |
Charges a credit card (Authorization & Capture). |
createRecurringPayment |
Creates a recurring payment profile. |
formatCurrency |
Formats a currency amount for the payment gateways (they're picky). |
paypalExpressCheckoutDetails |
Returns checkout details for an Express Checkout transaciton. |
paypalExpressCheckoutProcess |
Processes an Express Checkout transaction. |
paypalExpressCheckoutRedirect |
Sets up a PayPal Express Checkout session and redirects the user to PayPal. |
paypalRESTTokenRequest |
Fetches a new authorization token from PayPal's OAuth servers. |
paypalRESTVaultAuthorize |
Authorizes a payment using a token from the PayPal REST API vault. |
paypalRESTVaultCharge |
Charges a credit card using a token from the PayPal REST API vault. |
paypalRESTVaultDelete |
Deletes a credit card stored in the PayPal REST API vault. |
paypalRESTVaultLookup |
Looks up a credit card stored in the PayPal REST API vault. |
paypalRESTVaultStore |
Stores a credit card in the PayPal REST API vault. |
refund |
Refunds a settled transaction. |
saveSettings |
Saves changed service and settings. |
void |
Voids an authorization. |
authorize
Authorizes a credit card and returns the transaction ID for later capture.
Return Value: $this->Message will contain an error message if not successful.
authorize($amount, $tax, $card_name, $card_number, $card_expiration, $cvv, $address, $description = "", $email = "", $phone = "", $customer = "")
Parameter | Description |
---|---|
$amount |
The amount to charge (includes the tax). |
$tax |
The amount of tax to charge (for accounting purposes, must also be included in total amount). |
$card_name |
Name as it appears on the credit card. |
$card_number |
Credit card number. |
$card_expiration |
4 or 6 digit expiration date (MMYYYY or MMYY). |
$cvv |
Credit card security code. |
$address |
An address array with keys "street", "street2", "city", "state", "zip", "country" |
$description |
Description of what is being charged. |
$email |
Email address of the purchaser. |
$phone |
Phone number of the purchaser. |
$customer |
Customer ID of the purchaser. |
capture
Captures a previously authorized transaction.
Return Value: $this->Message will contain an error message if not successful.
capture($transaction, $amount)
Parameter | Description |
---|---|
$transaction |
The transaction ID to capture funds for. |
$amount |
The amount to charge (must be equal to or lower than authorization amount). |
cardType
Returns the type of credit card based on the number.
Return Value: The name of the card issuer.
cardType($card_number)
Parameter | Description |
---|---|
$card_number |
The credit card number. |
charge
Charges a credit card (Authorization & Capture).
Return Value: $this->Message will contain an error message if not successful.
charge($amount, $tax, $card_name, $card_number, $card_expiration, $cvv, $address, $description = "", $email = "", $phone = "", $customer = "")
Parameter | Description |
---|---|
$amount |
The amount to charge (includes the tax). |
$tax |
The amount of tax to charge (for accounting purposes, must also be included in total amount). |
$card_name |
Name as it appears on the credit card. |
$card_number |
Credit card number. |
$card_expiration |
4 or 6 digit expiration date (MMYYYY or MMYY). |
$cvv |
Credit card security code. |
$address |
An address array with keys "street", "street2", "city", "state", "zip", "country" |
$description |
Description of what is being charged. |
$email |
Email address of the purchaser. |
$phone |
Phone number of the purchaser. |
$customer |
Customer ID of the purchaser. |
createRecurringPayment
Creates a recurring payment profile.
Return Value: $this->Message will contain an error message if not successful.
createRecurringPayment($description, $amount, $start_date, $period, $frequency, $card_name, $card_number, $card_expiration, $cvv, $address, $email, $trial_amount = false, $trial_period = false, $trial_frequency = false, $trial_length = false)
Parameter | Description |
---|---|
$description |
A description of the subscription. |
$amount |
The amount to charge (includes the tax). |
$start_date |
The date to begin charging the user (YYYY-MM-DD, blank for immediately). |
$period |
The unit of how often to charge the user (options: day, week, month, year) |
$frequency |
The number of units that make up each billing period. (i.e. for bi-weekly the frequency is "2" and period is "week", quarterly would be frequency "3" and period "month") |
$card_name |
Name as it appears on the credit card. |
$card_number |
Credit card number. |
$card_expiration |
4 or 6 digit expiration date (MMYYYY or MMYY). |
$cvv |
Credit card security code. |
$address |
An address array with keys "street", "street2", "city", "state", "zip", "country" |
$email |
Email address of the purchaser. |
$trial_amount |
The amount to charge during the (optional) trial period. |
$trial_period |
The unit of how often to charge the user during the (optional) trial period (options: day, week, month, year) |
$trial_frequency |
The number of units that make up each billing segment of the (optional) trial period. |
$trial_length |
The number of billing cycles the (optional) trial period should last. |
formatCurrency
Formats a currency amount for the payment gateways (they're picky).
Return Value: A string
formatCurrency($amount)
Parameter | Description |
---|---|
$amount |
Currency amount |
paypalExpressCheckoutDetails
Returns checkout details for an Express Checkout transaciton.
For: PayPal Payments Pro and Payflow Gateway ONLY.
Return Value: An array of buyer information.
paypalExpressCheckoutDetails($token)
Parameter | Description |
---|---|
$token |
The Express Checkout token returned by PayPal. |
paypalExpressCheckoutProcess
Processes an Express Checkout transaction.
For: PayPal REST API, PayPal Payments Pro and Payflow Gateway ONLY.
Return Value: An array of buyer information.
paypalExpressCheckoutProcess($token, $payer_id, $amount = false)
Parameter | Description |
---|---|
$token |
The Express Checkout token returned by PayPal. |
$payer_id |
The Payer ID returned by PayPal. |
$amount |
The amount to charge. |
paypalExpressCheckoutRedirect
Sets up a PayPal Express Checkout session and redirects the user to PayPal.
For: PayPal REST API, PayPal Payments Pro and Payflow Gateway ONLY.
Return Value: false in the event of a failure, otherwise redirects and dies.
paypalExpressCheckoutRedirect($amount, $success_url, $cancel_rul)
Parameter | Description |
---|---|
$amount |
The amount to charge the user. |
$success_url |
The URL to return to on successful PayPal login. |
$cancel_rul |
The URL to return to if the user cancels payment. |
paypalRESTTokenRequest
Fetches a new authorization token from PayPal's OAuth servers.
paypalRESTTokenRequest()
paypalRESTVaultAuthorize
Authorizes a payment using a token from the PayPal REST API vault.
Payment should be captured using standard "capture" method
paypalRESTVaultAuthorize($id, $user_id, $amount, $tax, $description = "", $email = "")
Parameter | Description |
---|---|
$id |
The card ID returned when the card was stored. |
$user_id |
The user ID related to this card (pass in false if no user id was stored with this card). |
$amount |
The amount to charge (includes the tax). |
$tax |
The amount of tax to charge (for accounting purposes, must also be included in total amount). |
$description |
Description of what is being charged. |
$email |
Email address of the purchaser. |
paypalRESTVaultCharge
Charges a credit card using a token from the PayPal REST API vault.
paypalRESTVaultCharge($id, $user_id, $amount, $tax, $description = "", $email = "", $action = "sale")
Parameter | Description |
---|---|
$id |
The card ID returned when the card was stored. |
$user_id |
The user ID related to this card (pass in false if no user id was stored with this card). |
$amount |
The amount to charge (includes the tax). |
$tax |
The amount of tax to charge (for accounting purposes, must also be included in total amount). |
$description |
Description of what is being charged. |
$email |
Email address of the purchaser. |
$action |
"sale" or "authorize" (defaults to sale) |
paypalRESTVaultDelete
Deletes a credit card stored in the PayPal REST API vault.
paypalRESTVaultDelete($id)
Parameter | Description |
---|---|
$id |
The card ID returned when the card was stored. |
paypalRESTVaultLookup
Looks up a credit card stored in the PayPal REST API vault.
Return Value: Credit card information (only the last 4 digits of the credit card number are visible)
paypalRESTVaultLookup($id)
Parameter | Description |
---|---|
$id |
The card ID returned when the card was stored. |
paypalRESTVaultStore
Stores a credit card in the PayPal REST API vault.
Return Value: A card ID to be used for later recall.
paypalRESTVaultStore($name, $number, $expiration_date, $cvv, $address, $user_id)
Parameter | Description |
---|---|
$name |
Name on the credit card |
$number |
Credit card number |
$expiration_date |
Expiration date (MMYY or MMYYYY format) |
$cvv |
Credit card security code. |
$address |
An address array with keys "street", "street2", "city", "state", "zip", "country" |
$user_id |
A unique ID to associate with this storage (for example, the user ID of this person on your site) |
refund
Refunds a settled transaction.
Return Value: $this->Message will contain an error message if not successful.
refund($transaction, $card_number = "", $amount)
Parameter | Description |
---|---|
$transaction |
The transaction ID to capture funds for. |
$card_number |
The last four digits of the credit card number used for the transaction (required for some processors). |
$amount |
The amount to refund (required for some processors). |
saveSettings
Saves changed service and settings.
saveSettings()
void
Voids an authorization.
Return Value: $this->Message will contain an error message if not successful.
void($authorization)
Parameter | Description |
---|---|
$authorization |
The transaction/authorization ID to void. |