Create a Redirect Session for a new Customer Registration
The Merchant can also create a redirect session for redirecting the customer to Zastrpay website for initial customer registration.
The diagram below illustrates the basic flow of a customer registration triggered from a merchant website:
Steps:
- Customer goes to the Merchant website or app and chooses Zastrpay QR Code Cash Deposit or Withdrawal as the payment method
- The Merchant Website/Backend detects or asks if the customer is not yet registers, and creates a
Redirect Session
withtype = NewCustomer
by calling Zastrpay Backend - The Merchant Website redirects customer to Zastrpay Customer Redirect Website
- The Customer registers with Zastrpay, and generates a QR Code for the
Customer Registration
- The Customer goes to a Zastrpay Shop, presents the QR Code, after scanning of which an ID and potentially additional documents are requested from her/him, and the customer is verified and the registration is finalized
- Zastrpay System notifies Merchant Backend about the customer registration, so that the customer can be marked as registered at Zastrpay in the Merchant Backend
The Customer Registration is a standalone flow (separate from the new transaction flow), and the QR Code generated has the sole purpose of identifying the customer in the shop so that her/his registration can be finalized (different from the QR Code for a transaction).
For the purpose of customer registration the following Merchant Backend -> Zastrpay Backend API call must be implemented:
- http
- curl
PUT https://host.com/customer-authentication-service/v1/redirect-sessions/{redirectSessionId}
Content-Type: application/json
x-api-key: $apiKey
x-request-id: $requestId
{
"type": "NewCustomer",
"redirectData": {
"successUrl": "https://merchant-host.com/zastrpay-register-customer-success",
"failureUrl": "https://merchant-host.com/zastrpay-register-customer-failure",
"abortUrl": "https://merchant-host.com/zastrpay-register-customer-abort",
"qrCodeSuccessUrl": "http://merchant-host.com/zastrpay-create-new-transaction-intent-qr-code-success"
},
"locale": "de-DE",
"customerData": {
"firstName: "Max",
"lastName": "Mustermann",
"dateOfBirth": "1946-10-29",
"placeOfBirth": "Vienna",
"nationality": "DE",
"address": {
"streetAddress": "Hauptstrasse 13/12/1",
"city": "Vienna",
"postalCode": "12345",
"country": "DE",
},
"contact": {
"email": "paul.smith@testabc.com"
}
}
}
curl -0 -v -k -X PUT https://host.com/customer-authentication-service/v1/redirect-sessions/{redirectSessionId} \
-H 'Content-Type: application/json; charset=utf-8' \
-H "x-api-key: $apiKey" \
-H "x-request-id: $requestId" \
--data-binary @- << EOF
{
"type": "NewCustomer",
"redirectData": {
"successUrl": "https://merchant-host.com/zastrpay-register-customer-success",
"failureUrl": "https://merchant-host.com/zastrpay-register-customer-failure",
"abortUrl": "https://merchant-host.com/zastrpay-register-customer-abort",
"qrCodeSuccessUrl": "http://merchant-host.com/zastrpay-register-customer-qr-code-success"
},
"locale": "de-DE",
"customerData": {
"firstName: "Max",
"lastName": "Mustermann",
"dateOfBirth": "1946-10-29",
"placeOfBirth": "Vienna",
"nationality": "DE",
"address": {
"streetAddress": "Hauptstrasse 13/12/1",
"city": "Vienna",
"postalCode": "12345",
"country": "DE",
},
"contact": {
"email": "paul.smith@testabc.com"
}
}
}
EOF
Zastrpay Backend will answer with the following response:
200 OK
{
"id": "bf050093-fce3-4013-8090-524799de3f69",
"type": "ExistingTransactionIntent",
"merchantId": "e51bc4a8-4263-11ea-b317-b7ad13e2406e",
"customerId": "37257cd4-8ff1-46f7-bb20-0da4f954fede",
"transactionIntentId": "08a29f86-0dbc-4ceb-a4eb-f202561cb53e",
"redirectData": {
"successUrl": "https://merchant-host.com/zastrpay-register-customer-success",
"failureUrl": "https://merchant-host.com/zastrpay-register-customer-failure",
"abortUrl": "https://merchant-host.com/zastrpay-register-customer-abort",
"qrCodeSuccessUrl": "http://merchant-host.com/zastrpay-register-customer-qr-code-success"
},
"locale": "de-DE",
"createdOn": "2023-01-26T13:04:59.5633378Z",
"lastCorrelationId": "55a5c33e-9003-4ea7-8e31-cfe5e9acc008",
"token": "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6IjU2ODc4YmZlNzZiNDQyMTVhZmVkYzFkMzQzYTQ0NjU0In0.eyJzaWQiOiJiZjA1MDA5My1mY2UzLTQwMTMtODA5MC01MjQ3OTlkZTNmNjkiLCJtZXJjaElkIjoiZTUxYmM0YTgtNDI2My0xMWVhLWIzMTctYjdhZDEzZTI0MDZlIiwiYXV0aCI6Im90cCIsImN1c3RJZCI6IjM3MjU3Y2Q0LThmZjEtNDZmNy1iYjIwLTBkYTRmOTU0ZmVkZSIsImV4cCI6MTY3NDc0MDA5OSwiaXNzIjoiaHR0cHM6Ly9wYXkuZGV2LmMyZHBheW1lbnQuY29tIiwiYXVkIjoiaHR0cHM6Ly9wYXkuZGV2LmMyZHBheW1lbnQuY29tIn0.LKktJ4j2B-6UXrOrfmHQnqfeWSOvWQFPZJ_j1lJbacOAo-5IaIEMW0XB5kXyZc6qdOCJmIhuYM30SyiVu5TG7zii9zFuWRrdnIDu0tu_K-OJDU9rwn0Dtc-zreUq4VxzJs8utzZ6C7J3RVz3OVUIiDeMINKR0PFq-an4Ht81FSikZAnCreGbFpwsSn5HD9rBwLyDhlp7Dwl71yIn0fKIfAdtcUB6QEPycQi9-qGxYi0BDwy21rWJWI_kOsMi_kAnajtYD3ZB_8DInvAHZilWfV3pL_PuTAoA7OdKztkegt9wUCBQr_EPHU5rGxpBrUJLsYLBTvBqsJZEkp6gepyxtQ",
"redirectUrl": "https://pay.dev.zastrpay.com",
"customerData": {
"firstName: "Max",
"lastName": "Mustermann",
"dateOfBirth": "1946-10-29",
"placeOfBirth": "Vienna",
"nationality": "DE",
"address": {
"streetAddress": "Hauptstrasse 13/12/1",
"city": "Vienna",
"postalCode": "12345",
"country": "DE",
},
"contact": {
"email": "paul.smith@testabc.com"
}
}
}
Here again the important response values to consider for the redirect are token and redirectUrl.
See Create Redirect Session API Reference for more information.
redirectData.successUrl
should point to a page which (after the customer registration has succeeded) invites the customer to initiate a transaction.
Next, the Merchant should create another redirect session with type = NewTransactionIntent
(see Create Redirect Session for new Transaction Intent) and redirect the customer once again to Zastrpay (see Redirect Customer).