Skip to content

Redsys - Recurring Payment (COF)

This module allows performing recurring payments using the Credential on File (COF) functionality of Redsys. It allows charging customers without them needing to enter their card data on each transaction, ideal for subscriptions and periodic payments.

FieldTypeRequiredDescription
credentials_idcredentialYesRedsys credentials
amountnumberYesCharge amount in euros
order_numberstringYesUnique order number
identifierstringYesCOF identifier (from the first transaction)
currencyselectNoCurrency (978=EUR by default)
cof_typeselectNoCOF operation type
cof_iniselectNoSequence indicator (S=First, N=Subsequent)
product_descriptionstringNoCharge description
exempt_authenticationbooleanNoExempt from 3DS authentication (MIT)
merchant_urlstringNoNotification URL

This module requires Redsys type credentials with the following fields:

FieldDescription
merchant_codeMerchant code (FUC) provided by the bank
secret_keySHA-256 signing secret key
terminalTerminal number (default: 1)
test_modeTest mode (true/false)
ValueDescription
RRecurring (subscriptions)
IInstallment
HReauthorization
EResubmission
DDelayed
MIncremental
NNo-show
{
"success": true,
"response_code": "0000",
"order": "0001234567",
"authorization_code": "345678",
"amount": 9.99,
"identifier": "12345678901234567890",
"message": "Pago recurrente autorizado: 0001234567"
}
  1. First transaction (cof_ini=S): The customer pays with 3D Secure
    • Obtain the identifier from the response
    • Save for future charges
  2. Subsequent transactions (cof_ini=N): Charges without customer intervention
    • Use the saved identifier
    • Does not require 3DS authentication
{
"credentials_id": "redsys_tienda",
"amount": 9.99,
"order_number": "SUB-202401-001",
"identifier": "12345678901234567890",
"cof_type": "R",
"cof_ini": "N",
"exempt_authentication": true,
"product_description": "Suscripcion mensual Premium"
}
  • The identifier is provided by Redsys in the first transaction
  • Subsequent charges do not require card data
  • MIT (Merchant Initiated Transaction) exemption avoids 3D Secure
  • Ideal for subscriptions, memberships, and periodic payments
  • RedsysCreatePayment - Create the first payment to obtain the identifier
  • RedsysGetPayment - Check recurring charge status
  • RedsysRefund - Refund a recurring charge