AutoCapture

Autocapture is a tool that can be used to quickly and efficiently perform direct payment transactions such as refunds and cancellations of placed transactions without the need to implement or develop new solutions or code.

Autocapture is a small, lightweight and efficient and because of the way it can be called from within other application software, allows the user to perform payment transactions to QuickPay, directly from any 3rd party application, like C5 or any Windows application which supports command-line execution.

Features

As of the date of this writing the following features is supported:

ProviderCaptureRenewRefundCancelSubscriptionsGet PaymentInfo

QuickPay V10

X

X

X

X

X

X

|

System requirements

  • Supported Windows version compatible

?> Make sure that the IP from where the AutoCapture client is called is whitelisted and allowed to call the API if the provider has restrictions.

Calling Autocapture

Autocapture is a command line application so it must be called in one of 3 ways:

  • From an application (C5) - which supports external execution of command line software.

  • Directly from Windows Command Prompt.

  • Via the Windows Run command (Windows Button–R).

Notation

Calls to Autocapture follow the pattern shown below :

autocapture -[command]:[value]

There are currently 5 supported commands and they will all be needed in each call. The order in which the commands are placed is irrelevant.

Examples:

autocapture -action:capture -trans:12345 -amount:10000 -currency:DKK

or

autocapture -trans:99999 -amount:50000 -currency:DKK -action:refund

Parameters

Action

- action:[capture|renew|refund|cancel|paymentinfo]

Specifies which action is to be done by the payment service provider.

  • Capture : Captures a previously authorized payment and withdraw the specified amount.

  • Renew : Renews a previously authorized payment to avoid automatic removal of payment.

  • Refund : Refunds a previously captured transaction and transfers the money back to the original account.

  • Cancel : Cancels a previously authorized – but not yet captured – payment.

  • PaymentInfo : Fetch information about the payment.

Required parameters for the specific actions:

  • capture : transaction, amount, currency, orderid.

  • renew : transaction, amount, currency.

  • refund : transaction, amount, currency, orderid.

  • cancel : transaction, orderid.

  • PaymentInfo : transaction.

PaymentInfo

PaymentInfo output examples:

 id: 010101010
 merchant_id: 00000
 order_id: 000004321
 accepted: True
 type: Payment
 text_on_statement:
 branding_id: 0001
 currency: DKK
 state: processed
 link:
 shipping:
 test_mode: True
 acquirer: nets
 facilitator:
 created_at: 13/01/2020 19.00.00
 updated_at: 14/01/2020 08.00.00
 balance: 1900
 invoice_address_name: John Doe
 invoice_address_att: 
 invoice_address_street: Lille Vibyvej 59
 invoice_address_city: Martofte
 invoice_address_zip_code: 8900
 invoice_address_region: Region Syddanmark
 invoice_address_country_code: DK
 invoice_address_vat_no: 
 invoice_address_company_name: Company A/S
 invoice_address_house_number:
 invoice_address_house_extension:
 invoice_address_phone_number: 262877305
 invoice_address_mobile_number: 262877305
 invoice_address_email: JohnDoe@unkowncompanyname.net
 shipping_address_name: John Doe
 shipping_address_att:
 shipping_address_street: Sludevej 3
 shipping_address_city: København K
 shipping_address_zip_code: 1356
 shipping_address_region: Region Sjælland
 shipping_address_country_code: DK
 shipping_address_vat_no:
 shipping_address_company_name:
 shipping_address_house_number:
 shipping_address_house_extension:
 shipping_address_phone_number:
 shipping_address_mobile_number:
 shipping_address_email:
 metadata_type: card
 metadata_origin: form
 metadata_brand: dankort
 metadata_bin: 000001
 metadata_corporate: True
 metadata_last4: 0001
 metadata_exp_month: 1
 metadata_exp_year: 2022
 metadata_country: DNK
 metadata_is_3d_secure: False
 metadata_issued_to:
 metadata_number:
 metadata_customer_country: DK
 metadata_fraud_suspected: False
 metadata_fraud_reported: False
 operations[[0-9]+]id: 1
 operations[[0-9]+]type: authorize
 operations[[0-9]+]amount: 1900
 operations[[0-9]+]pending: False
 operations[[0-9]+]qp_status_code: 20000
 operations[[0-9]+]qp_status_msg: Approved
 operations[[0-9]+]aq_status_code: 000
 operations[[0-9]+]aq_status_msg: Approved
 operations[[0-9]+]callback_url: https://www.xyz.xyz/xyz/betalingsmetoder/xyz
 operations[[0-9]+]callback_success: True
 operations[[0-9]+]callback_response_code: 200
 operations[[0-9]+]callback_duration: 361
 operations[[0-9]+]acquirer: nets
 operations[[0-9]+]_3d_secure_status: 
 operations[[0-9]+]callback_at: 14/01/2020 18.10.00
 operations[[0-9]+]created_at: 14/01/2020 18.00.00

Transaction

-trans:[0-9]+

The ID of the payment that is to be processed. Usually provided by the payment service provider.

Amount

-amount:[0-9]+[,[0-9]+]?

The specified amount of the order that is to be processed. With most payment providers this number is given as a non-decimal value, so that 100,00 Kr. is specified as 10000.

Currency

-currency:[DKK|SEK|USD]

The currency of the transaction amount.

orderid

-orderid:[0-9a-zA-Z]+

Order id of payment order to be processed.

?> When used with QuickPay with a Subscription/Recurring payment, this should be globally unique for each capture - maybe postfix something on the ordernumber: 1234 (1234011120). You can not use same OrderID for different customers/subscriptsions - i.e. sub01, sub02 etc. is probably a bad pattern.

Split

 -split

If parameter specified, the payment is captured as "split" payment. Once a payment is captured without this parameter it won't be able to be captured again, even if this parameter is specified.

Timeout

 -timeout:[10-120]

When capturing a subscription payment, it might take some time for the new recurring payment to be completely authorized before it can be captured. If a timeout is specified AutoCapture will try to wait for the payment to be ready to be captured until the timeout has passed. Note that the program will not return until the timeout has passed or capture has succeeded, so you probably don't want to specify a too high timeout. A timeout of 10-30 seconds is recommended. Timeout might not be exact - worst case up to +/- 10 seconds diff from the specified timeout.

?> This is only applicable for QuickPay provider in subscription-mode.

Subscription/Recurring Payment

 -subscription

Performs the action specified, but in subscription mode - Thus for capture, a single payment transaction, which can be done multiple times if the the ticket is registred as Recurring and the provider supports subscriptions.

?> For QuickPay: If you have called this this multiple times with same orderid , and get an error like Recurring payment already authorized it means that the recurring is already created, but since you are calling it again you might got an error the first time that indicate that it might not be captured. We recommend checking & capturing manually in this case.

Configuration File

The Autocapture tool relies on a configuration file named AutoCapture.ini. It follows the INI-file standard format.

The config file should be located either in the the executing/"Start in" directory or in the same folder as the Autocapture program itself. The executing directory has the higehst priority when looking for the config file.

It contains various information used for running the application and communicating with various services. This file can be edited by the user to adjust for specific needs, like when a new payment service provider is to be used.

  • merchantid : Payment provider ID of shop or merchant.

  • login : Username for the API user

  • password : Password for API user

Return Values

!> Remember to check for Return-code when calling AutoCapture and somehow give user information in case it did not succeed. Otherwise the user might think everything went ok when it didn't.

Autocapture always return an error code (Exit status code), and if needed also a message, upon exit.

  • 0 : Transaction completed successfully.

  • 1 : or higher. A problem was encountered.

When a problem is encountered, Autocapture prints the errormessage, errorcodes etc. it receives from the Provider API to the Standard Error stream - Refer to the providers documentation for explanation/description of error codes/messages. It is the responsibility of the caller to store/save the error codes/messages for later inspection if needed.

I.e, when running AutoCapture from Command Line the return/exit code can be obtained by using the ERRORLEVEL-variable

 autocapture -trans:99999 -amount:50000 -currency:208 -action:refund
 echo %ERRORLEVEL%
 0

In case you wish to be able to grep the output, you can use redirection. See Microsofts support.

Example with redirection of error-output to a file called error_99999.txt

 autocapture -trans:99999 -amount:500000000 -currency:208 -action:refund 2> error_99999.txt
 echo %ERRORLEVEL%
 1

The file error_99999.txt will then contain the error-output of the program and can be presented to the user in case of error

Last updated

Logo

Copyright Chainbox 2008-2023