Чтобы иметь возможность проводить рекурретные платежи, необходимо сначала провести обычную покупку или авторизацию средств с передачей флага "зарегистрировать рекарринг"
Последовательность операций
-
запрос
purchase
-
обработать уведомление (callback) и взять оттуда
registeredMethods[0].entity.id
-
послать запрос
recurring
с передачей значения токена
Примеры запросов и ответов
Purchase
POST /card/1-1/operations/purchase HTTP/1.1
W1-Signature: ypcvcQTo1eBEEHx+db5eNYGokls/B3c7uksbis6nKaJPvBojSuGoWAAM2aX2lM52A6EHHllLxI4g91XxIkebZPdIn+MQtuiX5muo0M/tuCoyG3r5mJ2eROH024xUE7JC1fzrMjPCslu81O0XOaVsnZpmlJo2KnZsUAGeTKNkmoE4tHU1zMohnYLmGGtwGo8t4iRIyBBPV48506Q7hT0TvdXCW8CBYtTV19N5l1nthvkob/7qjFBdLkWuVBg4ta6n+/Iza8SvkDl10oDEu/0HyDMncXJ/mmE/UYF0ejavI2dgbD9MMtMN/CsFxAK9h/E6i+ivsK+sNdc0UhQ0MVqj/g==
Content-Type: application/json; charset=UTF-8
Host: localhost:8080
Content-Length: 694
{
"notification" : {
"url" : "http://localhost:65456/callback",
"version" : 1
},
"externalId" : "ext#81",
"amount" : {
"amount" : 10.55,
"currency" : "USD"
},
"payer" : {
"paymentMethod" : {
"entity" : {
"pan" : "4111111111111111",
"expMonth" : 5,
"expYear" : 2022,
"cvv" : "444"
},
"type" : "CARD"
},
"info" : {
"ip" : "127.0.0.1",
"phone" : "9001234567",
"email" : "no-reply@flexo.systems"
}
},
"merchantParameters" : {
"param1" : "anything you want for callback"
},
"registerRecurring" : true,
"tds" : {
"notificationUrl" : "http://tds.notification.url:6789"
}
}
HTTP/1.1 200 OK
Date: Fri, 26 Nov 2021 21:15:03 GMT
Vary: Origin
Vary: Access-Control-Request-Method
Vary: Access-Control-Request-Headers
Content-Type: application/json
Content-Length: 169
{
"operationId" : "1-1-a-484",
"status" : "SUCCEEDED",
"type" : "PURCHASE",
"externalId" : "ext#81",
"params" : { },
"actions" : {
"required" : [ ]
}
}
Уведомление клиента со стороны Flexo о покупке (Callback)
POST /test/emptycallback HTTP/1.1
W1-Signature: GUtMiM+X01LdhM9ZcnzwoKE7Hg4OShLTosAmC6ttnmRwdaHav4xeap+/HAajhFG/OXqJPxG6tQ19usGXrUox+AmeKKE0GxnqgY/x3sy1JfPcwRF6toiU5RuBGN9B9FzLHY7FjJT9iBhVGC1Kv6eSXq5G84MAFtYoukU6fr4tJD5s/Vqm91cni27q+PlkMCyHXSYk6RZqBgp+rmuWH/HuhJt2sBep9fw23APzN+uIMIDwMSPbG5fIZGMLD/ZL3FUa+CjNmxp1kMJFr6RMC6F7YEwr0bV7i6qAGQUOBMHieg6Tl/57JbERBvp45CYZluEEroeOm9apZdDRZXglYV3f3w==
Content-Type: application/json; charset=UTF-8
Host: localhost:8080
Content-Length: 778
{
"id" : "1-1-a-484",
"type" : "PURCHASE",
"externalId" : "ext#81",
"successful" : true,
"amount" : {
"amount" : 10.55,
"currency" : "USD"
},
"baseAmount" : {
"amount" : 10.55,
"currency" : "USD"
},
"registeredMethods" : [ {
"entity" : {
"id" : "1-65"
},
"type" : "RECURRING_TOKEN"
}, {
"entity" : {
"id" : "payoutToken-411111-something-1111"
},
"type" : "PAYOUT_TOKEN"
} ],
"merchantParameters" : {
"param1" : "anything you want for callback"
},
"status" : "SUCCEEDED",
"transactions" : [ {
"type" : "PURCHASE",
"status" : "SUCCEEDED"
} ],
"payer" : {
"paymentMethod" : {
"entity" : {
"pan" : "411111XXXXXX1111"
},
"type" : "MASKED_CARD"
}
}
}
HTTP/1.1 200 OK
Date: Fri, 26 Nov 2021 21:15:03 GMT
Vary: Origin
Vary: Access-Control-Request-Method
Vary: Access-Control-Request-Headers
Recurring
POST /card/1-1/operations/recurring HTTP/1.1
W1-Signature: P9VSOjX01y6/YPsPUKBphbd4GMSU22sESpPpMNjN8Df3kctv9VNbchrtXlPMFab8RRMInTxdQo2Mf9RYRpVYuv3VTbLPIrKoQDw7+qS0m5iYKznaOlK94F0dp8OCjtid+EzWu+GDFpdXBVZL9b65PrmBCY/ccbZ1RX116ECCHCVASbTmRaEzmtQc58hyGT4F6xvBT+NNQ41HgKDb66yQXTR8nMGQqGKRqMf12WYwU0dTmXsAgVGIPak/Uu7HV+s/qVRIcPKFxR2ICuSz81mQlri4LiPGpS4Btj7gL48rB2S4yKgVHJIQdrsqXyyT8lo4h4BkYTbM1fHtJCFU/XCq0Q==
Content-Type: application/json; charset=UTF-8
Host: localhost:8080
Content-Length: 397
{
"notification" : {
"url" : "http://localhost:65456/callback",
"version" : 1
},
"externalId" : "ext#82",
"amount" : {
"amount" : 10.55,
"currency" : "USD"
},
"payer" : {
"paymentMethod" : {
"entity" : {
"id" : "1-65"
},
"type" : "RECURRING_TOKEN"
}
},
"merchantParameters" : {
"param1" : "anything you want for callback"
}
}
HTTP/1.1 200 OK
Date: Fri, 26 Nov 2021 21:15:03 GMT
Vary: Origin
Vary: Access-Control-Request-Method
Vary: Access-Control-Request-Headers
Content-Type: application/json
Content-Length: 170
{
"operationId" : "1-1-a-485",
"status" : "SUCCEEDED",
"type" : "RECURRING",
"externalId" : "ext#82",
"params" : { },
"actions" : {
"required" : [ ]
}
}
Уведомление клиента со стороны Flexo о рекурренте (Callback)
POST /test/emptycallback HTTP/1.1
W1-Signature: aBRRHJH9/jWTHP7oyxSCl1GNt9uhtYP3SWfafRnouniXCJih2FGm46H/DNM6p6PRzVAmCtxLaIWR1yGP8AV3nWF2yhJcbMy8gGxxhaOEml6IyBFpGKyyW+IM2EsoRU2EGvPwmS9aAhwljs2CzhaFUmVfQup0AbirXPVlIWiuTteOUYbpvU2qmR9Y08571AMasOl9BG9ROzzfBkS+NcABWXZ92AboucQ5DpnXkCbAKEPsAJbOqJVsliEXLtTWGycTV3+i8bHbVdB7s7+ik9OvJt/VETz6W9IUJjLK+gx4ULOnLZgfdSpcFdHk3HmGoDHLzwS9YQnFq5BRcPvdHH+n7A==
Content-Type: application/json; charset=UTF-8
Host: localhost:8080
Content-Length: 591
{
"id" : "1-1-a-485",
"type" : "RECURRING",
"externalId" : "ext#82",
"successful" : true,
"amount" : {
"amount" : 10.57,
"currency" : "USD"
},
"baseAmount" : {
"amount" : 10.55,
"currency" : "USD"
},
"registeredMethods" : [ ],
"merchantParameters" : {
"param1" : "anything you want for callback"
},
"status" : "SUCCEEDED",
"transactions" : [ {
"type" : "RECURRING",
"status" : "SUCCEEDED"
} ],
"payer" : {
"paymentMethod" : {
"entity" : {
"pan" : "411111XXXXXX1111"
},
"type" : "MASKED_CARD"
}
}
}
HTTP/1.1 200 OK
Date: Fri, 26 Nov 2021 21:15:03 GMT
Vary: Origin
Vary: Access-Control-Request-Method
Vary: Access-Control-Request-Headers