Desarrolladores
Suscripciones/Recurrencia
Suscripciones con wallet
8 min
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" { "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 { "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 , 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 { "customer" { "email" "demo\@unicobros com", "identification" "12123123", "name" "test unicobros" }, "reference" "r2332112121234", "customerreference" "cr2332112121234", "startdate" { "day" 4, "month" 2 } } respuesta { "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 { "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" } } ejemplo obtener información con wallet get https //api unicobros com ar/p/wallet/ref\ cr2332112121234 respuesta { "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 { "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" } } ejemplo cambio de método de pago via wallet post https //api unicobros com ar/p/subscriptions/h4qaghope9qw6cukvo/subscriber/5h1lbrt4wngyfx3puf/source { 	"token" "w\ t3j9tbmjflvku846we", 	"securitycode" "200" } respuesta { "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" \[] } } }