Deferred Payments

On this page:

Overview

For some transactions, you may not want to take funds from the card immediately. With a Deferred transaction you can place a ‘shadow’ transaction on the customer’s card to protect the funds needed to make payment. The money is then released to you when you need it.

Deferred transactions work well when there is a time between the customer ordering and you being ready to ship.

Managing Deferred Transactions

The following apply:

  • You can only Release once per transaction, and only for an amount up to the DEFERRED transaction amount.
  • Ideally all deferred transactions should be released within 6 days. After 6 days, the transaction shadow may disappear from the cardholder’s account and the customer can spend all their funds.
  • Deferred transactions remain available for a single Release for up to 30 days. After that time, Opayo will automatically Abort them.
  • If you are unable to fulfil the order, you can Abort the deferred transaction and the customer will not be charged.

Performing a deferred payment

When you need a transaction to be deferred, you must first capture your customer’s card details and submit them to Opayo for validation.

A Deferred request is authenticated and built in the same way as a Payment transaction with the transactionType set to ‘Deferred’. For example:

curl https://pi-test.sagepay.comk/api/v1/transactions \-X POST -H "Authorization: Basic aEpZeHN3N0hMYmo0MGNCOHVkRV...ejRqNVVzNXU="  \-H "Content-type: application/json"  \-d 
'{
  "transactionType":"Deferred",
  "paymentMethod":{
    "card":{
      "merchantSessionKey":"",
      "cardIdentifier":"",
      "save":false
    }
  },
  "vendorTxCode":"demotransaction-",
  "amount":10000,
  "currency":"GBP",
  "description":"Demo transaction",
  "apply3DSecure":"UseMSPSetting",
  "customerFirstName":"Sam",
  "customerLastName":"Jones",
  "billingAddress":{
    "address1":"407 St. John Street",
    "city":"London",
    "postalCode":"EC1V 4AB",
    "country":"GB"
  },
  "entryMethod":"Ecommerce"
}'

Response to a deferred payment

After a deferred payment is processed Opayo’s response will confirm the result and status of the transaction. For example:

{
  "statusCode":"0000",
  "statusDetail":"The Authorisation was Successful.",
  "transactionId":"F7C550DA-F841-7DF3-033E-146CC6A8FA7C",
  "transactionType":"Deferred",
  "retrievalReference":1777845,
  "bankResponseCode":"00",
  "bankAuthorisationCode":"999777",
  "paymentMethod":{
    "card":{
      "cardType":"Visa",
      "lastFourDigits":"0006",
      "expiryDate":"0320",
      "cardIdentifier":"cardTokenUUID",
      "reusable":false
    }
  },
  "status":"Ok",
  "3DSecure":{
    "status":"NotChecked"
  }
}

Releasing a deferred payment

A successful deferred payment is valid for up to 30 days. You can choose to release part or all of the authorised amount in that time.

Important: Only one single Release can occur against each deferred transaction.
curl https://pi-test.sagepay.com/api/v1/transactions/<transactionId>/instructions  \ -H "Authorization: Basic aEpZeHN3N0hMYmo0MGNCOH...WhzWFA1MlY0ZkJ0cHVTRHNocktEU1dzQlkxT2lONmh3ZDlLYjEyejRqNVVzNXU="  \ -H "Content-type: application/json"  \ -X POST  \ -d 
'{
  "instructionType":"release",
  "amount":10000
}'

Response to a release request

{
  "instructionType":"release",
  "date":"2015-08-11T11:45:16.285+01:00"
}

Release Problems

A Deferred transaction must be successful and still valid for a Release attempt to succeed. You cannot release a Deferred transaction:

  • More than once.
  • That has expired.
  • Following a successful Abort request.
  • For more than the value of the deferred request amount.

When a Release fails you will receive the following response:

{
  "description":"Transaction status not applicable",
  "code":"1014"
}

Aborting deferred payments

Note: All deferred transactions expire after 30-days. It is not necessary to Abort all deferred transactions that will not be authorised.
curl https://pi-test.sagepay.com/api/v1/transactions/<transactionId>/instructions
\ -H "Authorization: Basic aEpZeHN3N0hMYmo0MGNCOHVkRVM4Q0RSRkxodUo4RzU0TzZyRHB...lONmh3ZDlLYjEyejRqNVVzNXU="
\ -H "Content-type: application/json"
\ -X POST
\ -d 
'{
"instructionType": "abort"
}'

A Successful Abort Response

{
  "instructionType":"abort",
  "date":"2015-08-11T11:45:16.285+01:00"
}