Continuous Authority and repeated transactions using SagePay Gateway
SagePay allows us to process repeated capture transactions against a successful payment authorization. You can get more information about the introduction and instructions for obtaining a Continuous Authority Internet Merchant Number here.
This example makes use of a forked version of ActiveMerchant and SagePay Simulator environment. Please refer to the previous article for setup instructions.
Setup:
Make sure to check ‘Continuous Authority’ in the simulator account settings.
Case 1: A non 3D Authorized Transaction
response.authorization shows a value simiar to:
00001;{E5AC4385-06F8-40DD-8486-22EFB23768AE};9030;03FQG5AJA6;authorization
Capture the Payment
Repeat the transaction using previous authorization reference.
Case 2: 3D Authorized transaction
Follow the steps 1-3 for 3D Secure Payment Transaction as shown in the previous article. You’ll notice that the authorization returned by a three_d_complete process is incomplete and it looks something like “;{FB448BBF-CB72-414A-B293-316004162EEB};6598;OUWEBUCWL3;three_d_complete”
Prepend the order_id used in step 1 to this authorization reference so that it matches following format:
three_d_auth_reference = “00003;{FB448BBF-CB72-414A-B293-316004162EEB};6598;OUWEBUCWL3;three_d_complete”
Where “00003″ is the order_id used for authorization in step 1.
Capture this 3D Authorized payment for the first time by calling:
This transaction can be repeated by using the previous successful authorization (three_d_auth_reference) with a new order_id.
Trackbacks
Use this link to trackback from your own site.



I am getting an error while trying to submit a REPEAT Transaction.
“You have sent a TxType of REPEAT which is not recognised.”
I have enabled the the Repeat Transaction on the Simulator Account Settings.
However i dont see any option saying “Continus Authority”. I assume they are the same.
No issues i realised that while sending the TXType as “REPEAT” i was by mistake contructing the URI for purchase i.e.
Uri objUri = new Uri(SageInclude.SystemURL(SageInclude.strConnectTo, “purchase”));
. When i changed the it to
Uri objUri = new Uri(SageInclude.SystemURL(SageInclude.strConnectTo, “repeat”));
it worked.
FYI: The fork of active merchant linked to in this article doesn’t include support for repeat transactions. Tomriley’s for does support this http://github.com/tomriley/active_merchant/tree/master