Чтобы иметь возможность проводить рекурретные платежи, необходимо сначала провести обычную покупку или авторизацию средств с передачей флага "зарегистрировать рекарринг"
Последовательность операций
-
запрос
purchase
-
обработать уведомление (callback) и взять оттуда
registeredMethods[0].entity.id
-
послать запрос
recurring
с передачей значения токена
Примеры запросов и ответов
Purchase
POST /card/1-1/operations/purchase HTTP/1.1
W1-Signature: wvUabJYmJjLBqh0wkFPlD/fNJxg1h+bhlwqzbc6SXQKLLjorgABdg1Zbrbuy5nfRuhJjK2wuCVDTekzPd3pI8tiVlKQYVEG/pggm2/0qmc6hn+mRkwCpb3+pqsI0GJKoA8OGZe5O2FhDHcI6DJi2bTRxBSIKa2J7/l+ckQCQQ1d22FSGRecbBkHUQxSadejUrmrShZl/e8w4uHsHyuH1zGkJAMlsnYiW17bsx4ViToqxZV0G7A4sVzu81kV3hJW/Fq7dGt5neHfAH6PDN2wm+/f7mcZLdb2uPVXg5mSyDIEF23UADRV65kO7+Bm718xHJ0H6tJcOhKNu3LLTcN4iiA==
Content-Type: application/json
Host: payment.flexo.systems
Content-Length: 750
{
"notification" : {
"url" : "http://127.0.0.1:8080/test/callback/default/",
"version" : 1
},
"externalId" : "ext#68",
"amount" : {
"amount" : 10.55,
"currency" : "USD"
},
"payer" : {
"paymentMethod" : {
"entity" : {
"pan" : "4111111111111111",
"expMonth" : 5,
"expYear" : 2030,
"cvv" : "444"
},
"type" : "CARD"
},
"info" : {
"ip" : "127.0.0.1",
"phone" : "9001234567",
"email" : "no-reply@example.com"
}
},
"merchantParameters" : {
"param1" : "anything you want for callback",
"param2" : null,
"param3" : null
},
"registerRecurring" : true,
"tds" : {
"notificationUrl" : "http://tds.notification.url:6789"
}
}
HTTP/1.1 200 OK
Vary: Origin
Vary: Access-Control-Request-Method
Vary: Access-Control-Request-Headers
Content-Type: application/json
Content-Length: 168
{
"operationId" : "1-1-a-56",
"status" : "SUCCEEDED",
"type" : "PURCHASE",
"externalId" : "ext#68",
"params" : { },
"actions" : {
"required" : [ ]
}
}
Уведомление клиента со стороны Flexo о покупке (Callback)
POST /test/emptycallback HTTP/1.1
W1-Signature: cO+I8F7RMWUZttHTnqoRDeEWT2Epew4/kEqEfMOLkartFmhG0xlxvPaGjXFb7Oo6qthh8rPwWEVffNeNcuN+A8u23RUetSHHSucJIfhUgLYWUiiQunb+JAuwrLliZNopERVLq3/PpDITqgMtJ/q/Uccj1Y5bFedpckE0CBPu2dlNO64cGCgs5QT6v8bMal9sUawwb/nnsiKbGfCQE3gfvCiH3zS3BA9qlsRMX8zEzUSp4bhgYW3mbflbxZze8kqNjwQ3sGtV8tP29VFZKQz18MMfXf0XdGVZMKP9nZOeSBVuDaeKpOA0cgB7/rkwISuzrQz0+zfBBOoDxqbEvQO/Sg==
Content-Type: application/json
Host: payment.flexo.systems
Content-Length: 819
{
"id" : "1-1-a-56",
"type" : "PURCHASE",
"externalId" : "ext#68",
"successful" : true,
"amount" : {
"amount" : 10.55,
"currency" : "USD"
},
"baseAmount" : {
"amount" : 10.55,
"currency" : "USD"
},
"registeredMethods" : [ {
"entity" : {
"id" : "1-14"
},
"type" : "RECURRING_TOKEN"
}, {
"entity" : {
"id" : "payoutToken-411111-something-1111"
},
"type" : "PAYOUT_TOKEN"
} ],
"merchantParameters" : {
"param1" : "anything you want for callback",
"param2" : null,
"param3" : null
},
"status" : "SUCCEEDED",
"transactions" : [ {
"type" : "PURCHASE",
"status" : "SUCCEEDED"
} ],
"payer" : {
"paymentMethod" : {
"entity" : {
"pan" : "411111XXXXXX1111"
},
"type" : "MASKED_CARD"
}
}
}
HTTP/1.1 200 OK
Vary: Origin
Vary: Access-Control-Request-Method
Vary: Access-Control-Request-Headers
Recurring
POST /card/1-1/operations/recurring HTTP/1.1
W1-Signature: cdX5xs5ik0WRTYV7WAgWC6kRgOzcysRItX465pGVwHrhw66tVcoj5e+XEcojboH0yqgA132wbGIsQ2bZaovT9aLlnK1oiTmUz3hAgirlQPJJQN4lo83RP58pEIVfn3Ekpbp9kL/f4MOEATtk4NFXZAlPRGrahaZJLpBH/hXFMHxzfQZLZmqoEslcmGt9tOf0wt2DrdpJ7XeduFI72WVvQ087W3+D2LNbVwUfySJgZFU4GKardRF18s5ZtgoSVOwQXgkVlyNChQe5e9N2GSJH4fGBpHkcelwzDicZ43xS7K/79o9YcanPMY7S90SkLs2nBYMOJbyB/qOjGDdQTv9lFQ==
Content-Type: application/json
Host: payment.flexo.systems
Content-Length: 452
{
"notification" : {
"url" : "http://127.0.0.1:8080/test/callback/default/",
"version" : 1
},
"externalId" : "ext#69",
"amount" : {
"amount" : 10.55,
"currency" : "USD"
},
"payer" : {
"paymentMethod" : {
"entity" : {
"id" : "1-14"
},
"type" : "RECURRING_TOKEN"
}
},
"merchantParameters" : {
"param1" : "anything you want for callback",
"param2" : null,
"param3" : null
}
}
HTTP/1.1 200 OK
Vary: Origin
Vary: Access-Control-Request-Method
Vary: Access-Control-Request-Headers
Content-Type: application/json
Content-Length: 169
{
"operationId" : "1-1-a-57",
"status" : "SUCCEEDED",
"type" : "RECURRING",
"externalId" : "ext#69",
"params" : { },
"actions" : {
"required" : [ ]
}
}
Уведомление клиента со стороны Flexo о рекурренте (Callback)
POST /test/emptycallback HTTP/1.1
W1-Signature: hGVZWseR69ELe3UfN9esqS9hSDiMWBHiZC2mPjYksgojnPEH50aDwFX8aUR74SxC9/K3iVVYfFIO1c7yeRphWA9rsP6pj9VC2cTlmpUbSBfwWHLRb5B+vyhrst9hRFRVdGE801Vx67TCIkZYgTfT9negRD53o3OzheSgdkrfa22Oma7OiYtYmkTGUORSktSrIvu8ve+7yyLaXckSyl6CDwyCIxrc67VKjjTRM+qt9L8gfDTEEuLISYj9Tx0QG5C3VN9R27Ude7JqxCqnYXeIM9ldbbcuMBGpWE264Jsdn+oqbOhnj+8HGd/PkDjcEaybUTne4mfWGiqsEPbG5ydugg==
Content-Type: application/json
Host: payment.flexo.systems
Content-Length: 632
{
"id" : "1-1-a-57",
"type" : "RECURRING",
"externalId" : "ext#69",
"successful" : true,
"amount" : {
"amount" : 10.57,
"currency" : "USD"
},
"baseAmount" : {
"amount" : 10.55,
"currency" : "USD"
},
"registeredMethods" : [ ],
"merchantParameters" : {
"param1" : "anything you want for callback",
"param2" : null,
"param3" : null
},
"status" : "SUCCEEDED",
"transactions" : [ {
"type" : "RECURRING",
"status" : "SUCCEEDED"
} ],
"payer" : {
"paymentMethod" : {
"entity" : {
"pan" : "411111XXXXXX1111"
},
"type" : "MASKED_CARD"
}
}
}
HTTP/1.1 200 OK
Vary: Origin
Vary: Access-Control-Request-Method
Vary: Access-Control-Request-Headers