---
title: Suscripciones con wallet
slug: suscripciones-con-wallet
icon: {"faIcon":"fa-solid fa-wallet"}
docTags: 
createdAt: 2025-02-04T15:23:46.221Z
---

El módulo de suscripciones permite guardar y vincular las tarjetas a nivel suscriptor mediante la funcionalidad "Wallet".

De esta forma, al crear diferentes suscriptores con el mismo valor de referencia "customerReference", es posible seleccionar y modificar las tarjetas compartidas entre los mismos.

### Ejemplo: Creación de Suscripción con Wallet

Cuando se crea una suscripción con Wallet se debe enviar el parámetro adicional `wallet`en "true":

```json
{
  "total": 1000,
  "currency": "ARS",
  "name": "Suscripción con wallet",
  "description": "Unicobros.dev",
  "interval": "1m",
  "trial": 0,
  "reference": "subscription_A00111223",
  "type": "manual",
  "test": true,
  "return_url": " https://unicobros.com",
  "webhook": "https://webhook.com",
  "wallet": true
 }

```

### Respuesta

```json
{
    "result": true,
    "data": {
        "uid": "H4QAGHOPE9QW6CUKVO",
        "name": "Suscripción con wallet",
        "description": "Unicobros.dev",
        "interval": "1m",
        "initialDay": -1,
        "total": 1000,
        "trial": 0,
        "setupFee": 0,
        "charge": "total",
        "ccCutoffDay": -1,
        "url": "https://unicobros.com/p/subscriptions/subscribe/H4QAGHOPE9QW6CUKVO",
        "return_url": " https://unicobros.com",
        "webhook": "https://webhook.com",
        "shorten_url": "https://unicobros.com/p/subscriptions/subscribe/H4QAGHOPE9QW6CUKVO",
        "test": true
    }
}
```

### Ejemplo: Crear Suscriptor con Wallet

Llamando a la [API de crear suscriptor](https://ayuda.unicobros.com.ar/suscriptores), se debe agregar el parámetro "customerReference" válido que será la referencia del cliente en la wallet.
Múltiples Suscriptores podrán hacer referencia al mismo Customer en la Wallet.

```json
{
    "customer":{
        "email":"demo@unicobros.com",
        "identification":"12123123",
        "name":"Test unicobros"
    },
    "reference": "R2332112121234",
    "customerReference": "CR2332112121234",
        "startDate":{
        "day": 4,
        "month": 2
    }
  }
```

### Respuesta

```json
{
    "result": true,
    "data": {
        "uid": "4QRF2DC5L8YUPIYQGY",
        "reference": "R2332112121234",
        "sourceUrl": "https://unicobros.com/p/subscriptions/H4QAGHOPE9QW6CUKVO/subscriber/4QRF2DC5L8YUPIYQGY/source",
        "secondarySourceUrl": "https://unicobros.com/p/subscriptions/H4QAGHOPE9QW6CUKVO/subscriber/4QRF2DC5L8YUPIYQGY/source/secondary",
        "subscriberUrl": "https://unicobros.com/p/subscriptions/H4QAGHOPE9QW6CUKVO/subscriber/4QRF2DC5L8YUPIYQGY",
        "subscription": {
            "uid": "H4QAGHOPE9QW6CUKVO"
        }
    }
}
```

### Obtener información con Wallet

:::ApiMethodV2
```json
{
  "tab": "examples",
  "url": "https://api.unicobros.com.ar/p/wallet/REF:{customerReference}",
  "name": "Obtener información mediante \"CustomerReference\" con Wallet",
  "method": "GET",
  "request": {
    "pathParameters": [],
    "queryParameters": [
      {
        "kind": "required",
        "name": "REF:",
        "type": "string",
        "description": "Referencia del suscriptor configurada en \"customerReference\""
      }
    ],
    "headerParameters": [
      {
        "kind": "required",
        "name": "x-api-key",
        "type": "string",
        "description": "Clave API de su aplicación."
      },
      {
        "kind": "required",
        "name": "x-access-token",
        "type": "string",
        "description": "Token de Acceso a la entidad para la cual desea realizar la operación."
      }
    ],
    "bodyDataParameters": [],
    "formDataParameters": []
  },
  "results": {
    "languages": [
      {
        "id": "xNrSkh7_zvABt1qZc128m",
        "code": "{\n    \"result\": true,\n    \"data\": {\n        \"uid\": \"Y7B3P541B9VFBYTHSZ\",\n        \"reference\": \"233211212\",\n        \"sourceUrl\": \"https://unicobros.com/p/subscriptions/T691POMK62SGC7CHAK/subscriber/Y7B3P541B9VFBYTHSZ/source\",\n        \"subscriberUrl\": \"https://unicobros.com/p/subscriptions/T691POMK62SGC7CHAK/subscriber/Y7B3P541B9VFBYTHSZ\",\n        \"subscription\": {\n            \"uid\": \"T691POMK62SGC7CHAK\"\n        }\n    }\n}",
        "language": "200"
      }
    ],
    "selectedLanguageId": "xNrSkh7_zvABt1qZc128m"
  },
  "examples": {
    "languages": [
      {
        "id": "pCAIbxL7rD7t-u9KOJ-SC",
        "code": "var data = JSON.stringify({\n  \"customer\":{\n    \"email\":\"demo@unicobros.com\",\n    \"identification\":\"12123123\",\n    \"name\":\"Test unicobros\"\n    },\n  \"startDate\":{\n    \"day\":27,\n    \"month\":3,\n    \"year\":2021\n    },\n  \"reference\":\"233211212\"});\n\nvar xhr = new XMLHttpRequest();\nxhr.withCredentials = true;\n\nxhr.addEventListener(\"readystatechange\", function() {\n  if(this.readyState === 4) {\n    console.log(this.responseText);\n  }\n});\n\nxhr.open(\"POST\", \"https://api.unicobros.com.ar/p/subscriptions/T691POMK62SGC7CHAK/subscriber\");\nxhr.setRequestHeader(\"x-api-key\", \"zJ8LFTBX6Ba8D611e9io13fDZAwj0QmKO1Hn1yIj\");\nxhr.setRequestHeader(\"x-access-token\", \"d31f0721-2f85-44e7-bcc6-15e19d1a53cc\");\nxhr.setRequestHeader(\"Content-Type\", \"application/json\");\n\nxhr.send(data);",
        "language": "javascript"
      },
      {
        "id": "e-VRuRb5Gwpgf2s-YOYAz",
        "code": "<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, array(\n  CURLOPT_URL => 'https://api.unicobros.com.ar/p/subscriptions/T691POMK62SGC7CHAK/subscriber',\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => '',\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 0,\n  CURLOPT_FOLLOWLOCATION => true,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => 'POST',\n  CURLOPT_POSTFIELDS =>'{\n    \"customer\":{\n        \"email\": \"demo@unicobros.com\",\n        \"identification\": \"12123123\",\n        \"name\": \"Test Mobbex\"\n    },\n    \"startDate\":{\n        \"day\": 27,\n        \"month\": 3,\n        \"year\": 2021\n    },\n    \"reference\": \"233211212\"\n}',\n  CURLOPT_HTTPHEADER => array(\n    'x-api-key: zJ8LFTBX6Ba8D611e9io13fDZAwj0QmKO1Hn1yIj',\n    'x-access-token: d31f0721-2f85-44e7-bcc6-15e19d1a53cc',\n    'Content-Type: application/json'\n  ),\n));\n\n$response = curl_exec($curl);\n\ncurl_close($curl);\necho $response;\n",
        "language": "php"
      },
      {
        "id": "tFTVkyK7EpO7VKG7m0YfV",
        "code": "import requests\n\nurl = \"https://api.unicobros.com.ar/p/subscriptions/T691POMK62SGC7CHAK/subscriber\"\n\npayload=\"{\\r\\n    \\\"customer\\\":{\\r\\n        \\\"email\\\": \\\"demo@unicobros.com\\\",\\r\\n        \\\"identification\\\": \\\"12123123\\\",\\r\\n        \\\"name\\\": \\\"Test Unicobros\\\"\\r\\n    },\\r\\n    \\\"startDate\\\":{\\r\\n        \\\"day\\\": 27,\\r\\n        \\\"month\\\": 3,\\r\\n        \\\"year\\\": 2021\\r\\n    },\\r\\n    \\\"reference\\\": \\\"233211212\\\"\\r\\n}\"\nheaders = {\n  'x-api-key': 'zJ8LFTBX6Ba8D611e9io13fDZAwj0QmKO1Hn1yIj',\n  'x-access-token': 'd31f0721-2f85-44e7-bcc6-15e19d1a53cc',\n  'Content-Type': 'application/json'\n}\n\nresponse = requests.request(\"POST\", url, headers=headers, data=payload)\n\nprint(response.text)\n",
        "language": "python"
      }
    ],
    "selectedLanguageId": "tFTVkyK7EpO7VKG7m0YfV"
  },
  "description": "Permite obtener la información de los suscriptores creados con sus tarjetas vinculadas (wallet) mediante la referencia \"customerReference\".",
  "currentNewParameter": {
    "label": "Body Parameter",
    "value": "bodyDataParameters"
  },
  "autoGeneratedAnchorSlug": "obtener-informacin-mediante-customerreference-con",
  "legacyHash": "WEUmVIIriEvDGBcqNFSTl"
}
```
:::

**Ejemplo Obtener información con Wallet**

`GET https://api.unicobros.com.ar/p/wallet/REF:CR2332112121234`

**Respuesta**

```json
{
    "result": true,
    "data": {
        "uid": "4MR1URZ4D8FILOMNPU",
        "reference": "CR2332112121234",
        "test": true,
        "customerData": {
            "email": "demo@unicobros.com",
            "identification": "12123123",
            "name": "Test Demo"
        },
        "features": [],
        "status": "active",
        "sources": [
            {
                "uid": "W:T3J9TBMJFLVKU846WE",
                "name": "Tarjeta terminada en 6691",
                "type": "card",
                "priority": "primary",
                "card": {
                    "number": "47654068****6691",
                    "bin": "47654068",
                    "last4": "6691"
                }
            },
            {
                "uid": "W:36IXF2D0GYABJJYKXP",
                "name": "Tarjeta terminada en 1008",
                "type": "card",
                "priority": "secondary",
                "card": {
                    "number": "53236299****1008",
                    "bin": "53236299",
                    "last4": "1008"
                }
            }
        ],
        "updated": "2025-02-04T17:40:14.689Z",
        "created": "2025-02-04T17:40:14.689Z"
    }
}
```

### Cambio de método de pago via Wallet

:::ApiMethodV2
```json
{
  "tab": "examples",
  "url": "https://api.unicobros.com.ar/p/subscriptions/:sid/subscriber/:subid/source",
  "name": "Cambiar el método de pago a un suscriptor via Wallet",
  "method": "POST",
  "request": {
    "pathParameters": [],
    "queryParameters": [
      {
        "kind": "required",
        "name": "sid",
        "type": "string",
        "description": "ID de la suscripción."
      },
      {
        "name": "subid",
        "kind": "required",
        "type": "string",
        "description": "ID del suscriptor.",
        "children": []
      }
    ],
    "headerParameters": [
      {
        "kind": "required",
        "name": "x-api-key",
        "type": "string",
        "description": "Clave API de su aplicación."
      },
      {
        "kind": "required",
        "name": "x-access-token",
        "type": "string",
        "description": "Token de Acceso a la entidad para la cual desea realizar la operación."
      }
    ],
    "bodyDataParameters": [
      {
        "kind": "required",
        "name": "token",
        "type": "string",
        "children": [],
        "description": "ID del token generado."
      },
      {
        "name": "securityCode",
        "kind": "required",
        "type": "string",
        "description": "Código de Seguridad de la tarjeta elegida.",
        "children": []
      }
    ],
    "formDataParameters": []
  },
  "results": {
    "languages": [
      {
        "id": "xNrSkh7_zvABt1qZc128m",
        "code": "{\n    \"result\": true,\n    \"data\": {\n        \"uid\": \"Y7B3P541B9VFBYTHSZ\",\n        \"reference\": \"233211212\",\n        \"sourceUrl\": \"https://unicobros.com/p/subscriptions/T691POMK62SGC7CHAK/subscriber/Y7B3P541B9VFBYTHSZ/source\",\n        \"subscriberUrl\": \"https://unicobros.com/p/subscriptions/T691POMK62SGC7CHAK/subscriber/Y7B3P541B9VFBYTHSZ\",\n        \"subscription\": {\n            \"uid\": \"T691POMK62SGC7CHAK\"\n        }\n    }\n}",
        "language": "200"
      }
    ],
    "selectedLanguageId": "xNrSkh7_zvABt1qZc128m"
  },
  "examples": {
    "languages": [
      {
        "id": "pCAIbxL7rD7t-u9KOJ-SC",
        "code": "var data = JSON.stringify({\n  \"customer\":{\n    \"email\":\"demo@unicobros.com\",\n    \"identification\":\"12123123\",\n    \"name\":\"Test unicobros\"\n    },\n  \"startDate\":{\n    \"day\":27,\n    \"month\":3,\n    \"year\":2021\n    },\n  \"reference\":\"233211212\"});\n\nvar xhr = new XMLHttpRequest();\nxhr.withCredentials = true;\n\nxhr.addEventListener(\"readystatechange\", function() {\n  if(this.readyState === 4) {\n    console.log(this.responseText);\n  }\n});\n\nxhr.open(\"POST\", \"https://api.unicobros.com.ar/p/subscriptions/T691POMK62SGC7CHAK/subscriber\");\nxhr.setRequestHeader(\"x-api-key\", \"zJ8LFTBX6Ba8D611e9io13fDZAwj0QmKO1Hn1yIj\");\nxhr.setRequestHeader(\"x-access-token\", \"d31f0721-2f85-44e7-bcc6-15e19d1a53cc\");\nxhr.setRequestHeader(\"Content-Type\", \"application/json\");\n\nxhr.send(data);",
        "language": "javascript"
      },
      {
        "id": "e-VRuRb5Gwpgf2s-YOYAz",
        "code": "<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, array(\n  CURLOPT_URL => 'https://api.unicobros.com.ar/p/subscriptions/T691POMK62SGC7CHAK/subscriber',\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => '',\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 0,\n  CURLOPT_FOLLOWLOCATION => true,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => 'POST',\n  CURLOPT_POSTFIELDS =>'{\n    \"customer\":{\n        \"email\": \"demo@unicobros.com\",\n        \"identification\": \"12123123\",\n        \"name\": \"Test Mobbex\"\n    },\n    \"startDate\":{\n        \"day\": 27,\n        \"month\": 3,\n        \"year\": 2021\n    },\n    \"reference\": \"233211212\"\n}',\n  CURLOPT_HTTPHEADER => array(\n    'x-api-key: zJ8LFTBX6Ba8D611e9io13fDZAwj0QmKO1Hn1yIj',\n    'x-access-token: d31f0721-2f85-44e7-bcc6-15e19d1a53cc',\n    'Content-Type: application/json'\n  ),\n));\n\n$response = curl_exec($curl);\n\ncurl_close($curl);\necho $response;\n",
        "language": "php"
      },
      {
        "id": "tFTVkyK7EpO7VKG7m0YfV",
        "code": "import requests\n\nurl = \"https://api.unicobros.com.ar/p/subscriptions/T691POMK62SGC7CHAK/subscriber\"\n\npayload=\"{\\r\\n    \\\"customer\\\":{\\r\\n        \\\"email\\\": \\\"demo@mobbex.com\\\",\\r\\n        \\\"identification\\\": \\\"12123123\\\",\\r\\n        \\\"name\\\": \\\"Test Unicobros\\\"\\r\\n    },\\r\\n    \\\"startDate\\\":{\\r\\n        \\\"day\\\": 27,\\r\\n        \\\"month\\\": 3,\\r\\n        \\\"year\\\": 2021\\r\\n    },\\r\\n    \\\"reference\\\": \\\"233211212\\\"\\r\\n}\"\nheaders = {\n  'x-api-key': 'zJ8LFTBX6Ba8D611e9io13fDZAwj0QmKO1Hn1yIj',\n  'x-access-token': 'd31f0721-2f85-44e7-bcc6-15e19d1a53cc',\n  'Content-Type': 'application/json'\n}\n\nresponse = requests.request(\"POST\", url, headers=headers, data=payload)\n\nprint(response.text)\n",
        "language": "python"
      }
    ],
    "selectedLanguageId": "pCAIbxL7rD7t-u9KOJ-SC"
  },
  "description": "Permite cambiar el método de pago (guardado mediante \"customerReference\") a un suscriptor",
  "currentNewParameter": {
    "label": "Query Parameter",
    "value": "queryParameters"
  },
  "autoGeneratedAnchorSlug": "cambiar-el-mtodo-de-pago-a-un-suscriptor-via-walle",
  "legacyHash": "X2W3bNFXe-Ijn6k3o6vY6"
}
```
:::

**Ejemplo Cambio de método de pago via Wallet**

`POST https://api.unicobros.com.ar/p/subscriptions/H4QAGHOPE9QW6CUKVO/subscriber/5H1LBRT4WNGYFX3PUF/source`

```json
{
	"token": "W:T3J9TBMJFLVKU846WE",
	"securityCode": "200"
}
```

**Respuesta**

```json
{
    "result": true,
    "data": {
        "status": "success",
        "code": "200",
        "text": "Operación Exitosa!",
        "operation": {
            "view": "default",
            "options": {},
            "id": "3EQRSGW7OJXHJDGADHN631",
            "status": {
                "code": "200",
                "text": "Aprobado",
                "message": "Transacción Aprobada",
                "data": {},
                "view": "default"
            },
            "total": 30.78,
            "currency": {
                "value": "TEST",
                "label": "Test Money",
                "symbol": "T$",
                "locale": "es",
                "isoCode": "000",
                "exponent": 2,
                "hidden": false
            },
            "data": [],
            "actions": []
        }
    }
}
```



