In order to perform a direct payment using VIPPS, the following actions need to be performed:
User sends CHARGE to 27222
Call to REST API (CGI) is made
REST API (CGI) makes call to a Client Server Function
Based on the keyword sent a call to NEXT Paycore API is made (Paycore SDK is being used):
If CHARGE, than:
Make a POST call to /api/pre-transactions and send sms with vipps reservation page for the user to pay.
User clicks on the link and pays the reserved amount.
Pre-transaction and transaction is created in NEXT Paycore Database and transactionId is being returned to the Client Server app.
New entry in Client Server Database is created with msisd, transactionId and StartChargeUtc date and time
If ENDCHARGE, than:
Update Client Server database EndChargeUtc data and time column.
Calculate the amount to be charged in the Client Server App and based on the msisd, transactionId and StartChargeUtc and EndChargeUtc (client logic for calculation)
Get the transaction with transactionId from Paycore Database using GET /api/transactions/partnerId/transactionId
If reserved amount is greater than calculated amount to be charged, than:
Make a PUT call to /api/transactions/partnerId/transactionId/capture?amount=amount to update the amount to be charged and capture transaction for the updated amount.
Else, if reserved amount is less than the newly calculated amount to be charged, make a PUT call to /api/transactions/partnerId/transactionId/capture and capture the whole reserved amount.
User checks the transactions and can confirm that they were charged the newly calculated amount.
Additionally, we have the option to configure the feature to send a confirmation SMS to end user after sending ENDCHARGE when payment has been captured. That option is configurable through the NEXT portal (or directly in the Paycore database).
Client can enable/disable the confirmation SMS and change the text being send if they:
Log into Next portal and go to Mobile Invoice
2. Click on Setup.
3. Find the Partner for which you want this VIPPS confirmation SMS on captured transaction to be sent and click on the edit button next to it.
4. Scroll down to the Sms receipt section. Here, by ticking the Send a receipt SMS upon successful payment tick-box, you can choose to enable the SMS confirmation to be sent. By changing the Text for the receipt message in the below textbox you can change the confirmation SMS text.
The Text for the receipt message is customizable and the {{amount}} will be resolved with the actual charged amount. In addition to the {{amount}}, you can choose to send an URL to the receipt page, using {{receiptPageUrl}} (e.g. Thank you for using our service. You have been charged {{amount}} NOK / KR. For receipt click here: {{receiptPageUrl}}).
A list of parameters that could be use in the paycore SMS texts could be found on the following Confluence page: Parameters used in Paycore/Setup for Paycore SMS text
Note, if you change this, it will be applied to all payments for the particular partner account. If you choose to enable confirmation SMS none of the payments for them will be “silence”.
REST API (CGI) documentation:
Receive - https://linkmobility.no/wp-content/uploads/sites/3/2019/06/SMS_REST_API_MO-1.7.pdf
Send - https://linkmobility.no/wp-content/uploads/sites/3/2019/06/SMS_REST_API_MT_DLR-1.20.pdf
REST API (CGI) binds to an HTTP triggered Azure function deployed in Azure under:
Subscription: Link Mobile Development(Converted to EA)
Resource Group: Dev-PaymentCore
Function App: clientServer
Function: KeywordSent
URL: https://clientserver.azurewebsites.net/KeywordSent
Database Server: dev-paymentcore.database.windows.net
SQL Database: demo-dp-client-database
Client Server client app calls NEXT Paycore API through an updated version of the Paycore SDK uploaded on: https://www.myget.org/feed/linknorway/package/nuget/LinkMobility.PaymentCore.Sdk
PM> Install-Package LinkMobility.PaymentCore.Sdk -Version 2.1.8 -Source https://www.myget.org/F/linknorway/api/v3/index.json
POST /api/pre-transactions using using LinkMobility.PaymentCore.Sdk.BasePaymentController.CreateDirectPaymentAsync(PreTransactionRequest preTransaction, CancellationToken cancellationToken);
GET /api/transactions/partnerId/transactionId using LinkMobility.PaymentCore.Sdk.BasePaymentController.GetTransactionAsync(int partnerId, string transactionId, CancellationToken cancellationToken);
PUT /api/transactions/partnerId/transactionId/capture using LinkMobility.PaymentCore.Sdk.BasePaymentController.CaptureTransactionAsync(int partnerId, Guid transactionId, CancellationToken cancellationToken);
PUT /api/transactions/partnerId/transactionId/capture?amount=amount using LinkMobility.PaymentCore.Sdk.BasePaymentController.UpdateAndCaptureTransactionAsync(int partnerId, Guid transactionId, decimal amount, CancellationToken cancellationToken);
NEXT Paycore API Documentation: Payment API - Developer Documentation
The ClientServer demo project is uploaded on tfs under the newly created project and repo. There is publicly accessible version of it available on GitHub. See links below:
https://tfs-linkmobility.visualstudio.com/DirectPayment.Function
https://tfs-linkmobility.visualstudio.com/_git/DirectPayment.Function
https://github.com/marsenovska-LinkMobility/DirectPayment.Function
Alternatively, they can choose to also send the link to the receipt page. In such cases, the received SMS upon successful payment will look similar to the following. Hence, charged amount varies depending on the service usage time (5 NOK / KR equals 5 hours of service usage).