Чтобы иметь возможность проводить рекурретные платежи, необходимо сначала провести обычную покупку или авторизацию средств с передачей флага "зарегистрировать рекарринг"
Последовательность операций
-
запрос
purchase
-
обработать уведомление (callback) и взять оттуда
registeredMethods[0].entity.id
-
послать запрос
recurring
с передачей значения токена
Примеры запросов и ответов
Purchase
POST /card/1-1/operations/purchase HTTP/1.1
W1-Signature: TNSrqndMvWwHPSnhXsMimTlkvVowzFAG4sTU+bXDNPkXBZG7/JOUNg2pmuq79UDKY/ohZZBwo5iYqafOfyZ5nRRQ/rm23ldEXcE+U2gUMThENp9uHXz1JGy3Bfwr7lNazXz5+wnrwfzgnmnX75fV6FrjfSLzRczgv+7Pb2mEJbOpWlGLqPfj558vEkzM5QR1xiNJDb7obGmnsbzig/MeHTonODncmwP3UqkD5LCNIrjentv3OIggRVIgj9CUt5ClYBISmJXPjfcgO8mt4RGQLbxnYNXSh7jFqWo0neVax/MAi69w5l8knjoV1Z+194QnvBuFa7pVP3OGYmTxGnPX6A==
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#66",
"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",
"email" : "no-reply@example.com",
"phone" : "9001234567"
}
},
"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-54",
"status" : "SUCCEEDED",
"type" : "PURCHASE",
"externalId" : "ext#66",
"params" : { },
"actions" : {
"required" : [ ]
}
}
Уведомление клиента со стороны Flexo о покупке (Callback)
POST /test/emptycallback HTTP/1.1
W1-Signature: HwNHsFPYrDyGe3v+6a07VKiZoQKV/ddubLZFbgZy5krYOIHAq4TTTOeLJc7T5zS9Pqoh7fIc7TmpNoss2OpvugEQJTUwuArHLbfRVKyst7AtCUSBKfKbTgArqfX44n4kgR6E2F7+ZyvwOl6vMbwSucEltmY5Ig7hRrRFXIFFPs3H9lYjSW2O8R8dUncsFhGxt8zqcpn0+OGqMqRpwapzMPk+aBDT4hShLhbH0jOAGZfLH3ons+5Ha/X8BhYXmP+xMdR4DUoWqrp4O5KkZpvj3RWVLVgqpSSP5TdOuU5YxdmfZtvSqB/1/ScnK//DSIiD2TE36Pmdr/wuckeCQ6PGnQ==
Content-Type: application/json
Host: payment.flexo.systems
Content-Length: 819
{
"id" : "1-1-a-54",
"type" : "PURCHASE",
"externalId" : "ext#66",
"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: Nbbvtu+fVZ6V/cAnJUYeetf2MyaGhPXgLeub131cHSjTX2SEBuqb2TUWDXiSFL2asPdsKRLop+VZTsw7J+2fPnMZxy18Ssxd/EpbPir5nsaTVUTyAgbZkovPl4FiKPclPGQwbHvTOLwbmCBDPjp/m+1rmvg2G4p2e51N/rDIcmYN7Hln51piIMr/xk9Czbj1myk2N1XCb8fTZGTPp2+OfNeCrtPZM3sn7l0ODUGddXj3x6FCZRvFuMkXEkXQEZxnX1Z4M/1TRoM+dSowEQVZyh2MtdQjonsKa0YwpwwosA/pxhoUveHY+GCPvz51ipnyWj7CU2WG39BKs4JH4v7hJA==
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#67",
"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-55",
"status" : "SUCCEEDED",
"type" : "RECURRING",
"externalId" : "ext#67",
"params" : { },
"actions" : {
"required" : [ ]
}
}
Уведомление клиента со стороны Flexo о рекурренте (Callback)
POST /test/emptycallback HTTP/1.1
W1-Signature: j7EtO/NVffndAgLf33QcREQKAQ+LASuAMZvBIoLVQHKNcuwyEwWoG/2mKwcqo+k9rpNmZGkGQUA7xer70+cXIz4mcJidBBiF6n9LH7042H0n9Zn41Ulq/zWABZAJ4kSRnSmQeSKN7zDr40J2ejRd6DA0rlJGEiVZSHAwiCPOEpDXsypAa6HkXGQ/w2jfxKGWcbNSr5JS8bOKizupRnIgPEaBr7O73xblXI9yRpRgE7MuwhB/5Fbkthw/k+N5D66MDQiwN0IeoFbh0yeBbLoEDZXkPI7LoemZR85ej2kzE+Ayb1BRMNTHvKmPYUG+86ew3ATcV0ftfq3Um7/WR7QJPA==
Content-Type: application/json
Host: payment.flexo.systems
Content-Length: 632
{
"id" : "1-1-a-55",
"type" : "RECURRING",
"externalId" : "ext#67",
"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